Package net.sourceforge.urlrewriter4j.core

Examples of net.sourceforge.urlrewriter4j.core.RewriterEngine.rewrite()


      f.delete();

    MockContextFacade oMockFacade = new MockContextFacade("/", "src/test/resources",
        "GET", new URL("http://localhost/advertiser/home.html"));
    RewriterEngine oEngine = new RewriterEngine(GetConfig());
    oEngine.rewrite(oMockFacade);
    oMockFacade.expectLocation("/advertiser/home.html");
    oMockFacade.expectStatusCode(200);

    f.createNewFile();
View Full Code Here


    f.createNewFile();

    MockContextFacade oMockFacade2 = new MockContextFacade("/", "src/test/resources",
        "GET", new URL("http://localhost/advertiser/home.html"));
    RewriterEngine oEngine2 = new RewriterEngine(GetConfig());
    oEngine2.rewrite(oMockFacade2);
    oMockFacade2.expectStatusCode(302);
    oMockFacade2.expectRedirectLocation("/advertiser/down.html");
    oMockFacade2.expectHeaderSet("Pragma", "no-cache");
  }
View Full Code Here

  public void testRedirect() throws Exception {
    MockContextFacade oMockFacade = new MockContextFacade("/", ".",
        "GET",
        new URL("http://localhost/old_content/oldie_but_goodie.html"));
    RewriterEngine oEngine = new RewriterEngine(GetConfig());
    oEngine.rewrite(oMockFacade);
    oMockFacade.expectStatusCode(301);
    oMockFacade.expectRedirectLocation("/new_content/oldie_but_goodie.html");
  }
 
  public void testStaticMapping() throws Exception {
View Full Code Here

  public void testStaticMapping() throws Exception {
    MockContextFacade oMockFacade = new MockContextFacade("/", ".",
        "GET",
        new URL("http://localhost/testmapping/One"));
    RewriterEngine oEngine = new RewriterEngine(GetConfig());
    oEngine.rewrite(oMockFacade);
    oMockFacade.expectLocation("/testmapping/Un");
   
    oMockFacade = new MockContextFacade("/", ".",
        "GET",
        new URL("http://localhost/testmapping/Two"));
View Full Code Here

    oMockFacade.expectLocation("/testmapping/Un");
   
    oMockFacade = new MockContextFacade("/", ".",
        "GET",
        new URL("http://localhost/testmapping/Two"));
    oEngine.rewrite(oMockFacade);
    oMockFacade.expectLocation("/testmapping/Deux");
   
    oMockFacade = new MockContextFacade("/", ".",
        "GET",
        new URL("http://localhost/testmapping/SomethingUnexpected"));
View Full Code Here

    oMockFacade.expectLocation("/testmapping/Deux");
   
    oMockFacade = new MockContextFacade("/", ".",
        "GET",
        new URL("http://localhost/testmapping/SomethingUnexpected"));
    oEngine.rewrite(oMockFacade);
    oMockFacade.expectLocation("/testmapping/Zero");
  }
 
  public void testFunctions() throws Exception {
    MockContextFacade oMockFacade = new MockContextFacade("/", ".",
View Full Code Here

  public void testFunctions() throws Exception {
    MockContextFacade oMockFacade = new MockContextFacade("/", ".",
        "GET",
        new URL("http://localhost/function/hello"));
    RewriterEngine oEngine = new RewriterEngine(GetConfig());
    oEngine.rewrite(oMockFacade);
    oMockFacade.expectLocation("/function/olleh");
   
    oMockFacade = new MockContextFacade("/", ".",
        "GET",
        new URL("http://localhost/function/SomethingUnexpected"));
View Full Code Here

    oMockFacade.expectLocation("/function/olleh");
   
    oMockFacade = new MockContextFacade("/", ".",
        "GET",
        new URL("http://localhost/function/SomethingUnexpected"));
    oEngine.rewrite(oMockFacade);
    oMockFacade.expectLocation("/function/SomethingUnexpected");
   
  }

}
View Full Code Here

    RewriterEngine oEngine = new RewriterEngine(oConfig);
    for (int i = 0; i < 1000; i++) {
      MockContextFacade oMockFacade = new MockContextFacade("/",
          "src/test/resources", "GET", new URL(
              "http://localhost/browse/antiques"));
      oEngine.rewrite(oMockFacade);
    }

    long oEnd = System.currentTimeMillis();
    System.out.println(oEnd - oStart + " ms");
  }
View Full Code Here

    oMockFacade.addServerVariable("REMOTE_ADDR", "127.0.0.1");

    RewriterEngine oEngine = new RewriterEngine(oConfiguration);

    try {
      oEngine.rewrite(oMockFacade);
      fail();
    } catch (RewriteException e) {
    }

    oMockFacade.expectStatusCode(501);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.