Package de.odysseus.calyxo.control.conf

Examples of de.odysseus.calyxo.control.conf.DispatchConfig


    group.setTestModuleContext(request, module1);
  }

  public void testPath() throws Exception {
    DefaultDispatcher dispatcher = new DefaultDispatcher(module1);
    DispatchConfig dispatch = new DynamicDispatchConfig("/path", false);
    TestResponse response = new TestResponse(false);
    dispatcher.dispatch(request, response, dispatch);
    assertEquals("/path", request.getRecentRequestDispatchPath());
    assertNull(response.getRedirectURL());
  }
View Full Code Here


    assertNull(response.getRedirectURL());
  }

  public void testPathRedirect() throws Exception {
    DefaultDispatcher dispatcher = new DefaultDispatcher(module1);
    DispatchConfig dispatch = new DynamicDispatchConfig("/path", true);
    TestResponse response = new TestResponse(false);
    dispatcher.dispatch(request, response, dispatch);
    assertNull(request.getRecentRequestDispatchPath());
    assertEquals("encodeRedirect(/context/path)", response.getRedirectURL());
  }
View Full Code Here

    assertEquals("encodeRedirect(/context/path)", response.getRedirectURL());
  }

  public void testQuery() throws Exception {
    DefaultDispatcher dispatcher = new DefaultDispatcher(module1);
    DispatchConfig dispatch = new DynamicDispatchConfig("/path?foo=bar", false);
    TestResponse response = new TestResponse(false);
    dispatcher.dispatch(request, response, dispatch);
    assertEquals("/path?foo=bar", request.getRecentRequestDispatchPath());
    assertNull(response.getRedirectURL());
  }
View Full Code Here

    assertNull(response.getRedirectURL());
  }

  public void testAnchor() throws Exception {
    DefaultDispatcher dispatcher = new DefaultDispatcher(module1);
    DispatchConfig dispatch = new DynamicDispatchConfig("/path#abc", false);
    TestResponse response = new TestResponse(false);
    dispatcher.dispatch(request, response, dispatch);
    assertEquals("/path#abc", request.getRecentRequestDispatchPath());
    assertNull(response.getRedirectURL());
  }
View Full Code Here

    assertNull(response.getRedirectURL());
  }

  public void testAction() throws Exception {
    DefaultDispatcher dispatcher = new DefaultDispatcher(module1);
    DispatchConfig dispatch = new DynamicDispatchConfig(null, "/action", false);
    TestResponse response = new TestResponse(false);
    dispatcher.dispatch(request, response, dispatch);
    assertEquals("/module1/action", request.getRecentRequestDispatchPath());
    assertNull(response.getRedirectURL());
  }
View Full Code Here

    assertNull(response.getRedirectURL());
  }

  public void testActionRedirect() throws Exception {
    DefaultDispatcher dispatcher = new DefaultDispatcher(module1);
    DispatchConfig dispatch = new DynamicDispatchConfig(null, "/action", true);
    TestResponse response = new TestResponse(false);
    dispatcher.dispatch(request, response, dispatch);
    assertNull(request.getRecentRequestDispatchPath());
    assertEquals("encodeRedirect(/context/module1/action)", response.getRedirectURL());
  }
View Full Code Here

    throws IOException, ServletException {

    Message.Arg arg = new Message.ValueArg(exception.getMessage());
    messages.addError(request, new Message(bundle, key, arg));

    DispatchConfig result = dispatch;
    if (result == null) {
      result = actionConfig.findDispatchConfig(target);
      if (result == null) {
        throw new ServletException("Cannot find dispatch '" + target + "' in '" + actionConfig.toInlineString() + "'");
      }
View Full Code Here

    }

    request.setAttribute(ACTION_PATH_KEY, command.getActionConfig().getPath());

    // execute action command
    DispatchConfig result = null;
    try {
      result = command.execute(request, response);
    } catch (Exception e) {
      result = handle(request, response, command.getActionConfig(), e);
    }

    // dispatch request
    if (result != null) {
      Dispatcher dispatcher = pluginContext.getDefaultDispatcher();
      String name = result.getDispatcher();
      if (name == null) {
        name = command.getActionConfig().getDispatcher();
      }
      if (name != null) {
        dispatcher = pluginContext.getDispatcher(name);
View Full Code Here

  /*
   * (non-Javadoc)
   * @see de.odysseus.calyxo.control.conf.ActionConfig#findDispatchConfig(java.lang.String)
   */
  public DispatchConfig findDispatchConfig(String name) {
    DispatchConfig config = (DispatchConfig)dispatchConfigs.get(name);
    if (config == null && globalDispatches != null) {
      config = globalDispatches.getDispatchConfig(name);
    }
    return config;
  }
View Full Code Here

TOP

Related Classes of de.odysseus.calyxo.control.conf.DispatchConfig

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.