public Map getContextSession() { ActionContext context = ActionContext.getContext(); Map sessionMap = context.getSession(); if ( sessionMap == null ) { sessionMap = new HashMap(); } return sessionMap; }
static void setInvocationMap(Map invocationMap) { Map session = ActionContext.getContext().getSession(); if (session == null) { throw new IllegalStateException("Unable to access the session."); } session.put(INVOCATION_MAP_KEY, invocationMap); }
static Map getInvocationMap() { Map session = ActionContext.getContext().getSession(); if (session == null) { throw new IllegalStateException("Unable to access the session."); } Map invocationMap = (Map) session.get(INVOCATION_MAP_KEY); if (invocationMap == null) { invocationMap = new HashMap(); setInvocationMap(invocationMap); } return invocationMap; }
public void beforeResult(ActionInvocation invocation, String resultCode) { Map sessionMap = ActionContext.getContext().getSession(); Object action = invocation.getAction(); if (LOG.isDebugEnabled()) LOG.debug("inserting action ["+action+"] into session with key ["+key+"]"); sessionMap.put(key, action); } });
/** * Sets a transaction token into the session using the provided token name. * * @param tokenName the name to store into the session with the token as the value * @return the token string */ public static String setToken(String tokenName) { Map session = ActionContext.getContext().getSession(); String token = GUID.generateGUID(); try { session.put(tokenName, token); } catch(IllegalStateException e) { // WW-1182 explain to user what the problem is String msg = "Error creating HttpSession due response is commited to client. You can use the CreateSessionInterceptor or create the HttpSession from your action before the result is rendered to the client: " + e.getMessage(); LOG.error(msg, e); throw new IllegalArgumentException(msg); } return token; }
protected void after(ActionInvocation invocation, String result) throws Exception { Map ses = ActionContext.getContext().getSession(); if ( ses != null) { unlock(ses); } }
/** * A flash result, that save the current action into the http session before * invoking <code>super.doExecute(...)</code>. * * @see com.opensymphony.webwork.dispatcher.ServletRedirectResult#doExecute(java.lang.String, com.opensymphony.xwork.ActionInvocation) */ protected void doExecute(String finalLocation, ActionInvocation invocation) throws Exception { // before we redirect, let's save the state in to the session Object action = invocation.getAction(); Map session = invocation.getInvocationContext().getSession(); session.put(FlashInterceptor.DEFAULT_KEY, action); super.doExecute(finalLocation, invocation); }
protected void before(ActionInvocation invocation) throws Exception { Map session = invocation.getInvocationContext().getSession(); ApplicationContext applicationContext = (ApplicationContext) session.get(ApplicationContextSessionListener.APP_CONTEXT_SESSION_KEY); AutowireCapableBeanFactory factory = findAutoWiringBeanFactory(applicationContext); factory.autowireBeanProperties(invocation.getAction(),autowireStrategy.intValue(),false); }
protected synchronized ActionInvocationTracker addActionInvocation( ActionInvocation invocation ) throws ComponentLookupException { Map sessionMap = invocation.getInvocationContext().getSession(); ActionInvocationTracker tracker = (ActionInvocationTracker) sessionMap.get( ActionInvocationTracker.ROLE ); if ( tracker == null ) { ActionContext actionContext = invocation.getInvocationContext(); PlexusContainer container = (PlexusContainer) actionContext.getApplication().get( PlexusLifecycleListener.KEY ); //noinspection deprecation tracker = (ActionInvocationTracker) container.lookup( ActionInvocationTracker.ROLE, getTrackerName() ); sessionMap.put( ActionInvocationTracker.ROLE, tracker ); } tracker.addActionInvocation( invocation ); return tracker; } }
/** * @see com.opensymphony.xwork.interceptor.MethodFilterInterceptor#doIntercept(com.opensymphony.xwork.ActionInvocation) */ protected String doIntercept(ActionInvocation invocation) throws Exception { if (log.isDebugEnabled()) { log.debug("Intercepting invocation to check for valid transaction token."); } Map session = ActionContext.getContext().getSession(); synchronized (session) { if (!TokenHelper.validToken()) { return handleInvalidToken(invocation); } return handleValidToken(invocation); } }
Map sessionMap = ActionContext.getContext().getSession();
Map session = ActionContext.getContext().getSession(); String sessionToken = (String) session.get(tokenName);
(SecuritySession) context.getSession().get( SecuritySystemConstants.SECURITY_SESSION_KEY );
Map ses = ActionContext.getContext().getSession(); if (ses != null) {
serializeIt(ctx.getSession(), "request", writer, new ArrayList()); serializeIt(ctx.getSession(), "session", writer, new ArrayList());
public String intercept(ActionInvocation invocation) throws Exception { String result = null; Map ses = ActionContext.getContext().getSession(); before(invocation); try { result = invocation.invoke(); after(invocation, result); } finally { if (ses != null) { unlock(ses); } } return result; }
private Map createExtraContext() { Map parentParams = null; if (!ignoreContextParams) { parentParams = new ActionContext(getStack().getContext()).getParameters(); } Map newParams = (parentParams != null) ? new HashMap(parentParams) : new HashMap(); if (parameters != null) { newParams.putAll(parameters); } ActionContext ctx = new ActionContext(stack.getContext()); ServletContext servletContext = (ServletContext) ctx.get(ServletActionContext.SERVLET_CONTEXT); PageContext pageContext = (PageContext) ctx.get(ServletActionContext.PAGE_CONTEXT); Map session = ctx.getSession(); Map application = ctx.getApplication(); DispatcherUtils.initialize(servletContext); DispatcherUtils du = DispatcherUtils.getInstance(); Map extraContext = du.createContextMap(new RequestMap(req), newParams, session, application, req, res, servletContext); OgnlValueStack newStack = new OgnlValueStack(stack); extraContext.put(ActionContext.VALUE_STACK, newStack); // add page context, such that ServletDispatcherResult will do an include extraContext.put(ServletActionContext.PAGE_CONTEXT, pageContext); return extraContext; }
String name = proxy.getActionName(); ActionContext context = actionInvocation.getInvocationContext(); Map session = context.getSession();
protected boolean setupBackTrack( ActionInvocation invocation, int order ) Map session = invocation.getInvocationContext().getSession(); ActionInvocationTracker tracker = (ActionInvocationTracker) session.get( ActionInvocationTracker.ROLE );
((SessionAware) action).setSession(context.getSession());