public Map getContextSession() { ActionContext context = ActionContext.getContext(); Map sessionMap = context.getSession(); if ( sessionMap == null ) { sessionMap = new HashMap(); } return sessionMap; }
private static Action getCurrentAction() { ActionContext ctx = ActionContext.getContext(); if ( ctx != null ) { ActionInvocation ai = ctx.getActionInvocation(); if ( ai != null ) return ai.getAction(); } return null; }
public void init( FilterConfig filterConfig ) throws ServletException { ActionContext context = ActionContext.getContext(); container = (PlexusContainer) context.getApplication().get( PlexusLifecycleListener.KEY ); try { LoggerManager loggerManager = (LoggerManager) container.lookup( LoggerManager.ROLE ); logger = loggerManager.getLoggerForComponent( this.getClass().getName() ); } catch ( ComponentLookupException e ) { throw new ServletException( "Unable to lookup Logger from plexus.", e ); } }
/** * Returns the HTTP page context. * * @return the HTTP page context. */ public static PageContext getPageContext() { return (PageContext) ActionContext.getContext().get(PAGE_CONTEXT); }
/** * Sets the HTTP servlet request object. * * @param request the HTTP servlet request object. */ public static void setRequest(HttpServletRequest request) { ActionContext.getContext().put(HTTP_REQUEST, request); }
protected Context createContext(HttpServletRequest request, HttpServletResponse response) { return velocityManager.createContext(ActionContext.getContext().getValueStack(), request, response); }
protected void before(ActionInvocation invocation) throws Exception { invocation.addPreResultListener(this); Map ses = ActionContext.getContext().getSession(); if (ses == null && autoCreateSession) { ses = new SessionMap(ServletActionContext.getRequest()); ActionContext.getContext().setSession(ses); Map app = ActionContext.getContext().getApplication(); final OgnlValueStack stack = ActionContext.getContext().getValueStack(); if (ActionContext.getContext().getParameters().get(sessionReset) != null) { return;
ActionContext ctx = ActionContext.getContext(); Boolean b = (Boolean) ctx.get("__requestWrapper.getAttribute"); if (b != null) { alreadyIn = b.booleanValue(); try { ctx.put("__requestWrapper.getAttribute", Boolean.TRUE); OgnlValueStack stack = ctx.getValueStack(); if (stack != null) { attribute = stack.findValue(s); ctx.put("__requestWrapper.getAttribute", Boolean.FALSE);
public void beforeResult(ActionInvocation invocation, String resultCode) { String key = getKey(invocation); Map app = ActionContext.getContext().getApplication(); final OgnlValueStack stack = ActionContext.getContext().getValueStack(); Map ses = ActionContext.getContext().getSession(); if (ses != null) {
ActionContext ctx = ActionContext.getContext(); writer.startNode(DEBUG_PARAM); serializeIt(ctx.getParameters(), "parameters", writer, new ArrayList()); writer.startNode("context"); String key; Map ctxMap = ctx.getContextMap(); serializeIt(ctx.getSession(), "request", writer, new ArrayList()); serializeIt(ctx.getSession(), "session", writer, new ArrayList()); OgnlValueStack stack = (OgnlValueStack) ctx.get(ActionContext.VALUE_STACK); serializeIt(stack.getRoot(), "valueStack", writer, new ArrayList()); writer.endNode();
protected boolean condition() throws JspTagException ActionContext context = ActionContext.getContext(); if ( context.getApplication() == null ) PlexusContainer container = (PlexusContainer) context.getApplication().get( PlexusLifecycleListener.KEY ); (SecuritySession) context.getSession().get( SecuritySystemConstants.SECURITY_SESSION_KEY );
/** * Gets a single string from the request parameters * * @param key The key * @return The parameter value */ private String getParameter(String key) { String[] arr = (String[]) ActionContext.getContext().getParameters().get(key); if (arr != null && arr.length > 0) { return arr[0]; } return null; }
/** * Create a Freemarker's Model through {@link FreemarkerManager#buildTemplateModel(OgnlValueStack, Object, ServletContext, HttpServletRequest, HttpServletResponse, ObjectWrapper)}. * * @return * @throws TemplateException */ protected SimpleHash createModel() throws TemplateException { FreemarkerManager freemarkerManager = FreemarkerManager.getInstance(); ActionInvocation invocation = ActionContext.getContext().getActionInvocation(); ServletContext servletContext = JspSupportServlet.jspSupportServlet.getServletContext(); OgnlValueStack stack = ActionContext.getContext().getValueStack(); ObjectWrapper wrapper = freemarkerManager.getConfiguration(servletContext).getObjectWrapper(); Object action = null; if(invocation!= null ) action = invocation.getAction(); //Added for NullPointException return freemarkerManager.buildTemplateModel(stack, action, servletContext, request, response, wrapper); } }
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; }
Map session = ActionContext.getContext().getSession(); String sessionToken = (String) session.get(tokenName); LOG.warn(LocalizedTextUtil.findText(TokenHelper.class, "webwork.internal.invalid.token", ActionContext.getContext().getLocale(), "Form token {0} does not match the session token {1}.", new Object[]{ token, sessionToken }));
Map sessionMap = ActionContext.getContext().getSession(); LOG.debug("flash action with key ["+key+"] found in session, pushed action ["+action+"] into stack"); OgnlValueStack stack = (OgnlValueStack) ActionContext.getContext().get(ActionContext.VALUE_STACK); stack.push(action); sessionMap.remove(key);
public String intercept(ActionInvocation invocation) throws Exception { ActionContext ac = invocation.getInvocationContext(); HttpServletRequest request = (HttpServletRequest) ac.get(ServletActionContext.HTTP_REQUEST); log.debug(getTextMessage("webwork.messages.bypass.request", new Object[]{proxy.getNamespace(), proxy.getActionName()}, ActionContext.getContext().getLocale())); Map parameters = ac.getParameters(); for (int index = 0; index < files.length; index++) { if (log.isInfoEnabled()) { log.info(getTextMessage("webwork.messages.current.file", new Object[]{inputName, contentType[index], fileName[index], files[index]}, ActionContext.getContext().getLocale())); if ( acceptFile(files[index], contentType[index], inputName, validation, ac.getLocale())) { parameters.put(inputName, files); parameters.put(inputName + "ContentType", contentType); log.error(getTextMessage("webwork.messages.invalid.file", new Object[]{inputName}, ActionContext.getContext().getLocale())); log.error(getTextMessage("webwork.messages.invalid.content.type", new Object[]{inputName}, ActionContext.getContext().getLocale())); for (int index = 0; index < file.length; index++) { File currentFile = file[index]; log.info(getTextMessage("webwork.messages.removing.file", new Object[]{inputValue, currentFile}, ActionContext.getContext().getLocale()));
/** * Retrieves the 'real' {@link ActionConfig) for the current context. This is different * to what is available in via the {@link com.opensymphony.xwork.ActionContext#getContext()} * method because that come from the 'runtime' configuration which has been generated separately. * * @return The original {@link ActionConfig} for the current context. */ public ActionConfig getCurrentActionConfig() { if ( ActionContext.getContext() != null && ActionContext.getContext().getActionInvocation() != null && ActionContext.getContext().getActionInvocation().getProxy() != null ) { ActionConfig currentAction = ActionContext.getContext().getActionInvocation().getProxy().getConfig(); ActionRequest request = null; try { request = ActionRequest.parse( ActionContext.getContext().getName() ); PackageConfig packageConfig = ConfigurationManager.getConfiguration().getPackageConfig( currentAction.getPackageName() ); if ( packageConfig != null ) return (ActionConfig) packageConfig.getActionConfigs().get( request.getActionName() ); } catch ( ConveyorException e ) { } } return null; }
public void setSessionUser( User user ) { Map map = getContextSession(); map.put( SecuritySession.ROLE, null ); map.put( SecuritySession.USERKEY, user ); ActionContext.getContext().setSession( map ); }
throws Exception ActionContext context = ActionContext.getContext(); Action action = (Action) context.getActionInvocation().getAction(); (SecuritySession) context.getSession().get( SecuritySystemConstants.SECURITY_SESSION_KEY );