FileDocCategorySizeDatePackage
CreateSessionInterceptor.javaAPI DocExample3048Mon Jul 23 13:26:52 BST 2007org.apache.struts2.interceptor

CreateSessionInterceptor

public class CreateSessionInterceptor extends com.opensymphony.xwork2.interceptor.AbstractInterceptor
This interceptor creates the HttpSession.

This is particular usefull when using the <@s.token> tag in freemarker templates. The tag do require that a HttpSession is already created since freemarker commits the response to the client immediately.

Interceptor parameters:

  • none
  • None
Example:


<action name="someAction" class="com.examples.SomeAction">
<interceptor-ref name="create-session"/>
<interceptor-ref name="defaultStack"/>
<result name="input">input_with_token_tag.ftl</result>
</action>


version
$Date: 2006-11-06 10:01:43 -0500 (Mon, 06 Nov 2006) $ $Id: CreateSessionInterceptor.java 471756 2006-11-06 15:01:43Z husted $

Fields Summary
private static final long
serialVersionUID
private static final Log
_log
Constructors Summary
Methods Summary
public java.lang.Stringintercept(com.opensymphony.xwork2.ActionInvocation invocation)



    /* (non-Javadoc)
     * @see com.opensymphony.xwork2.interceptor.Interceptor#intercept(com.opensymphony.xwork2.ActionInvocation)
     */
          
        _log.debug("Creating HttpSession");
        ServletActionContext.getRequest().getSession(true);
        return invocation.invoke();