Package dispatcher

Examples of dispatcher.Dispatcher


            dispatcherInitParams.put("config", "struts-default.xml," + getConfigPath());
        }
    }

    protected Dispatcher initDispatcher(Map<String, String> params) {
        Dispatcher du = new Dispatcher(servletContext, params);
        du.init();
        Dispatcher.setInstance(du);
        ValueStack stack = ((ValueStackFactory) du.getContainer().getInstance(ValueStackFactory.class)).createValueStack();
        stack.getContext().put("com.opensymphony.xwork2.ActionContext.container", du.getContainer());
        ActionContext.setContext(new ActionContext(stack.getContext()));
        configurationManager = du.getConfigurationManager();
        configuration = configurationManager.getConfiguration();
        container = configuration.getContainer();
        return du;
    }
View Full Code Here


            dispatcherInitParams.put("config", "struts-default.xml," + getConfigPath());
        }
    }

    protected Dispatcher initDispatcher(Map<String, String> params) {
        Dispatcher du = new Dispatcher(servletContext, params);
        du.init();
        Dispatcher.setInstance(du);
        ValueStack stack = ((ValueStackFactory) du.getContainer().getInstance(ValueStackFactory.class)).createValueStack();
        stack.getContext().put("com.opensymphony.xwork2.ActionContext.container", du.getContainer());
        ActionContext.setContext(new ActionContext(stack.getContext()));
        configurationManager = du.getConfigurationManager();
        configuration = configurationManager.getConfiguration();
        container = configuration.getContainer();
        return du;
    }
View Full Code Here

  /**
   * Creates and initializes the dispatcher
   */
  public Dispatcher initDispatcher(HostConfig filterConfig) {
    Dispatcher dispatcher = createDispatcher(filterConfig);
    dispatcher.init();
    return dispatcher;
  }
View Full Code Here

   *
   * @throws IllegalStateException
   *             If there is no dispatcher available
   */
  public Dispatcher findDispatcherOnThread() {
    Dispatcher dispatcher = Dispatcher.getInstance();
    if (dispatcher == null) {
      throw new IllegalStateException(
          "Must have the StrutsPrepareFilter execute before this one");
    }
    return dispatcher;
View Full Code Here

        ValueStack stack = (ValueStack) req.getAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY);

        if (stack == null) {

            HttpServletResponse res = (HttpServletResponse) pageContext.getResponse();
            Dispatcher du = Dispatcher.getInstance();
            if (du == null) {
                throw new ConfigurationException("The Struts dispatcher cannot be found.  This is usually caused by "+
                        "using Struts tags without the associated filter. Struts tags are only usable when the request "+
                        "has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag.");
            }
            stack = du.getContainer().getInstance(ValueStackFactory.class).createValueStack();
            Map extraContext = du.createContextMap(new RequestMap(req),
                    req.getParameterMap(),
                    new SessionMap(req),
                    new ApplicationMap(pageContext.getServletContext()),
                    req,
                    res,
View Full Code Here

            params = requestParams;
        }
        Map requestMap = new RequestMap(req);
        Map session = new SessionMap(req);
        Map application = new ApplicationMap(servletContext);
        Dispatcher du = Dispatcher.getInstance();
        HashMap ctx = du.createContextMap(requestMap,
                params,
                session,
                application,
                req,
                res,
                servletContext);

        try {
            ActionMapper actionMapper = du.getContainer().getInstance(ActionMapper.class);
            ActionMapping mapping = actionMapper.getMappingFromActionName(action);
            ActionInvocation inv = new ValidatorActionInvocation(ctx, true);
            ActionProxyFactory actionProxyFactory = du.getContainer().getInstance(ActionProxyFactory.class);
            ActionProxy proxy = actionProxyFactory.createActionProxy(inv, namespace, mapping.getName(), mapping.getMethod(), true, true);
            proxy.execute();
            Object a = proxy.getAction();

            if (a instanceof ValidationAware) {
View Full Code Here

        pageContext.setResponse(response);
        pageContext.setJspWriter(jspWriter);
        pageContext.setServletContext(servletContext);

        mockContainer = new Mock(Container.class);
        Dispatcher du = new Dispatcher(pageContext.getServletContext(), new HashMap());
        du.init();
        Dispatcher.setInstance(du);
        du.setConfigurationManager(configurationManager);
        session = new SessionMap(request);
        Map extraContext = du.createContextMap(new RequestMap(request),
                request.getParameterMap(),
                session,
                new ApplicationMap(pageContext.getServletContext()),
                request,
                response,
View Full Code Here

        ServletContext servletContext = (ServletContext) ctx.get(ServletActionContext.SERVLET_CONTEXT);
        PageContext pageContext = (PageContext) ctx.get(ServletActionContext.PAGE_CONTEXT);
        Map session = ctx.getSession();
        Map application = ctx.getApplication();

        Dispatcher du = Dispatcher.getInstance();
        Map extraContext = du.createContextMap(new RequestMap(req),
                newParams,
                session,
                application,
                req,
                res,
View Full Code Here

        pageContext.setResponse(response);
        pageContext.setJspWriter(jspWriter);
        pageContext.setServletContext(servletContext);

        mockContainer = new Mock(Container.class);
        Dispatcher du = new Dispatcher(pageContext.getServletContext(), new HashMap());
        du.init();
        Dispatcher.setInstance(du);
        du.setConfigurationManager(configurationManager);
        session = new SessionMap(request);
        Map extraContext = du.createContextMap(new RequestMap(request),
                request.getParameterMap(),
                session,
                new ApplicationMap(pageContext.getServletContext()),
                request,
                response,
View Full Code Here

  private Struts2() {
    //
  }

  public static String getConstant(final String name) {
    Dispatcher dispatcher = Dispatcher.getInstance();
    ConfigurationManager manager = dispatcher.getConfigurationManager();
    Configuration configuration = manager.getConfiguration();
    Container container = configuration.getContainer();
    String value = container.getInstance(String.class, name);
    return value;
  }
View Full Code Here

TOP

Related Classes of dispatcher.Dispatcher

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.