Adds new interface to allow action cooperate with HttpMethodInterceptor
Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/9930ceb7 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/9930ceb7 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/9930ceb7 Branch: refs/heads/feature/http-interceptor Commit: 9930ceb7fe3e203c3e33df6c12ce0f44adfc529d Parents: 84a7cc3 Author: Lukasz Lenart <[email protected]> Authored: Sat Apr 19 18:05:58 2014 +0200 Committer: Lukasz Lenart <[email protected]> Committed: Sat Apr 19 18:05:58 2014 +0200 ---------------------------------------------------------------------- .../interceptor/httpmethod/HttpMethodAware.java | 30 ++++++++++++++++++++ 1 file changed, 30 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/struts/blob/9930ceb7/core/src/main/java/org/apache/struts2/interceptor/httpmethod/HttpMethodAware.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/struts2/interceptor/httpmethod/HttpMethodAware.java b/core/src/main/java/org/apache/struts2/interceptor/httpmethod/HttpMethodAware.java new file mode 100644 index 0000000..cfdc782 --- /dev/null +++ b/core/src/main/java/org/apache/struts2/interceptor/httpmethod/HttpMethodAware.java @@ -0,0 +1,30 @@ +package org.apache.struts2.interceptor.httpmethod; + +/** + * Action when implements this interface is notified about what method was used to perform request, + * it works in connection with {@link org.apache.struts2.interceptor.httpmethod.HttpMethodInterceptor} + * + * Another function of this interface is to return result which should be returned when action + * was called with wrong http method + * + * @since 2.3.18 + */ +public interface HttpMethodAware { + + /** + * Notifies action about http method used to perform request + * + * @param httpMethod {@link javax.servlet.http.HttpServletRequest#getMethod()} translated to enum + */ + public void setMethod(HttpMethod httpMethod); + + /** + * Action name to use when action was requested with wrong http method + * can return null and then default result name will be used instead defined + * in {@link org.apache.struts2.interceptor.httpmethod.HttpMethodInterceptor} + * + * @return result name or null + */ + public String getBadRequestResultName(); + +}
