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 SummaryConstructors
- 
Method SummaryModifier 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.AbstractInterceptordestroy, init, setDisabled, shouldIntercept
- 
Constructor Details- 
CookieProviderInterceptorpublic CookieProviderInterceptor()
 
- 
- 
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().
 
- 
addCookiesToResponseprotected void addCookiesToResponse(CookieProvider action, jakarta.servlet.http.HttpServletResponse response) Do what name suggests- Parameters:
- action-- CookieProvideraction
- response- current- HttpServletResponse
 
- 
beforeResultDescription copied from interface:PreResultListener- Specified by:
- beforeResultin interface- PreResultListener
- Parameters:
- invocation- the action invocation
- resultCode- the result code returned by the action (eg.- success).
 
 
-