changeset 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 (2009-09-29)
parents b8516aa3d8a1
children 9449f296cd54
files Changelog artifact-database/doc/example-conf/conf.xml artifact-database/pom.xml artifact-database/src/main/java/de/intevation/artifactdatabase/rest/Standalone.java artifacts/pom.xml pom.xml
diffstat 6 files changed, 39 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/Changelog	Thu Sep 24 09:15:56 2009 +0000
+++ b/Changelog	Tue Sep 29 10:25:53 2009 +0000
@@ -1,3 +1,15 @@
+2009-09-29	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* pom.xml, artifacts/pom.xml, artifact-database/pom.xml: 
+	Set source encoding to UTF-8.
+
+	* artifact-database/src/main/java/de/intevation/artifactdatabase/rest/Standalone.java:
+	If '/artifact-database/rest-server/listen/text()' is given in conf.xml
+	the value is used to bind REST server to that interface.
+
+	* artifact-database/doc/example-conf/conf.xml: Added 'listen' to
+	demo configuration.
+
 2009-09-24	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* artifact-database/src/main/resources/sql/org-h2-driver.properties:
--- a/artifact-database/doc/example-conf/conf.xml	Thu Sep 24 09:15:56 2009 +0000
+++ b/artifact-database/doc/example-conf/conf.xml	Tue Sep 29 10:25:53 2009 +0000
@@ -17,6 +17,7 @@
     <!-- configuration of the rest server -->
     <rest-server>
         <port>8181</port>
+        <listen>localhost</listen>
     </rest-server>
     <!-- garbage collection of outdated artifacts -->
     <cleaner>
--- a/artifact-database/pom.xml	Thu Sep 24 09:15:56 2009 +0000
+++ b/artifact-database/pom.xml	Tue Sep 29 10:25:53 2009 +0000
@@ -5,6 +5,9 @@
     <groupId>de.intevation.bsh</groupId>
     <version>1.0-SNAPSHOT</version>
   </parent>
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
   <modelVersion>4.0.0</modelVersion>
   <groupId>de.intevation.bsh.artifact-database</groupId>
   <artifactId>artifact-database</artifactId>
--- 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);
 
--- a/artifacts/pom.xml	Thu Sep 24 09:15:56 2009 +0000
+++ b/artifacts/pom.xml	Tue Sep 29 10:25:53 2009 +0000
@@ -1,5 +1,5 @@
-<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">
+<?xml version="1.0"?>
+<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">
   <modelVersion>4.0.0</modelVersion>
   <groupId>de.intevation.bsh.artifacts</groupId>
   <artifactId>artifacts</artifactId>
@@ -7,6 +7,9 @@
   <version>1.0-SNAPSHOT</version>
   <name>artifacts</name>
   <url>http://maven.apache.org</url>
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
   <dependencies>
   </dependencies>
 </project>
--- a/pom.xml	Thu Sep 24 09:15:56 2009 +0000
+++ b/pom.xml	Tue Sep 29 10:25:53 2009 +0000
@@ -7,6 +7,9 @@
   <version>1.0-SNAPSHOT</version>
   <name>artifact-system</name>
   <url>http://maven.apache.org</url>
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
   <build>
     <plugins>
       <plugin>
@@ -26,10 +29,10 @@
     </plugins>
   </build>
   <repositories>
-    <repository>  
-        <id>maven-restlet</id>  
-        <name>Public online Restlet repository</name>  
-        <url>http://maven.restlet.org</url>  
+    <repository>
+      <id>maven-restlet</id>
+      <name>Public online Restlet repository</name>
+      <url>http://maven.restlet.org</url>
     </repository>
   </repositories>
   <modules>

http://dive4elements.wald.intevation.org