Skip to content

Commit

Permalink
servers - renamed JettyWebServer to Jetty7WebServer, same for module …
Browse files Browse the repository at this point in the history
…and properties
  • Loading branch information
fcamblor committed Sep 9, 2017
1 parent 8f58414 commit 95ed631
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 43 deletions.
@@ -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 Jetty7ServerModule {
@Provides
@Named("restx.server.jetty7.webxml.default.location")
public String restxServerJettyWebXmlDefaultLocation(@Named("restx.server.jetty7.appbase.default.location") String appBase) {
return appBase+"/WEB-INF/web.xml";
}


@Provides
@Named("restx.server.jetty7.appbase.default.location")
public String restxServerJettyAppBaseDefaultLocation() {
return "src/main/webapp";
}

@Provides
@Named("restx.server.jetty7")
public WebServerSupplier jettyWebServerSupplier(
@Named("restx.server.jetty7.appbase.default.location") String appBase,
@Named("restx.server.jetty7.webxml.default.location") String webxml){
return Jetty7WebServer.jettyWebServerSupplier(webxml, appBase);
}
}
Expand Up @@ -19,17 +19,17 @@
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static restx.common.MoreFiles.checkFileExists; import static restx.common.MoreFiles.checkFileExists;


public class JettyWebServer extends WebServerBase { public class Jetty7WebServer extends WebServerBase {
private static final Logger logger = LoggerFactory.getLogger(JettyWebServer.class); private static final Logger logger = LoggerFactory.getLogger(Jetty7WebServer.class);


private Server server; private Server server;
private String webInfLocation; private String webInfLocation;


public JettyWebServer(String appBase, int aPort) { public Jetty7WebServer(String appBase, int aPort) {
this(null, appBase, aPort, null); this(null, appBase, aPort, null);
} }


public JettyWebServer(String webInfLocation, String appBase, int port, String bindInterface) { public Jetty7WebServer(String webInfLocation, String appBase, int port, String bindInterface) {
super(checkNotNull(appBase), port, bindInterface, "Jetty7", "org.eclipse.jetty", "jetty-server"); super(checkNotNull(appBase), port, bindInterface, "Jetty7", "org.eclipse.jetty", "jetty-server");


if (webInfLocation != null) { if (webInfLocation != null) {
Expand Down Expand Up @@ -115,7 +115,7 @@ public static WebServerSupplier jettyWebServerSupplier(final String webInfLocati
return new WebServerSupplier() { return new WebServerSupplier() {
@Override @Override
public WebServer newWebServer(int port) { public WebServer newWebServer(int port) {
return new JettyWebServer(webInfLocation, appBase, port, "0.0.0.0"); return new Jetty7WebServer(webInfLocation, appBase, port, "0.0.0.0");
} }
}; };
} }
Expand All @@ -128,6 +128,6 @@ public static void main(String[] args) throws Exception {


String appBase = args[0]; String appBase = args[0];
int port = args.length > 1 ? Integer.parseInt(args[1]) : 8086; 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 Jetty7WebServer(appBase + "WEB-INF/web.xml", appBase, port, "0.0.0.0").startAndAwait();
} }
} }

This file was deleted.

Expand Up @@ -5,7 +5,6 @@
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import restx.*; import restx.*;
import restx.entity.MatchedEntityOutputRoute; import restx.entity.MatchedEntityOutputRoute;
import restx.entity.MatchedEntityRoute;
import restx.servlet.AbstractRestxMainRouterServlet; import restx.servlet.AbstractRestxMainRouterServlet;


import java.io.IOException; import java.io.IOException;
Expand Down Expand Up @@ -46,7 +45,7 @@ public Optional<?> route(RestxRequest restxRequest, RestxRequestMatch match) thr




public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
WebServer webServer = new JettyWebServer( WebServer webServer = new Jetty7WebServer(
"src/test/resources/restx/server/WebServerExample-web.xml", "src/test/resources/restx/server/WebServerExample-web.xml",
".", 8080, "localhost"); ".", 8080, "localhost");
webServer.startAndAwait(); webServer.startAndAwait();
Expand Down
1 change: 1 addition & 0 deletions restx-server-testing/md.restx.json
Expand Up @@ -10,6 +10,7 @@
"compile": [ "compile": [
], ],
"test": [ "test": [
"io.restx:restx-server-jetty7:${restx.version}",
"io.restx:restx-server-jetty8:${restx.version}", "io.restx:restx-server-jetty8:${restx.version}",
"io.restx:restx-server-simple:${restx.version}", "io.restx:restx-server-simple:${restx.version}",
"io.restx:restx-server-tomcat:${restx.version}", "io.restx:restx-server-tomcat:${restx.version}",
Expand Down
1 change: 1 addition & 0 deletions restx-server-testing/module.ivy
Expand Up @@ -14,6 +14,7 @@
<artifact type="jar"/> <artifact type="jar"/>
</publications> </publications>
<dependencies> <dependencies>
<dependency org="io.restx" name="restx-server-jetty7" rev="latest.integration" conf="test->default" />
<dependency org="io.restx" name="restx-server-jetty8" rev="latest.integration" conf="test->default" /> <dependency org="io.restx" name="restx-server-jetty8" rev="latest.integration" conf="test->default" />
<dependency org="io.restx" name="restx-server-simple" rev="latest.integration" conf="test->default" /> <dependency org="io.restx" name="restx-server-simple" rev="latest.integration" conf="test->default" />
<dependency org="io.restx" name="restx-server-tomcat" rev="latest.integration" conf="test->default" /> <dependency org="io.restx" name="restx-server-tomcat" rev="latest.integration" conf="test->default" />
Expand Down
5 changes: 5 additions & 0 deletions restx-server-testing/pom.xml
Expand Up @@ -14,6 +14,11 @@
<name>restx-server-testing</name> <name>restx-server-testing</name>


<dependencies> <dependencies>
<dependency>
<groupId>io.restx</groupId>
<artifactId>restx-server-jetty7</artifactId>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>io.restx</groupId> <groupId>io.restx</groupId>
<artifactId>restx-server-jetty8</artifactId> <artifactId>restx-server-jetty8</artifactId>
Expand Down

0 comments on commit 95ed631

Please sign in to comment.