httplite: fix bug in which service registerations from multiple bundles would cause internal servlet map to be reset, resulting in all but last client registrations to be inaccessable.

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1189660 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/httplite/build.xml b/httplite/build.xml
index bfcede3..898ebed 100644
--- a/httplite/build.xml
+++ b/httplite/build.xml
@@ -2,7 +2,7 @@
 <project name="org.apache.felix.httplite" default="jar">
 	<property name="src.dir" location="${basedir}/src" />
 	<property name="project.description" value="Lightweight HTTP Service for Apache Felix" />
-	<property name="project.version" value="0.1.0" />
+	<property name="project.version" value="0.1.1" />
 	<property name="external.dir" location="external" />
 	<property name="doc.dir" location="${basedir}/docs" />
 	<property name="build.dir" location="${basedir}/classes" />
@@ -121,19 +121,19 @@
 			<attribute name="Bundle-Vendor" value="The Apache Software Foundation" />
 		</manifest>
 
-		<jar destfile="${dist.dir}/${ant.project.name}-debug-all-${project.version}.jar" manifest="${build.dir}/META-INF-ALL/MANIFEST.MF">
+		<jar destfile="${dist.dir}/${ant.project.name}.debug.all-${project.version}.jar" manifest="${build.dir}/META-INF-ALL/MANIFEST.MF">
 			<fileset dir="${build.dir}-debug" includes="**/*.class,**/*.properties,**/*.dtd,**/*.xsd" />
 			<fileset dir="${src.dir}/share" includes="javax/servlet/**/*.properties,javax/servlet/**/*.dtd,javax/servlet/**/*.xsd" />
 			<fileset dir="." includes="LICENSE-2.0.txt" />
 		</jar>
 
-		<jar destfile="${dist.dir}/${ant.project.name}-all-${project.version}.jar" manifest="${build.dir}/META-INF-ALL/MANIFEST.MF">
+		<jar destfile="${dist.dir}/${ant.project.name}.all-${project.version}.jar" manifest="${build.dir}/META-INF-ALL/MANIFEST.MF">
 			<fileset dir="${build.dir}" includes="**/*.class,**/*.properties,**/*.dtd,**/*.xsd" />
 			<fileset dir="${src.dir}/share" includes="javax/servlet/**/*.properties,javax/servlet/**/*.dtd,javax/servlet/**/*.xsd" />
 			<fileset dir="." includes="LICENSE-2.0.txt" />
 		</jar>
 
-		<jar destfile="${dist.dir}/${ant.project.name}-min-${project.version}.jar" manifest="${build.dir}/META-INF-MIN/MANIFEST.MF">
+		<jar destfile="${dist.dir}/${ant.project.name}.min-${project.version}.jar" manifest="${build.dir}/META-INF-MIN/MANIFEST.MF">
 			<fileset dir="${build.dir}" includes="org/apache/felix/httplite/**/*.class" />
 			<fileset dir="." includes="LICENSE-2.0.txt" />
 		</jar>
diff --git a/httplite/pom.xml b/httplite/pom.xml
index fe321b9..834de02 100644
--- a/httplite/pom.xml
+++ b/httplite/pom.xml
@@ -27,7 +27,7 @@
 	<packaging>bundle</packaging>
 	<name>Apache Felix Lightweight HTTP Server</name>
 	<description>A minimal HTTP Service implementation.</description>
-	<version>0.1.0-SNAPSHOT</version>
+	<version>0.1.1-SNAPSHOT</version>
 	<artifactId>org.apache.felix.httplite</artifactId>
 	<dependencies>
 		<dependency>
diff --git a/httplite/src/main/java/org/apache/felix/httplite/osgi/HttpServiceFactoryImpl.java b/httplite/src/main/java/org/apache/felix/httplite/osgi/HttpServiceFactoryImpl.java
index c478439..67880e1 100644
--- a/httplite/src/main/java/org/apache/felix/httplite/osgi/HttpServiceFactoryImpl.java
+++ b/httplite/src/main/java/org/apache/felix/httplite/osgi/HttpServiceFactoryImpl.java
@@ -20,6 +20,7 @@
 
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 
 import org.apache.felix.httplite.server.Server;
@@ -46,6 +47,10 @@
      * List of service registrations, both Resource and Servlet.
      */
     private List m_registrations;
+	/**
+	 * Map to store the servlet and resource registrations.
+	 */
+	private final HashMap m_servletMap;
 
     /**
      * @param logger
@@ -55,6 +60,7 @@
     {
         this.m_logger = logger;
         this.m_server = m_server;
+        this.m_servletMap = new HashMap();
     }
 
     /* (non-Javadoc)
@@ -65,7 +71,7 @@
         HttpServiceImpl httpService = null;
         try
         {
-            httpService = new HttpServiceImpl(bundle, m_server, m_logger);
+            httpService = new HttpServiceImpl(bundle, m_server, m_logger, m_servletMap);
 
             if (m_server.getState() != Server.ACTIVE_STATE)
             {
diff --git a/httplite/src/main/java/org/apache/felix/httplite/osgi/HttpServiceImpl.java b/httplite/src/main/java/org/apache/felix/httplite/osgi/HttpServiceImpl.java
index 9efdcfc..aa9ea66 100644
--- a/httplite/src/main/java/org/apache/felix/httplite/osgi/HttpServiceImpl.java
+++ b/httplite/src/main/java/org/apache/felix/httplite/osgi/HttpServiceImpl.java
@@ -22,7 +22,6 @@
 import java.io.OutputStream;
 import java.net.Socket;
 import java.util.Dictionary;
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
 
@@ -73,12 +72,12 @@
      *            instance of Logger
      * @throws IOException
      */
-    public HttpServiceImpl(final Bundle bundle, final Server server, final Logger logger) throws IOException
+    public HttpServiceImpl(final Bundle bundle, final Server server, final Logger logger, Map servletMap) throws IOException
     {
         this.m_bundle = bundle;
         this.m_logger = logger;
         this.m_server = server;
-        this.m_servletMap = new HashMap();
+        this.m_servletMap = servletMap;
     }
 
     /*
diff --git a/httplite/src/main/java/org/apache/felix/httplite/server/Connection.java b/httplite/src/main/java/org/apache/felix/httplite/server/Connection.java
index 622e255..a5ed792 100644
--- a/httplite/src/main/java/org/apache/felix/httplite/server/Connection.java
+++ b/httplite/src/main/java/org/apache/felix/httplite/server/Connection.java
@@ -25,7 +25,6 @@
 import java.net.Socket;
 
 import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
 
 import org.apache.felix.httplite.osgi.Logger;
 import org.apache.felix.httplite.osgi.ServiceRegistrationHandler;
@@ -75,7 +74,7 @@
      * @param socket The client socket.
      * @param timeout The inactivity timeout of the connection in milliseconds.
      * @param requestLimit The maximum number of consecutive requests.
-     * @param m_resolver 
+     * @param resolver resolves a request URI to a client or servlet registration via the HTTP Service.
      * @throws java.io.IOException If any I/O error occurs.
      */
     public Connection(final Socket socket, final int timeout, final int requestLimit, final ServiceRegistrationResolver resolver, final Logger logger) throws IOException