diff --git a/core/src/main/java/org/apache/struts2/action/ParametersAware.java b/core/src/main/java/org/apache/struts2/action/ParametersAware.java new file mode 100644 index 000000000..475d603c0 --- /dev/null +++ b/core/src/main/java/org/apache/struts2/action/ParametersAware.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.struts2.action; + +import org.apache.struts2.dispatcher.HttpParameters; + +/** + * This interface gives actions an alternative way of receiving input parameters. The parameters will + * contain all input parameters as implementation of {@link org.apache.struts2.dispatcher.Parameter}. + * Actions that need this should simply implement it. + * + * One common use for this is to have the action propagate parameters to internally instantiated data + * objects. + * + * @since 2.6 + */ +public interface ParametersAware { + + /** + * Sets the HTTP parameters in the implementing class. + * + * @param parameters an instance of {@link HttpParameters}. + */ + void withParameters(HttpParameters parameters); +} diff --git a/core/src/main/java/org/apache/struts2/interceptor/HttpParametersAware.java b/core/src/main/java/org/apache/struts2/interceptor/HttpParametersAware.java index 66f2a1d44..c27a05694 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/HttpParametersAware.java +++ b/core/src/main/java/org/apache/struts2/interceptor/HttpParametersAware.java @@ -31,13 +31,19 @@ import org.apache.struts2.dispatcher.HttpParameters; * One common use for this is to have the action propagate parameters to internally instantiated data * objects. *
+ * + * @deprecated please use {@link org.apache.struts2.action.ParametersAware} instead */ +@Deprecated public interface HttpParametersAware { /** * Sets the HTTP parameters in the implementing class. * * @param parameters an instance of {@link HttpParameters}. + * + * @deprecated please use {@link org.apache.struts2.action.ParametersAware#withParameters(HttpParameters)} instead */ + @Deprecated void setParameters(HttpParameters parameters); } diff --git a/core/src/main/java/org/apache/struts2/interceptor/ParameterAware.java b/core/src/main/java/org/apache/struts2/interceptor/ParameterAware.java index 28eb7491f..9689e36b9 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/ParameterAware.java +++ b/core/src/main/java/org/apache/struts2/interceptor/ParameterAware.java @@ -36,7 +36,7 @@ import java.util.Map; * the map is java.lang.String[]. * * - * @deprecated please use {@link HttpParametersAware} instead + * @deprecated please use {@link org.apache.struts2.action.ParametersAware} instead */ @Deprecated public interface ParameterAware { diff --git a/core/src/main/java/org/apache/struts2/interceptor/RequestAware.java b/core/src/main/java/org/apache/struts2/interceptor/RequestAware.java index 8a7e87072..e8e73eee5 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/RequestAware.java +++ b/core/src/main/java/org/apache/struts2/interceptor/RequestAware.java @@ -18,6 +18,8 @@ */ package org.apache.struts2.interceptor; +import org.apache.struts2.dispatcher.HttpParameters; + import java.util.Map; /** @@ -28,13 +30,17 @@ import java.util.Map; ** This interface is only relevant if the Action is used in a servlet environment. *
+ * @deprecated please use {@link org.apache.struts2.action.ParametersAware} instead */ +@Deprecated public interface RequestAware { /** * Sets the Map of request attributes in the implementing class. * * @param request a Map of HTTP request attribute name/value pairs. + * @deprecated please use {@link org.apache.struts2.action.ParametersAware#withParameters(HttpParameters)} instead */ + @Deprecated public void setRequest(Map