public class HttpMethodInterceptor extends AbstractInterceptor
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.
HttpMethodAware
,
HttpMethod
,
AllowedHttpMethod
,
HttpGet
,
HttpPost
,
HttpPut
,
HttpDelete
,
HttpGetOrPost
,
Serialized FormConstructor and Description |
---|
HttpMethodInterceptor() |
Modifier and Type | Method and Description |
---|---|
protected String |
doIntercept(ActionInvocation invocation,
AnnotatedElement element) |
protected String |
getBadRequestResultName(ActionInvocation invocation) |
String |
intercept(ActionInvocation invocation)
Override to handle interception
|
protected List<HttpMethod> |
readAllowedMethods(AnnotatedElement element) |
void |
setBadRequestResultName(String badRequestResultName) |
destroy, init, setDisabled, shouldIntercept
public String intercept(ActionInvocation invocation) throws Exception
AbstractInterceptor
intercept
in interface Interceptor
intercept
in class AbstractInterceptor
invocation
- the action invocationActionInvocation.invoke()
, or from the interceptor itself.Exception
- any system-level error, as defined in Action.execute()
.protected String doIntercept(ActionInvocation invocation, AnnotatedElement element) throws Exception
Exception
protected List<HttpMethod> readAllowedMethods(AnnotatedElement element)
protected String getBadRequestResultName(ActionInvocation invocation)
public void setBadRequestResultName(String badRequestResultName)
Copyright © 2000–2024 Apache Software Foundation. All rights reserved.