Package org.apache.struts2.interceptor
Class ActionExtensionInterceptor
java.lang.Object
org.apache.struts2.interceptor.AbstractInterceptor
org.apache.struts2.interceptor.ActionExtensionInterceptor
- All Implemented Interfaces:
Serializable,ConditionalInterceptor,Interceptor
Rejects requests whose URL extension is not among the extensions declared on the action or its package
with the
extension attribute. Actions without a declaration are not restricted.
A rejected request resolves to badExtensionResultName
when the action maps that result, otherwise the response is 404 Not Found.
Only the request's own action is checked; actions reached by chaining are not.
- Since:
- 7.5.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintercept(ActionInvocation invocation) Override to handle interceptionprotected StringrejectRequest(ActionInvocation invocation) voidsetBadExtensionResultName(String badExtensionResultName) Methods inherited from class org.apache.struts2.interceptor.AbstractInterceptor
destroy, init, setDisabled, shouldIntercept
-
Constructor Details
-
ActionExtensionInterceptor
public ActionExtensionInterceptor()
-
-
Method Details
-
intercept
Description copied from class:AbstractInterceptorOverride to handle interception- Specified by:
interceptin interfaceInterceptor- Specified by:
interceptin classAbstractInterceptor- 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 inAction.execute().
-
rejectRequest
- Returns:
- the bad extension result name when the action maps that result, otherwise
Action.NONEafter sending404 Not Found - Throws:
IOException- Since:
- 7.5.0
-
setBadExtensionResultName
- Since:
- 7.5.0
-