Package org.apache.struts2.dispatcher

Examples of org.apache.struts2.dispatcher.HttpHeaderResult


        // JAVASCRIPT ?
        if (actionName.startsWith("javascript:"))
            return actionName;

        // Init URL Provider
        UrlProvider urlProvider = new ComponentUrlProvider(this, params);
        urlProvider.setHttpServletRequest(request);
        urlProvider.setHttpServletResponse(response);
        urlProvider.setUrlRenderer(urlRenderer);
      // urlProvider.setPortletUrlType(urlType);
        urlProvider.setAction(actionName);
        // render URL
        StringWriter sw = new StringWriter();
        urlRenderer.beforeRenderUrl(urlProvider);
        urlRenderer.renderUrl(sw, urlProvider);
        String url = sw.toString();
View Full Code Here


        // Test with a slash
        PackageConfig packageConfig = createPackageConfigBuilder("/namespace");
        this.conventionsService = new ConventionsServiceImpl("/WEB-INF/location");
        DefaultResultMapBuilder builder = new DefaultResultMapBuilder(context, container, "dispatcher,velocity,freemarker");
        Action actionAnn = OverrideResultAction.class.getMethod("execute").getAnnotation(Action.class);
        Map<String, ResultConfig> results = builder.build(OverrideResultAction.class, actionAnn, "action100", packageConfig);
        ResultConfig result = results.get("error");
        assertNotNull(result);
        assertEquals("/WEB-INF/location/namespace/error-overriden.jsp", result.getParams().get("location"));
    }
View Full Code Here

    buildCfg();
    // 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 class GaeInitOperations extends InitOperations {

  @Override
  public Dispatcher initDispatcher(HostConfig filterConfig) {
    Dispatcher dispatcher = createDispatcher(filterConfig);
    dispatcher.init();
    return dispatcher;
  }
View Full Code Here

  public void init(FilterConfig filterConfig) throws ServletException {
    InitOperations init = new GaeInitOperations();
    try {
      FilterHostConfig config = new FilterHostConfig(filterConfig);
      init.initLogging(config);
      Dispatcher dispatcher = init.initDispatcher(config);

      init.initStaticContentLoader(config, dispatcher);

      prepare = new PrepareOperations(filterConfig.getServletContext(),
          dispatcher);
View Full Code Here

    {
        if (params == null)
        {
            params = new HashMap<String, String>();
        }
        Dispatcher dispatcher = new Dispatcher(servletContext, params);
        dispatcher.init();
        Dispatcher.setInstance(dispatcher);
        return dispatcher;
    }
View Full Code Here

            String name = (String) e.nextElement();
            String value = cfg.getInitParameter(name);
            params.put(name, value);
        }
       
        dispatcherUtils = new Dispatcher(new PortletServletContext(cfg.getPortletContext()), params);
        dispatcherUtils.init();
       
        // For testability
        if (factory == null) {
            factory = dispatcherUtils.getConfigurationManager().getConfiguration().getContainer().getInstance(ActionProxyFactory.class);
View Full Code Here

      methodResult = new DefaultHttpHeaders("show");
      assertEquals("show", restActionInvocation.saveResult(actionConfig, methodResult));
      assertEquals(methodResult, restActionInvocation.httpHeaders);
     
    setUp();
      methodResult = new HttpHeaderResult(HttpServletResponse.SC_ACCEPTED);
      assertEquals(null, restActionInvocation.saveResult(actionConfig, methodResult));
      assertEquals(methodResult, restActionInvocation.createResult());

    setUp();
      try {
View Full Code Here

      methodResult = new DefaultHttpHeaders("show");
      assertEquals("show", restActionInvocation.saveResult(actionConfig, methodResult));
      assertEquals(methodResult, restActionInvocation.httpHeaders);
     
    setUp();
      methodResult = new HttpHeaderResult(HttpServletResponse.SC_ACCEPTED);
      assertEquals(null, restActionInvocation.saveResult(actionConfig, methodResult));
      assertEquals(methodResult, restActionInvocation.createResult());

    setUp();
      try {
View Full Code Here

      methodResult = new DefaultHttpHeaders("show");
      assertEquals("show", restActionInvocation.saveResult(actionConfig, methodResult));
      assertEquals(methodResult, restActionInvocation.httpHeaders);
     
    setUp();
      methodResult = new HttpHeaderResult(HttpServletResponse.SC_ACCEPTED);
      assertEquals(null, restActionInvocation.saveResult(actionConfig, methodResult));
      assertEquals(methodResult, restActionInvocation.createResult());

    setUp();
      try {
View Full Code Here

TOP

Related Classes of org.apache.struts2.dispatcher.HttpHeaderResult

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.