Package net.sourceforge.urlrewriter4j.core

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


    oConfiguration.getRules().add(new SetCookieAction("MyCookie", "MyValue"));

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

    oMockFacade.expectStatusCode(200);
    oMockFacade.expectLocation("/test.aspx");
    oMockFacade.expectCookieSet("MyCookie", "MyValue");
  }
View Full Code Here


        new SetStatusAction(HttpServletResponse.SC_PARTIAL_CONTENT));
   
    MockContextFacade oMockFacade = new MockContextFacade("/", ".",
        "GET", new URL("http://localhost/test.aspx"));
    RewriterEngine oEngine = new RewriterEngine(oConfiguration);
    oEngine.rewrite(oMockFacade);

    oMockFacade.expectStatusCode(206);
    oMockFacade.expectLocation("/test.aspx");
  }
View Full Code Here

    MockContextFacade oMockFacade = new MockContextFacade("/", ".",
        "GET", new URL("http://localhost/robots.txt"));
    oMockFacade.addServerVariable("HTTP_USER_AGENT", "Googlebot/2.1");
    RewriterEngine oEngine = new RewriterEngine(GetConfig());
    try {
      oEngine.rewrite(oMockFacade);
      fail();
    } catch (RewriteException e) {
    }
    oMockFacade.expectStatusCode(403);
  }
View Full Code Here

    MockContextFacade oMockFacade = new MockContextFacade("/", ".",
        "GET", new URL("http://localhost/robots.txt"));
    oMockFacade.addServerVariable("REMOTE_ADDR", "10.0.0.1");
    RewriterEngine oEngine = new RewriterEngine(GetConfig());
    try {
      oEngine.rewrite(oMockFacade);
      fail();
    } catch (RewriteException e) {
    }
    oMockFacade.expectStatusCode(403);
  }
View Full Code Here

  public void testGoneContent() throws Exception {
    MockContextFacade oMockFacade = new MockContextFacade("/", ".",
        "GET", new URL("http://localhost/dead_content/boring_article.html"));
    RewriterEngine oEngine = new RewriterEngine(GetConfig());
    try {
      oEngine.rewrite(oMockFacade);
      fail();
    } catch (RewriteException e) {
    }
    oMockFacade.expectStatusCode(410);
  }
View Full Code Here

  public void testMethodNotAllowed() throws Exception {
    MockContextFacade oMockFacade = new MockContextFacade("/", ".",
        "DELETE", new URL("http://localhost/robots.txt"));
    RewriterEngine oEngine = new RewriterEngine(GetConfig());
    try {
      oEngine.rewrite(oMockFacade);
      fail();
    } catch (RewriteException e) {
    }
    oMockFacade.expectStatusCode(405);
  }
View Full Code Here

    MockContextFacade oMockFacade = new MockContextFacade("/", ".",
        "GET", new URL("http://localhost/advanced-functions/"));
    oMockFacade.addServerVariable("HTTP_HOST", "simple.com");
    RewriterEngine oEngine = new RewriterEngine(GetConfig());
    try {
      oEngine.rewrite(oMockFacade);
      fail();
    } catch (RewriteException e) {
    }
    oMockFacade.expectStatusCode(501);
  }
View Full Code Here

      f.delete();

    MockContextFacade oMockFacade = new MockContextFacade("/", "src/test/resources",
        "GET", new URL("http://localhost/upload/info/12345.txt"));
    RewriterEngine oEngine = new RewriterEngine(GetConfig());
    oEngine.rewrite(oMockFacade);
    oMockFacade.expectStatusCode(200);

    f.createNewFile();

    MockContextFacade oMockFacade2 = new MockContextFacade("/", "src/test/resources",
View Full Code Here

    f.createNewFile();

    MockContextFacade oMockFacade2 = new MockContextFacade("/", "src/test/resources",
        "GET", new URL("http://localhost/upload/info/12345.txt"));
    RewriterEngine oEngine2 = new RewriterEngine(GetConfig());
    oEngine2.rewrite(oMockFacade2);
    oMockFacade2.expectStatusCode(206);
  }

  public void testRewrite() throws Exception {
    MockContextFacade oMockFacade = new MockContextFacade("/", "src/test/resources",
View Full Code Here

  public void testRewrite() throws Exception {
    MockContextFacade oMockFacade = new MockContextFacade("/", "src/test/resources",
        "GET", new URL("http://localhost/browse/antiques"));
    RewriterEngine oEngine = new RewriterEngine(GetConfig());
    oEngine.rewrite(oMockFacade);
    oMockFacade.expectLocation("/browse.aspx?cat=antiques");
    oMockFacade.expectStatusCode(200);
  }

  public void testAdvertiserDown() throws Exception {
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.