Mercurial > dive4elements > framework
diff artifact-database/src/main/java/de/intevation/artifactdatabase/rest/Standalone.java @ 44:86d2a843e588
Allow REST server to bind to configurable interface.
artifacts/trunk@151 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 29 Sep 2009 10:25:53 +0000 |
parents | d5dc2900392f |
children | f2648672c9c4 |
line wrap: on
line diff
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/rest/Standalone.java Thu Sep 24 09:15:56 2009 +0000 +++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/rest/Standalone.java Tue Sep 29 10:25:53 2009 +0000 @@ -22,10 +22,14 @@ public static final String REST_PORT = "/artifact-database/rest-server/port/text()"; + public static final String LISTEN_INTERFACE = + "/artifact-database/rest-server/listen/text()"; + public static final int DEFAULT_PORT = 8181; public static void startAsServer(ArtifactDatabase db) { - String portString = Config.getStringXPath(REST_PORT); + String portString = Config.getStringXPath(REST_PORT); + String listenString = Config.getStringXPath(LISTEN_INTERFACE); int port = DEFAULT_PORT; @@ -46,7 +50,12 @@ Component component = new Component(); - component.getServers().add(Protocol.HTTP, port); + if (listenString != null) { + component.getServers().add(Protocol.HTTP, listenString, port); + } + else { + component.getServers().add(Protocol.HTTP, port); + } component.getDefaultHost().attach(app);