Permalink
Browse files

[breaking] servers - renamed JettyWebServer Jetty8WebServer, same for…

… module and properties + added SessionsTest for jetty 8
  • Loading branch information...
fcamblor committed Sep 7, 2017
1 parent 95ed631 commit 8475ee5d05f8efb8e30ea77d5adb3c6dd33bd80b
@@ -2,7 +2,7 @@
import com.google.common.base.Optional;
import restx.server.WebServer;
import restx.server.JettyWebServer;
import restx.server.Jetty8WebServer;
/**
* This class can be used to run the app.
@@ -17,7 +17,7 @@
public static void main(String[] args) throws Exception {
int port = Integer.valueOf(Optional.fromNullable(System.getenv("PORT")).or("{{defaultPort}}"));
WebServer server = new JettyWebServer(WEB_INF_LOCATION, WEB_APP_LOCATION, port, "0.0.0.0");
WebServer server = new Jetty8WebServer(WEB_INF_LOCATION, WEB_APP_LOCATION, port, "0.0.0.0");
/*
* load mode from system property if defined, or default to dev
@@ -1,7 +1,7 @@
package samplest;
import com.google.common.base.Optional;
import restx.server.JettyWebServer;
import restx.server.Jetty8WebServer;
import restx.server.WebServer;
//import restx.server.simple.simple.SimpleWebServer;
@@ -15,7 +15,7 @@
public static void main(String[] args) throws Exception {
int port = Integer.valueOf(Optional.fromNullable(System.getenv("PORT")).or("8080"));
WebServer server = new JettyWebServer(WEB_INF_LOCATION, WEB_APP_LOCATION, port, "0.0.0.0");
WebServer server = new Jetty8WebServer(WEB_INF_LOCATION, WEB_APP_LOCATION, port, "0.0.0.0");
/*
* load mode from system property if defined, or default to dev
@@ -0,0 +1,33 @@
package restx.server;
import restx.factory.Module;
import restx.factory.Provides;
import javax.inject.Named;
/**
* @author fcamblor
*/
@Module(priority = 1000)
public class Jetty8ServerModule {
@Provides
@Named("restx.server.jetty8.webxml.default.location")
public String restxServerJettyWebXmlDefaultLocation(@Named("restx.server.jetty8.appbase.default.location") String appBase) {
return appBase+"/WEB-INF/web.xml";
}
@Provides
@Named("restx.server.jetty8.appbase.default.location")
public String restxServerJettyAppBaseDefaultLocation() {
return "src/main/webapp";
}
@Provides
@Named("restx.server.jetty8")
public WebServerSupplier jettyWebServerSupplier(
@Named("restx.server.jetty8.appbase.default.location") String appBase,
@Named("restx.server.jetty8.webxml.default.location") String webxml){
return Jetty8WebServer.jettyWebServerSupplier(webxml, appBase);
}
}
@@ -19,17 +19,17 @@
import static com.google.common.base.Preconditions.checkNotNull;
import static restx.common.MoreFiles.checkFileExists;
public class JettyWebServer extends WebServerBase {
private static final Logger logger = LoggerFactory.getLogger(JettyWebServer.class);
public class Jetty8WebServer extends WebServerBase {
private static final Logger logger = LoggerFactory.getLogger(Jetty8WebServer.class);
private Server server;
private String webInfLocation;
public JettyWebServer(String appBase, int aPort) {
public Jetty8WebServer(String appBase, int aPort) {
this(null, appBase, aPort, null);
}
public JettyWebServer(String webInfLocation, String appBase, int port, String bindInterface) {
public Jetty8WebServer(String webInfLocation, String appBase, int port, String bindInterface) {
super(checkNotNull(appBase), port, bindInterface, "Jetty8", "org.eclipse.jetty", "jetty-server");
if (webInfLocation != null) {
@@ -115,7 +115,7 @@ public static WebServerSupplier jettyWebServerSupplier(final String webInfLocati
return new WebServerSupplier() {
@Override
public WebServer newWebServer(int port) {
return new JettyWebServer(webInfLocation, appBase, port, "0.0.0.0");
return new Jetty8WebServer(webInfLocation, appBase, port, "0.0.0.0");
}
};
}
@@ -128,6 +128,6 @@ public static void main(String[] args) throws Exception {
String appBase = args[0];
int port = args.length > 1 ? Integer.parseInt(args[1]) : 8086;
new JettyWebServer(appBase + "WEB-INF/web.xml", appBase, port, "0.0.0.0").startAndAwait();
new Jetty8WebServer(appBase + "WEB-INF/web.xml", appBase, port, "0.0.0.0").startAndAwait();
}
}

This file was deleted.

Oops, something went wrong.
@@ -5,7 +5,6 @@
import com.google.common.collect.ImmutableMap;
import restx.*;
import restx.entity.MatchedEntityOutputRoute;
import restx.entity.MatchedEntityRoute;
import restx.servlet.AbstractRestxMainRouterServlet;
import java.io.IOException;
@@ -46,7 +45,7 @@ public Optional route(RestxRequest restxRequest, RestxRequestMatch match) {
public static void main(String[] args) throws Exception {
WebServer webServer = new JettyWebServer(
WebServer webServer = new Jetty8WebServer(
"src/test/resources/restx/server/WebServerExample-web.xml",
".", 8080, "localhost");
webServer.startAndAwait();
@@ -8,7 +8,7 @@
import java.io.IOException;
import static restx.server.JettyWebServer.jettyWebServerSupplier;
import static restx.server.Jetty8WebServer.jettyWebServerSupplier;
/**
* @author fcamblor

0 comments on commit 8475ee5

Please sign in to comment.