Search in sources :

Example 6 with JettyBootstrap

use of org.teknux.jettybootstrap.JettyBootstrap in project jetty-bootstrap by teknux-org.

the class JettyBootstrapTest method do09StaticResourceTest.

@Test
public void do09StaticResourceTest() throws IllegalStateException, IOException, JettyBootstrapException, KeyManagementException, NoSuchAlgorithmException, KeyStoreException, URISyntaxException {
    File folder = temporaryFolder.newFolder();
    copyResourceToFile("/webapp", folder);
    JettyBootstrap jettyBootstrap = initServer(false);
    jettyBootstrap.addExplodedWarApp(folder.getPath(), null, "/staticResource");
    jettyBootstrap.startServer();
    Assert.assertEquals(new SimpleResponse(200, "StaticResContent\n"), get("/staticResource/index.html"));
}
Also used : JettyBootstrap(org.teknux.jettybootstrap.JettyBootstrap) File(java.io.File) Test(org.junit.Test)

Example 7 with JettyBootstrap

use of org.teknux.jettybootstrap.JettyBootstrap in project jetty-bootstrap by teknux-org.

the class JettyBootstrapTest method do16SslExplodedWarFromClasspathTest.

@Test
public void do16SslExplodedWarFromClasspathTest() throws IllegalStateException, IOException, JettyBootstrapException, KeyManagementException, NoSuchAlgorithmException, KeyStoreException, URISyntaxException {
    JettyBootstrap jettyBootstrap = initServer(true);
    jettyBootstrap.addExplodedWarAppFromClasspath("/webapp", null, "/sslExplodedWarFromClasspath");
    jettyBootstrap.startServer();
    Assert.assertEquals(new SimpleResponse(200, "StaticResContent\n"), get("/sslExplodedWarFromClasspath/index.html"));
}
Also used : JettyBootstrap(org.teknux.jettybootstrap.JettyBootstrap) Test(org.junit.Test)

Example 8 with JettyBootstrap

use of org.teknux.jettybootstrap.JettyBootstrap in project jetty-bootstrap by teknux-org.

the class JettyBootstrapTest method do05StaticWarFromClasspathTest.

@Test
public void do05StaticWarFromClasspathTest() throws IllegalStateException, IOException, JettyBootstrapException, KeyManagementException, NoSuchAlgorithmException, KeyStoreException {
    JettyBootstrap jettyBootstrap = initServer(false);
    jettyBootstrap.addWarAppFromClasspath("/static.war", "/staticWarFromClasspath");
    jettyBootstrap.startServer();
    Assert.assertEquals(new SimpleResponse(200, "test1content\n"), get("/staticWarFromClasspath/test1.html"));
    Assert.assertEquals(new SimpleResponse(200, "test2content\n"), get("/staticWarFromClasspath/test2.html"));
    Assert.assertEquals(new Integer(404), get("/test3.html").getStatusCode());
}
Also used : JettyBootstrap(org.teknux.jettybootstrap.JettyBootstrap) Test(org.junit.Test)

Example 9 with JettyBootstrap

use of org.teknux.jettybootstrap.JettyBootstrap in project jetty-bootstrap by teknux-org.

the class JettyBootstrapTest method do10SslStaticResourceTest.

@Test
public void do10SslStaticResourceTest() throws IllegalStateException, IOException, JettyBootstrapException, KeyManagementException, NoSuchAlgorithmException, KeyStoreException, URISyntaxException {
    File folder = temporaryFolder.newFolder();
    copyResourceToFile("/webapp", folder);
    JettyBootstrap jettyBootstrap = initServer(true);
    jettyBootstrap.addExplodedWarApp(folder.getPath(), null, "/sslStaticResource");
    jettyBootstrap.startServer();
    Assert.assertEquals(new SimpleResponse(200, "StaticResContent\n"), get("/sslStaticResource/index.html"));
}
Also used : JettyBootstrap(org.teknux.jettybootstrap.JettyBootstrap) File(java.io.File) Test(org.junit.Test)

Example 10 with JettyBootstrap

use of org.teknux.jettybootstrap.JettyBootstrap in project jetty-bootstrap by teknux-org.

the class JettyBootstrapTest method do13ExplodedWarTest.

@Test
public void do13ExplodedWarTest() throws IllegalStateException, IOException, JettyBootstrapException, KeyManagementException, NoSuchAlgorithmException, KeyStoreException, URISyntaxException {
    File folder = temporaryFolder.newFolder();
    copyResourceToFile("/webapp", folder);
    JettyBootstrap jettyBootstrap = initServer(false);
    jettyBootstrap.addExplodedWarApp(folder.getPath(), null, "/explodedWar");
    jettyBootstrap.startServer();
    Assert.assertEquals(new SimpleResponse(200, "StaticResContent\n"), get("/explodedWar/index.html"));
}
Also used : JettyBootstrap(org.teknux.jettybootstrap.JettyBootstrap) File(java.io.File) Test(org.junit.Test)

Aggregations

JettyBootstrap (org.teknux.jettybootstrap.JettyBootstrap)24 Test (org.junit.Test)22 File (java.io.File)9 ServletContextHandler (org.eclipse.jetty.servlet.ServletContextHandler)2 ServletHolder (org.eclipse.jetty.servlet.ServletHolder)2 JettyConfiguration (org.teknux.jettybootstrap.configuration.JettyConfiguration)1