mirror of
https://github.com/jetty/jetty.project.git
synced 2025-03-03 04:19:12 +00:00
Moved async rest server to own module
Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
parent
fc230ba7c6
commit
0962fdb4e6
19
examples/async-rest/async-rest-server/pom.xml
Normal file
19
examples/async-rest/async-rest-server/pom.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>example-async-rest</artifactId>
|
||||
<version>10.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.eclipse.jetty.example-async-rest</groupId>
|
||||
<artifactId>example-async-rest-server</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>Example Async Rest :: Server</name>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-webapp</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -22,22 +22,32 @@ import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.webapp.ClassMatcher;
|
||||
import org.eclipse.jetty.webapp.WebAppContext;
|
||||
|
||||
public class DemoServer
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
public class AsyncRestServer
|
||||
{
|
||||
public static void main(String[] args)
|
||||
throws Exception
|
||||
{
|
||||
String jetty_home = System.getProperty("jetty.home",".");
|
||||
// Find the async-reset webapp based on common IDE working directories
|
||||
// TODO import webapp as maven artifact
|
||||
Path home = FileSystems.getDefault().getPath(System.getProperty("jetty.home",".")).toAbsolutePath();
|
||||
Path war = home.resolve("../async-rest-webapp/target/async-rest/");
|
||||
if (!Files.exists(war))
|
||||
war = home.resolve("examples/async-rest/async-rest-webapp/target/async-rest/");
|
||||
if (!Files.exists(war))
|
||||
throw new IllegalArgumentException("Cannot find async-rest webapp");
|
||||
|
||||
// Build a demo server
|
||||
Server server = new Server(Integer.getInteger("jetty.http.port",8080).intValue());
|
||||
|
||||
WebAppContext webapp = new WebAppContext();
|
||||
webapp.setContextPath("/");
|
||||
webapp.setWar(jetty_home+"/target/async-rest/");
|
||||
webapp.setParentLoaderPriority(true);
|
||||
webapp.setServerClassMatcher(new ClassMatcher());
|
||||
webapp.setWar(war.toAbsolutePath().toString());
|
||||
server.setHandler(webapp);
|
||||
|
||||
|
||||
server.start();
|
||||
server.join();
|
||||
}
|
@ -19,15 +19,9 @@
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-webapp</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
@ -13,5 +13,6 @@
|
||||
<modules>
|
||||
<module>async-rest-jar</module>
|
||||
<module>async-rest-webapp</module>
|
||||
<module>async-rest-server</module>
|
||||
</modules>
|
||||
</project>
|
||||
|
@ -50,8 +50,12 @@ public class OneWebApp
|
||||
// PlusConfiguration) to choosing where the webapp will unpack itself.
|
||||
WebAppContext webapp = new WebAppContext();
|
||||
webapp.setContextPath("/");
|
||||
File warFile = new File(
|
||||
"../../tests/test-jmx/jmx-webapp/target/jmx-webapp");
|
||||
File warFile = new File("../../tests/test-jmx/jmx-webapp/target/jmx-webapp");
|
||||
if (!warFile.exists())
|
||||
warFile = new File("tests/test-jmx/jmx-webapp/target/jmx-webapp");
|
||||
if (!warFile.exists())
|
||||
throw new IllegalArgumentException();
|
||||
|
||||
webapp.setWar(warFile.getAbsolutePath());
|
||||
|
||||
// A WebAppContext is a ContextHandler as well so it needs to be set to
|
||||
|
2
tests/test-jmx/jmx-webapp/src/main/webapp/index.html
Normal file
2
tests/test-jmx/jmx-webapp/src/main/webapp/index.html
Normal file
@ -0,0 +1,2 @@
|
||||
<h1>JMX Test Webapp</h1>
|
||||
<a href="ping">ping</a>
|
Loading…
x
Reference in New Issue
Block a user