Package com.sun.bookstore3.dispatcher

Examples of com.sun.bookstore3.dispatcher.Dispatcher


        freemarkerConfig.setServletContextForTemplateLoading(servletContext, null);
        ServletActionContext.setServletContext(servletContext);


        request.setRequestURI("/tutorial/test5.action");
        Dispatcher dispatcher = Dispatcher.getInstance();
        ActionMapping mapping = dispatcher.getContainer().getInstance(ActionMapper.class).getMapping(
                    request, dispatcher.getConfigurationManager());
        dispatcher.serviceAction(request, response, servletContext, mapping);
        assertEquals("beforenestedafter", stringWriter.toString());
    }
View Full Code Here


        freemarkerConfig.setServletContextForTemplateLoading(servletContext, null);
        ServletActionContext.setServletContext(servletContext);


        request.setRequestURI("/tutorial/test6.action");
        Dispatcher dispatcher = Dispatcher.getInstance();
        ActionMapping mapping = dispatcher.getContainer().getInstance(ActionMapper.class).getMapping(request, dispatcher.getConfigurationManager());
        dispatcher.serviceAction(request, response, servletContext, mapping);

        // TODO lukaszlenart: remove expectedJDK15 and if() after switching to Java 1.6
        String expectedJDK15 =
                "<input type=\"text\" name=\"test\" value=\"\" id=\"test\" foo=\"bar\" placeholder=\"input\"/>"
                + "<input type=\"text\" name=\"test\" value=\"\" id=\"test\" foo=\"bar\" placeholder=\"input\"/>"
View Full Code Here

        freemarkerConfig.setServletContextForTemplateLoading(servletContext, null);
        ServletActionContext.setServletContext(servletContext);


        request.setRequestURI("/tutorial/test7.action");
        Dispatcher dispatcher = Dispatcher.getInstance();
        ActionMapping mapping = dispatcher.getContainer().getInstance(ActionMapper.class).getMapping(request, dispatcher.getConfigurationManager());
        dispatcher.serviceAction(request, response, servletContext, mapping);
        String expected = "<input type=\"radio\" name=\"client\" id=\"client_foo\" value=\"foo\"/><label for=\"client_foo\">foo</label>\n"
                + "<input type=\"radio\" name=\"client\" id=\"client_bar\" value=\"bar\"/><label for=\"client_bar\">bar</label>\n"
                + "\n"
                + "<input type=\"radio\" name=\"car\" id=\"carford\" value=\"ford\"/><label for=\"carford\">Ford Motor Co</label>\n"
                + "<input type=\"radio\" name=\"car\" id=\"cartoyota\" value=\"toyota\"/><label for=\"cartoyota\">Toyota</label>\n";
View Full Code Here

        freemarkerConfig.setServletContextForTemplateLoading(servletContext, null);
        ServletActionContext.setServletContext(servletContext);

        request.setRequestURI("/tutorial/test8.action");
        Dispatcher dispatcher = Dispatcher.getInstance();
        ActionMapping mapping = dispatcher.getContainer().getInstance(ActionMapper.class).getMapping(request, dispatcher.getConfigurationManager());
        dispatcher.serviceAction(request, response, servletContext, mapping);
        String expected = "<input type=\"text\"autofocus=\"autofocus\"/>";
        assertEquals(expected, stringWriter.toString());
    }
View Full Code Here

    extends FilterDispatcher
{
    @Override
    protected Dispatcher createDispatcher( final FilterConfig filterConfig )
    {
        Dispatcher dispatcher = super.createDispatcher( filterConfig );
        ConfigurationManager configurationManager = createConfigurationManager( filterConfig );
        dispatcher.setConfigurationManager( configurationManager );
        return dispatcher;
    }
View Full Code Here

  private Struts2Utils() {
    //
  }

  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

        initDispatcher(null);

    }

    protected Dispatcher initDispatcher(Map<String, String> params) {
        Dispatcher du = StrutsTestCaseHelper.initDispatcher(new MockServletContext(), params);
        configurationManager = du.getConfigurationManager();
        configuration = configurationManager.getConfiguration();
        container = configuration.getContainer();
        return du;
    }
View Full Code Here

   
    public static Dispatcher initDispatcher(Map<String,String> params) {
        if (params == null) {
            params = new HashMap<String,String>();
        }
        Dispatcher du = new Dispatcher(new MockServletContext(), params);
        du.init();
        Dispatcher.setInstance(du);
        return du;
    }
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 {
            Configuration cfg = du.getConfigurationManager().getConfiguration();
            ValidatorActionProxy proxy = new ValidatorActionProxy(namespace, action, ctx);
            cfg.getContainer().inject(proxy);
            proxy.prepare();
            proxy.execute();
            Object a = proxy.getAction();
View Full Code Here

        request = new MockHttpServletRequest();
        pageContext = new MockPageContext(servletContext, request, response);
    }

    protected Dispatcher initDispatcher(Map<String, String> params) {
        Dispatcher du = StrutsTestCaseHelper.initDispatcher(servletContext, params);
        configurationManager = du.getConfigurationManager();
        configuration = configurationManager.getConfiguration();
        container = configuration.getContainer();
        return du;
    }
View Full Code Here

TOP

Related Classes of com.sun.bookstore3.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.