Class HttpMethodValidationInterceptor

java.lang.Object
com.atlassian.xwork.interceptors.RestrictHttpMethodInterceptor
com.atlassian.confluence.xwork.HttpMethodValidationInterceptor
All Implemented Interfaces:
com.opensymphony.xwork2.interceptor.Interceptor, Serializable, org.apache.struts2.interceptor.Interceptor

public class HttpMethodValidationInterceptor extends com.atlassian.xwork.interceptors.RestrictHttpMethodInterceptor
Interceptor that ensures that the action method gets executed within an HTTP request with the required HTTP method.


 @HttpMethodRequired(HttpMethod.POST) public String doExecute() {
 // Do something
 return Action.SUCCESS;
 }
 

If the Http method of the request doesn't match the method (or methods) listed in the annotation value, the interceptor will not invoke the action method. It will instead return RestrictHttpMethodInterceptor.INVALID_METHOD_RESULT.

Since:
4.2
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class com.atlassian.xwork.interceptors.RestrictHttpMethodInterceptor

    com.atlassian.xwork.interceptors.RestrictHttpMethodInterceptor.SecurityLevel

    Nested classes/interfaces inherited from interface com.opensymphony.xwork2.interceptor.Interceptor

    com.opensymphony.xwork2.interceptor.Interceptor.LegacyAdapter
  • Field Summary

    Fields inherited from class com.atlassian.xwork.interceptors.RestrictHttpMethodInterceptor

    INVALID_METHOD_RESULT, PERMITTED_METHODS_PARAM_NAME
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected com.atlassian.xwork.HttpMethod[]
    getPermittedHttpMethods(com.opensymphony.xwork2.ActionInvocation invocation, Method invocationMethod)
     
    protected com.atlassian.xwork.interceptors.RestrictHttpMethodInterceptor.SecurityLevel
     

    Methods inherited from class com.atlassian.xwork.interceptors.RestrictHttpMethodInterceptor

    destroy, init, intercept

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.opensymphony.xwork2.interceptor.Interceptor

    intercept
  • Constructor Details

    • HttpMethodValidationInterceptor

      public HttpMethodValidationInterceptor()
  • Method Details

    • getPermittedHttpMethods

      protected com.atlassian.xwork.HttpMethod[] getPermittedHttpMethods(com.opensymphony.xwork2.ActionInvocation invocation, Method invocationMethod)
      Overrides:
      getPermittedHttpMethods in class com.atlassian.xwork.interceptors.RestrictHttpMethodInterceptor
    • getSecurityLevel

      protected com.atlassian.xwork.interceptors.RestrictHttpMethodInterceptor.SecurityLevel getSecurityLevel()
      Overrides:
      getSecurityLevel in class com.atlassian.xwork.interceptors.RestrictHttpMethodInterceptor