Package org.apache.struts2.interceptor
Class CookieProviderInterceptor
java.lang.Object
org.apache.struts2.interceptor.AbstractInterceptor
org.apache.struts2.interceptor.CookieProviderInterceptor
- All Implemented Interfaces:
Serializable,ConditionalInterceptor,Interceptor,PreResultListener
Allows actions to send cookies to client, action must implement
CookieProvider
You must reference this interceptor in your default stack or in action's stack, see example below.
none
- addCookiesToResponse - this method applies cookie created by action to response
<action ... > <interceptor-ref name="defaultStack"/> <interceptor-ref name="cookieProvider"/> ... </action>
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddCookiesToResponse(CookieProvider action, jakarta.servlet.http.HttpServletResponse response) Do what name suggestsvoidbeforeResult(ActionInvocation invocation, String resultCode) intercept(ActionInvocation invocation) Override to handle interceptionMethods inherited from class org.apache.struts2.interceptor.AbstractInterceptor
destroy, init, setDisabled, shouldIntercept
-
Constructor Details
-
CookieProviderInterceptor
public CookieProviderInterceptor()
-
-
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().
-
addCookiesToResponse
protected void addCookiesToResponse(CookieProvider action, jakarta.servlet.http.HttpServletResponse response) Do what name suggests- Parameters:
action-CookieProvideractionresponse- currentHttpServletResponse
-
beforeResult
Description copied from interface:PreResultListener- Specified by:
beforeResultin interfacePreResultListener- Parameters:
invocation- the action invocationresultCode- the result code returned by the action (eg.success).
-