Class HttpMethodInterceptor
java.lang.Object
org.apache.struts2.interceptor.AbstractInterceptor
org.apache.struts2.interceptor.httpmethod.HttpMethodInterceptor
- All Implemented Interfaces:
- Serializable,- ConditionalInterceptor,- Interceptor
Interceptor is used to control with what http methods action can be called,
 if request with not allowed method was performed, 
badRequestResultName
 will be returned or if action implements HttpMethodAware
 and HttpMethodAware.getBadRequestResultName() returns non-null result name,
 thus value will be used instead.
 
 To limit allowed http methods, annotate action class with AllowedHttpMethod and specify,
 which methods are allowed. You can also use shorter versions HttpGet, HttpPost,
 HttpPut, HttpDelete and HttpGetOrPost
 You can combine any of these annotations to achieve required allowed methods' filtering.
- Since:
- 6.2.0
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected StringdoIntercept(ActionInvocation invocation, AnnotatedElement element) protected StringgetBadRequestResultName(ActionInvocation invocation) intercept(ActionInvocation invocation) Override to handle interceptionprotected List<HttpMethod>readAllowedMethods(AnnotatedElement element) voidsetBadRequestResultName(String badRequestResultName) Methods inherited from class org.apache.struts2.interceptor.AbstractInterceptordestroy, init, setDisabled, shouldIntercept
- 
Constructor Details- 
HttpMethodInterceptorpublic HttpMethodInterceptor()
 
- 
- 
Method Details- 
interceptDescription copied from class:AbstractInterceptorOverride to handle interception- Specified by:
- interceptin interface- Interceptor
- Specified by:
- interceptin class- AbstractInterceptor
- Parameters:
- invocation- the action invocation
- Returns:
- the return code, either returned from ActionInvocation.invoke(), or from the interceptor itself.
- Throws:
- Exception- any system-level error, as defined in- Action.execute().
 
- 
doInterceptprotected String doIntercept(ActionInvocation invocation, AnnotatedElement element) throws Exception - Throws:
- Exception
 
- 
readAllowedMethods
- 
getBadRequestResultName
- 
setBadRequestResultName
 
-