Package net.sourceforge.urlrewriter4j.core.actions

Examples of net.sourceforge.urlrewriter4j.core.actions.RewriteAction


      throws ConfigurationException {
    Node oRewriteNode = pNode.getAttributes().getNamedItem(Constants.ATTR_REWRITE);
    if (oRewriteNode == null) {
      Node oProcessingNode = pNode.getAttributes().getNamedItem(Constants.ATTR_PROCESSING);
      RewriteProcessing oProcessing = ParserHelper.parseProcessing(oProcessingNode, RewriteProcessing.ContinueProcessing);
      return new RewriteAction(oRewriteNode.getNodeValue(), oProcessing);
    }
    return null;
  }
View Full Code Here


  public IRewriteAction parse(Node pNode, RewriterConfiguration pConfig)
      throws ConfigurationException {
    Node oToNode = ParserHelper.getAttribute(pNode, Constants.ATTR_TO, true);
    Node oProcessingNode = pNode.getAttributes().getNamedItem(Constants.ATTR_PROCESSING);
    RewriteProcessing oProcessing = ParserHelper.parseProcessing(oProcessingNode, RewriteProcessing.ContinueProcessing);
    RewriteAction oAction = new RewriteAction(oToNode.getNodeValue(), oProcessing);
    parseConditions(pNode, oAction.getConditions(), false, pConfig);
    return oAction;
  }
View Full Code Here

  public void testRewriteActionWithStop() throws Exception {
    RewriterConfiguration oConfiguration = getConfig();

    oConfiguration.getRules().add(
        new RewriteAction("/foo.aspx", RewriteProcessing.StopProcessing));
    oConfiguration.getRules().add(
        new RewriteAction("/foo2.aspx", RewriteProcessing.StopProcessing));

    MockContextFacade oMockFacade = new MockContextFacade("/", ".",
        "GET", new URL("http://localhost/test.aspx"));
    RewriterEngine oEngine = new RewriterEngine(oConfiguration);
    oEngine.rewrite(oMockFacade);
View Full Code Here

  public void testRewriteActionWithContinue() throws Exception {
    RewriterConfiguration oConfiguration = getConfig();

    oConfiguration.getRules().add(
        new RewriteAction("/foo2.aspx",
            RewriteProcessing.ContinueProcessing));
    oConfiguration.getRules()
        .add(
            new RewriteAction("/foo.aspx",
                RewriteProcessing.ContinueProcessing));

    MockContextFacade oMockFacade = new MockContextFacade("/", ".",
        "GET", new URL("http://localhost/test.aspx"));
    RewriterEngine oEngine = new RewriterEngine(oConfiguration);
View Full Code Here

  public void benchmark() throws Exception {
    RewriterConfiguration oConfiguration = new RewriterConfiguration();
    //rule.setFrom("^/([a-z]+)/([0-9]+)/" + i + "/$");
      // rule.setTo("/blah/a/$2/");   
    for (int i = 0; i < 1000; i++) {
      RewriteAction oRewriteAction = new RewriteAction("/blah/a/$2/", RewriteProcessing.StopProcessing); // RewriteProcessing.StopProcessing);
      ConditionalAction oAction = new ConditionalAction();
      oAction.getConditions().add(new UrlMatchCondition("^/([a-z]+)/([0-9]+)/" + i + "/$"));
      oAction.getActions().add(oRewriteAction);
      oConfiguration.getRules().add(oAction);
    }   
View Full Code Here

    mEngine.rewrite(oMockFacade);
    oMockFacade.expectLocation("/rewritten-DVD.html");
  }

  private ConditionalAction createUrlConditionAndRewirteAction(String pRewriteLocation, String pUrlPattern) {
    RewriteAction oRewriteAction = new RewriteAction(pRewriteLocation, RewriteProcessing.StopProcessing);
    ConditionalAction oAction = new ConditionalAction();
    oAction.getConditions().add(new UrlMatchCondition(pUrlPattern));
    oAction.getActions().add(oRewriteAction);
    return oAction;
  }
View Full Code Here

TOP

Related Classes of net.sourceforge.urlrewriter4j.core.actions.RewriteAction

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.