LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.view.web.struts.action
Class LyStrutsSessionBean

java.lang.Object
  extended by org.apache.struts.action.ActionForm
      extended by leon.view.web.struts.action.LyStrutsSessionBean
All Implemented Interfaces:
java.io.Serializable

public class LyStrutsSessionBean
extends org.apache.struts.action.ActionForm

Type : leon.view.web.struts.LyStrutsSessionBean
This bean should be declared as a global bean in the struts-config.xml file with the <form-beans>tag.
It should also be used in the session scope of all Leonardi action mappings declarations.

This bean manages the LySession birth and death and makes the link with the HttpSession provided it has been properly declared.

See Also:
Serialized Form

Field Summary
static java.lang.String __VERSION
           
static java.util.HashMap<LySession,LyStrutsSessionBean> _sessionBeans
          Keep the information between sessions and beans.
static java.lang.String DEFAULT_SESSION
          Identifier of the default session.
 
Constructor Summary
LyStrutsSessionBean()
          Empty constructor : used for Java reflection.
 
Method Summary
 void beginRequest()
          Stores the current session in the Leonardi application.
 void checkSession(javax.servlet.http.HttpServletRequest request)
          Checks the existence of a Leonardi session.
 void closeCurrentSession(javax.servlet.http.HttpServletRequest request)
          Close the current session and close http session if needed.
 void closeCurrentSession(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpSession session)
          Close the current session and close http session if needed.
 void closeCurrentSession(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpSession session, boolean closeHttpSession)
          Close the current session and close http session if needed.
 void endRequest()
          Removes the current session from the Leonardi application.
 LyWebApplication getApplication()
          Gets the application of the current session.
 LyEnvironment getEnvironment()
          Gets the environment of the current session.
 LyController getLastShownController()
          Returns the last shown controller (used only in LY_REPLAY mode).
 LySession getSession()
          Gets the associated LySession.
 java.lang.String getStaticAction(java.lang.String actionId)
          Gets the id of static action previously stored in this bean.
 LyStrutsViewManager getViewManager()
          Gets the view manager related to the current session.
 boolean isReplayMode()
          Indicates if current session is in replay mode.
 boolean isSessionInProgress()
           
 void reset(org.apache.struts.action.ActionMapping mapping, javax.servlet.http.HttpServletRequest request)
          This method is called by the Struts request processor each time this bean is involed in a request to reset its properties.
 void setLastShownController(LyController controller)
          Set the last shown controller (used only in LY_REPLAY mode).
 void setSession(LySession session)
          Sets the associated LySession.
 void setStaticAction(java.lang.String actionId, java.lang.String controllerId)
          Stores a static action.
static void swapSession(java.lang.Object session, java.lang.Object oldSession, java.lang.String applicationId)
          Swap two sessions.
 
Methods inherited from class org.apache.struts.action.ActionForm
getMultipartRequestHandler, getServletWrapper, reset, setMultipartRequestHandler, setServlet, validate, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

__VERSION

public static final java.lang.String __VERSION
See Also:
Constant Field Values

DEFAULT_SESSION

public static final java.lang.String DEFAULT_SESSION
Identifier of the default session.

See Also:
Constant Field Values

_sessionBeans

public static java.util.HashMap<LySession,LyStrutsSessionBean> _sessionBeans
Keep the information between sessions and beans.

Constructor Detail

LyStrutsSessionBean

public LyStrutsSessionBean()
Empty constructor : used for Java reflection.

Method Detail

swapSession

public static void swapSession(java.lang.Object session,
                               java.lang.Object oldSession,
                               java.lang.String applicationId)
Swap two sessions.

Parameters:
session - the new session
oldSession - the old session
applicationId - the application id

beginRequest

public void beginRequest()
Stores the current session in the Leonardi application.
Adds a lock to the Leonardi application.


endRequest

public void endRequest()
Removes the current session from the Leonardi application.
Removes a lock from the Leonardi application.


isSessionInProgress

public boolean isSessionInProgress()

getApplication

public LyWebApplication getApplication()
Gets the application of the current session.
It wakes it up if necessary.

Returns:
the application of the current session.

getEnvironment

public LyEnvironment getEnvironment()
Gets the environment of the current session.

Returns:
the environment of the current session.

getSession

public LySession getSession()
Gets the associated LySession.

Returns:
the current Leonardi Session
See Also:
setSession(LySession)

getStaticAction

public java.lang.String getStaticAction(java.lang.String actionId)
Gets the id of static action previously stored in this bean.

Parameters:
actionId - Identifier of a Leonardi action.
Returns:
The identifier of the related view controller or null if not found
See Also:
setStaticAction(String, String)

getViewManager

public LyStrutsViewManager getViewManager()
Gets the view manager related to the current session.

Returns:
the view manager related to the current session.

setLastShownController

public void setLastShownController(LyController controller)
Set the last shown controller (used only in LY_REPLAY mode).


getLastShownController

public LyController getLastShownController()
Returns the last shown controller (used only in LY_REPLAY mode).


isReplayMode

public boolean isReplayMode()
Indicates if current session is in replay mode.


reset

public void reset(org.apache.struts.action.ActionMapping mapping,
                  javax.servlet.http.HttpServletRequest request)
This method is called by the Struts request processor each time this bean is involed in a request to reset its properties.
Specific Leonardi treatments are done :

Overrides:
reset in class org.apache.struts.action.ActionForm
Parameters:
mapping - The mapping used to select this instance
request - The servlet request we are processing

setSession

public void setSession(LySession session)
Sets the associated LySession.

Parameters:
session - The leonardi session.
See Also:
getSession()

closeCurrentSession

public void closeCurrentSession(javax.servlet.http.HttpServletRequest request)
Close the current session and close http session if needed.

Parameters:
request - current http request

closeCurrentSession

public void closeCurrentSession(javax.servlet.http.HttpServletRequest request,
                                javax.servlet.http.HttpSession session)
Close the current session and close http session if needed.

Parameters:
request - current http request
session - current http session

closeCurrentSession

public void closeCurrentSession(javax.servlet.http.HttpServletRequest request,
                                javax.servlet.http.HttpSession session,
                                boolean closeHttpSession)
Close the current session and close http session if needed.

Parameters:
request - current http request
session - current http session
closeHttpSession - indicates whether http session must be closed

setStaticAction

public void setStaticAction(java.lang.String actionId,
                            java.lang.String controllerId)
Stores a static action.

Parameters:
actionId - The identifier of a Leonardi action.
controllerId - The identifier of the related view controller.
See Also:
getStaticAction(String)

checkSession

public void checkSession(javax.servlet.http.HttpServletRequest request)
Checks the existence of a Leonardi session.
If no session exists, a new Leonardi session is created.

Parameters:
request - current http request

(c) January 2013 - W4 S.A.

Website: W4 S.A., contact us: support@w4global.com