Package com.opensymphony.xwork2

Examples of com.opensymphony.xwork2.ActionContext


        context.put(ServletActionContext.HTTP_REQUEST, request);
        context.put(ServletActionContext.HTTP_RESPONSE, response);
        context.put(ServletActionContext.SERVLET_CONTEXT, servletContext);

        ActionContext.setContext(new ActionContext(context));
    }
View Full Code Here


     * @see com.opensymphony.xwork2.interceptor.MethodFilterInterceptor#doIntercept(com.opensymphony.xwork2.ActionInvocation)
     */
    protected String doIntercept(ActionInvocation actionInvocation) throws Exception {
        ActionProxy proxy = actionInvocation.getProxy();
        String name = getBackgroundProcessName(proxy);
        ActionContext context = actionInvocation.getInvocationContext();
        Map session = context.getSession();
        HttpSession httpSession = ServletActionContext.getRequest().getSession(true);

        Boolean secondTime  = true;
        if (executeAfterValidationPass) {
            secondTime = (Boolean) context.get(KEY);
            if (secondTime == null) {
                context.put(KEY, true);
                secondTime = false;
            } else {
                secondTime = true;
                context.put(KEY, null);
            }
        }

        //sync on the real HttpSession as the session from the context is a wrap that is created
        //on every request
View Full Code Here

                LOG.debug("Intercepting tiles include '" + include + "'. Processing as freemarker result.");
            }
            HttpServletRequest request = (HttpServletRequest) getRequest();
            HttpServletResponse response = (HttpServletResponse) getResponse();

            ActionContext ctx = ServletActionContext.getActionContext(request);
            ActionInvocation invocation = ctx.getActionInvocation();

            try {
                FreemarkerResult result = new FreemarkerResult();
                result.setWriter(response.getWriter());

                Container container = ctx.getContainer();
                container.inject(result);

                result.doExecute(include, invocation);
            } catch (Exception e) {
                LOG.error("Error invoking Freemarker template", e);
View Full Code Here

    }

    @Override
    protected Locale storeLocale(ActionInvocation invocation, Locale locale, String storage) {
        if (COOKIE_STORAGE.equals(storage)) {
            ActionContext ac = invocation.getInvocationContext();
            HttpServletResponse response = (HttpServletResponse) ac.get(StrutsStatics.HTTP_RESPONSE);

            Cookie cookie = new Cookie(DEFAULT_COOKIE_ATTRIBUTE, locale.toString());
            cookie.setMaxAge(1209600); // two weeks
            response.addCookie(cookie);
View Full Code Here

        super.setUp();
        this.tag = new Token(stack, request, response);

        Map map = new HashMap();
        map.put(ActionContext.SESSION, new HashMap());
        ActionContext.setContext(new ActionContext(map));
    }
View Full Code Here

  protected ActionInvocation actionInvocation;
 
  @Override
    protected void setUp() throws Exception {
    contextMap = new LinkedHashMap();
    context = new ActionContext(contextMap);
   
    actionInvocationControl = MockControl.createControl(ActionInvocation.class);
    actionInvocation = (ActionInvocation) actionInvocationControl.getMock();
    actionInvocationControl.expectAndDefaultReturn(actionInvocation.getAction()new SampleAction());
    actionInvocationControl.expectAndDefaultReturn(actionInvocation.getInvocationContext(), context);
View Full Code Here

            extraContext.put(ServletActionContext.PAGE_CONTEXT, pageContext);
            stack.getContext().putAll(extraContext);
            req.setAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY, stack);

            // also tie this stack/context to the ThreadLocal
            ActionContext.setContext(new ActionContext(stack.getContext()));
        } else {
            // let's make sure that the current page context is in the action context
            Map<String, Object> context = stack.getContext();
            context.put(ServletActionContext.PAGE_CONTEXT, pageContext);
View Full Code Here

        return stack;
    }

    public static String buildNamespace(ActionMapper mapper, ValueStack stack, HttpServletRequest request) {
        ActionContext context = new ActionContext(stack.getContext());
        ActionInvocation invocation = context.getActionInvocation();

        if (invocation == null) {
            ActionMapping mapping = mapper.getMapping(request,
                    Dispatcher.getInstance().getConfigurationManager());
View Full Code Here

        this.location = locationArg;
        this.invocation = invocation;
        this.configuration = getConfiguration();
        this.wrapper = getObjectWrapper();

        ActionContext ctx = invocation.getInvocationContext();
        HttpServletRequest req = (HttpServletRequest) ctx.get(ServletActionContext.HTTP_REQUEST);

        if (!locationArg.startsWith("/")) {
            String base = ResourceUtil.getResourceBase(req);
            locationArg = base + "/" + locationArg;
        }
View Full Code Here

            using this, other plugins (like OSGi) can plugin their own classloader for a while
            and it will be used by Convention (it cannot be a bean, as Convention is likely to be
            called multiple times, and it needs to use the default ClassLoaderInterface during normal startup)
            */
            ClassLoaderInterface classLoaderInterface = null;
            ActionContext ctx = ActionContext.getContext();
            if (ctx != null)
                classLoaderInterface = (ClassLoaderInterface) ctx.get(ClassLoaderInterface.CLASS_LOADER_INTERFACE);

            return ObjectUtils.defaultIfNull(classLoaderInterface, new ClassLoaderInterfaceDelegate(getClassLoader()));
        }
    }
View Full Code Here

TOP

Related Classes of com.opensymphony.xwork2.ActionContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.