Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2014-09-17 19:05:45 +0000
committerThomas Watson2014-10-21 20:53:17 +0000
commitabe332ed0e44057e10a1420db362b6eb4180aaa2 (patch)
treee8a75fd20ff940c89119c3dad4e87c00f35dee32
parent38ccd9f806fec0b030e60eb774601576299b9899 (diff)
downloadrt.equinox.framework-abe332ed0e44057e10a1420db362b6eb4180aaa2.tar.gz
rt.equinox.framework-abe332ed0e44057e10a1420db362b6eb4180aaa2.tar.xz
rt.equinox.framework-abe332ed0e44057e10a1420db362b6eb4180aaa2.zip
Bug 436698 - Add new OSGi R6 http API
-rw-r--r--bundles/org.eclipse.osgi.services/.settings/.api_filters147
-rw-r--r--bundles/org.eclipse.osgi.services/META-INF/MANIFEST.MF13
-rw-r--r--bundles/org.eclipse.osgi.services/pom.xml2
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/http/HttpContext.java74
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/http/HttpService.java8
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/http/NamespaceException.java2
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/http/context/ServletContextHelper.java304
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/http/context/ServletContextHelperContext.java38
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/http/context/package-info.java42
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/http/context/packageinfo1
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/http/package-info.java12
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/http/packageinfo2
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/HttpServiceRuntime.java55
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/HttpServiceRuntimeConstants.java50
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/BaseServletDTO.java68
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/DTOConstants.java72
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/ErrorPageDTO.java38
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/FailedErrorPageDTO.java44
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/FailedFilterDTO.java44
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/FailedListenerDTO.java44
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/FailedResourceDTO.java44
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/FailedServletContextDTO.java52
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/FailedServletDTO.java43
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/FilterDTO.java97
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/ListenerDTO.java48
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/RequestInfoDTO.java60
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/ResourceDTO.java56
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/RuntimeDTO.java83
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/ServletContextDTO.java132
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/ServletDTO.java36
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/package-info.java42
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/packageinfo1
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/package-info.java42
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/packageinfo1
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/http/whiteboard/HttpWhiteboardConstants.java374
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/http/whiteboard/package-info.java42
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/http/whiteboard/packageinfo1
37 files changed, 2173 insertions, 41 deletions
diff --git a/bundles/org.eclipse.osgi.services/.settings/.api_filters b/bundles/org.eclipse.osgi.services/.settings/.api_filters
index 0089e5c19..8501d69d2 100644
--- a/bundles/org.eclipse.osgi.services/.settings/.api_filters
+++ b/bundles/org.eclipse.osgi.services/.settings/.api_filters
@@ -40,4 +40,151 @@
</message_arguments>
</filter>
</resource>
+ <resource path="src/org/osgi/service/http/context/ServletContextHelper.java" type="org.osgi.service.http.context.ServletContextHelper">
+ <filter comment="Ignore OSGi API" id="1110441988">
+ <message_arguments>
+ <message_argument value="org.osgi.service.http.context.ServletContextHelper"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/osgi/service/http/context/ServletContextHelperContext.java" type="org.osgi.service.http.context.ServletContextHelperContext">
+ <filter comment="Ignore OSGi API" id="1110441988">
+ <message_arguments>
+ <message_argument value="org.osgi.service.http.context.ServletContextHelperContext"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/osgi/service/http/runtime/HttpServiceRuntime.java" type="org.osgi.service.http.runtime.HttpServiceRuntime">
+ <filter comment="Ignore OSGi API" id="1110441988">
+ <message_arguments>
+ <message_argument value="org.osgi.service.http.runtime.HttpServiceRuntime"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/osgi/service/http/runtime/HttpServiceRuntimeConstants.java" type="org.osgi.service.http.runtime.HttpServiceRuntimeConstants">
+ <filter comment="Ignore OSGi API" id="1110441988">
+ <message_arguments>
+ <message_argument value="org.osgi.service.http.runtime.HttpServiceRuntimeConstants"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/osgi/service/http/runtime/dto/BaseServletDTO.java" type="org.osgi.service.http.runtime.dto.BaseServletDTO">
+ <filter comment="Ignore OSGi API" id="1110441988">
+ <message_arguments>
+ <message_argument value="org.osgi.service.http.runtime.dto.BaseServletDTO"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/osgi/service/http/runtime/dto/DTOConstants.java" type="org.osgi.service.http.runtime.dto.DTOConstants">
+ <filter comment="Ignore OSGi API" id="1110441988">
+ <message_arguments>
+ <message_argument value="org.osgi.service.http.runtime.dto.DTOConstants"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/osgi/service/http/runtime/dto/ErrorPageDTO.java" type="org.osgi.service.http.runtime.dto.ErrorPageDTO">
+ <filter comment="Ignore OSGi API" id="1110441988">
+ <message_arguments>
+ <message_argument value="org.osgi.service.http.runtime.dto.ErrorPageDTO"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/osgi/service/http/runtime/dto/FailedErrorPageDTO.java" type="org.osgi.service.http.runtime.dto.FailedErrorPageDTO">
+ <filter comment="Ignore OSGi API" id="1110441988">
+ <message_arguments>
+ <message_argument value="org.osgi.service.http.runtime.dto.FailedErrorPageDTO"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/osgi/service/http/runtime/dto/FailedFilterDTO.java" type="org.osgi.service.http.runtime.dto.FailedFilterDTO">
+ <filter comment="Ignore OSGi API" id="1110441988">
+ <message_arguments>
+ <message_argument value="org.osgi.service.http.runtime.dto.FailedFilterDTO"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/osgi/service/http/runtime/dto/FailedListenerDTO.java" type="org.osgi.service.http.runtime.dto.FailedListenerDTO">
+ <filter comment="Ignore OSGi API" id="1110441988">
+ <message_arguments>
+ <message_argument value="org.osgi.service.http.runtime.dto.FailedListenerDTO"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/osgi/service/http/runtime/dto/FailedResourceDTO.java" type="org.osgi.service.http.runtime.dto.FailedResourceDTO">
+ <filter comment="Ignore OSGi API" id="1110441988">
+ <message_arguments>
+ <message_argument value="org.osgi.service.http.runtime.dto.FailedResourceDTO"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/osgi/service/http/runtime/dto/FailedServletContextDTO.java" type="org.osgi.service.http.runtime.dto.FailedServletContextDTO">
+ <filter comment="Ignore OSGi API" id="1110441988">
+ <message_arguments>
+ <message_argument value="org.osgi.service.http.runtime.dto.FailedServletContextDTO"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/osgi/service/http/runtime/dto/FailedServletDTO.java" type="org.osgi.service.http.runtime.dto.FailedServletDTO">
+ <filter comment="Ignore OSGi API" id="1110441988">
+ <message_arguments>
+ <message_argument value="org.osgi.service.http.runtime.dto.FailedServletDTO"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/osgi/service/http/runtime/dto/FilterDTO.java" type="org.osgi.service.http.runtime.dto.FilterDTO">
+ <filter comment="Ignore OSGi API" id="1110441988">
+ <message_arguments>
+ <message_argument value="org.osgi.service.http.runtime.dto.FilterDTO"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/osgi/service/http/runtime/dto/ListenerDTO.java" type="org.osgi.service.http.runtime.dto.ListenerDTO">
+ <filter comment="Ignore OSGi API" id="1110441988">
+ <message_arguments>
+ <message_argument value="org.osgi.service.http.runtime.dto.ListenerDTO"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/osgi/service/http/runtime/dto/RequestInfoDTO.java" type="org.osgi.service.http.runtime.dto.RequestInfoDTO">
+ <filter comment="Ignore OSGi API" id="1110441988">
+ <message_arguments>
+ <message_argument value="org.osgi.service.http.runtime.dto.RequestInfoDTO"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/osgi/service/http/runtime/dto/ResourceDTO.java" type="org.osgi.service.http.runtime.dto.ResourceDTO">
+ <filter comment="Ignore OSGi API" id="1110441988">
+ <message_arguments>
+ <message_argument value="org.osgi.service.http.runtime.dto.ResourceDTO"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/osgi/service/http/runtime/dto/RuntimeDTO.java" type="org.osgi.service.http.runtime.dto.RuntimeDTO">
+ <filter comment="Ignore OSGi API" id="1110441988">
+ <message_arguments>
+ <message_argument value="org.osgi.service.http.runtime.dto.RuntimeDTO"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/osgi/service/http/runtime/dto/ServletContextDTO.java" type="org.osgi.service.http.runtime.dto.ServletContextDTO">
+ <filter comment="Ignore OSGi API" id="1110441988">
+ <message_arguments>
+ <message_argument value="org.osgi.service.http.runtime.dto.ServletContextDTO"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/osgi/service/http/runtime/dto/ServletDTO.java" type="org.osgi.service.http.runtime.dto.ServletDTO">
+ <filter comment="Ignore OSGi API" id="1110441988">
+ <message_arguments>
+ <message_argument value="org.osgi.service.http.runtime.dto.ServletDTO"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/osgi/service/http/whiteboard/HttpWhiteboardConstants.java" type="org.osgi.service.http.whiteboard.HttpWhiteboardConstants">
+ <filter comment="Ignore OSGi API" id="1110441988">
+ <message_arguments>
+ <message_argument value="org.osgi.service.http.whiteboard.HttpWhiteboardConstants"/>
+ </message_arguments>
+ </filter>
+ </resource>
</component>
diff --git a/bundles/org.eclipse.osgi.services/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi.services/META-INF/MANIFEST.MF
index fcd6ae66f..e0b881688 100644
--- a/bundles/org.eclipse.osgi.services/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.osgi.services/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %osgiServices
Bundle-SymbolicName: org.eclipse.osgi.services
-Bundle-Version: 3.4.0.qualifier
+Bundle-Version: 3.5.0.qualifier
Bundle-Description: %osgiServicesDes
Bundle-Localization: plugin
Bundle-Vendor: %eclipse.org
@@ -13,20 +13,25 @@ Export-Package: org.osgi.service.cm; version="1.5",
org.osgi.service.component.annotations; version="1.2",
org.osgi.service.device; version="1.1",
org.osgi.service.event; version="1.3",
- org.osgi.service.http; version="1.2.1",
+ org.osgi.service.http;version="1.2.2",
+ org.osgi.service.http.context;version="1.0",
+ org.osgi.service.http.runtime;version="1.0",
+ org.osgi.service.http.runtime.dto;version="1.0",
+ org.osgi.service.http.whiteboard;version="1.0",
org.osgi.service.log; version="1.3",
org.osgi.service.metatype; version="1.2",
org.osgi.service.provisioning; version="1.2",
org.osgi.service.upnp; version="1.2",
org.osgi.service.useradmin; version="1.1",
org.osgi.service.wireadmin; version="1.0.1"
-Import-Package: org.osgi.framework; version=1.6,
+Import-Package: org.osgi.dto; version=1.0,
+ org.osgi.framework; version=1.6,
org.osgi.service.cm; version="[1.5, 1.6)",
org.osgi.service.component; version="[1.2.2, 1.3)",
org.osgi.service.component.annotations; version="[1.2, 1.3)",
org.osgi.service.device; version="[1.1, 1.2)",
org.osgi.service.event; version="[1.3, 1.4)",
- org.osgi.service.http; version="[1.2.1, 1.3)",
+ org.osgi.service.http; version="[1.2.2, 1.3)",
org.osgi.service.log; version="[1.3, 1.4)",
org.osgi.service.metatype; version="[1.2, 1.3)",
org.osgi.service.provisioning; version="[1.2, 1.3)",
diff --git a/bundles/org.eclipse.osgi.services/pom.xml b/bundles/org.eclipse.osgi.services/pom.xml
index 0ca6e436e..3e111e407 100644
--- a/bundles/org.eclipse.osgi.services/pom.xml
+++ b/bundles/org.eclipse.osgi.services/pom.xml
@@ -19,7 +19,7 @@
</parent>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi.services</artifactId>
- <version>3.4.0-SNAPSHOT</version>
+ <version>3.5.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<build>
<plugins>
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/HttpContext.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/HttpContext.java
index d8c0c4b76..acf728222 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/HttpContext.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/HttpContext.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2014). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,22 +20,43 @@ import java.io.IOException;
import java.net.URL;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.osgi.annotation.versioning.ConsumerType;
/**
- * This interface defines methods that the Http Service may call to get
- * information about a registration.
+ * Context for HTTP Requests.
*
* <p>
- * Servlets and resources may be registered with an {@code HttpContext} object;
- * if no {@code HttpContext} object is specified, a default {@code HttpContext}
- * object is used. Servlets that are registered using the same
- * {@code HttpContext} object will share the same {@code ServletContext} object.
+ * This service defines methods that the Http Service may call to get
+ * information for a request.
*
* <p>
- * This interface is implemented by users of the {@code HttpService}.
+ * Servlets may be associated with an {@code HttpContext} service. Servlets that
+ * are associated using the same {@code HttpContext} object will share the same
+ * {@code ServletContext} object.
*
+ * <p>
+ * If no {@code HttpContext} service is associated, a default
+ * {@code HttpContext} is used. The behavior of the methods on the default
+ * {@code HttpContext} is defined as follows:
+ * <ul>
+ * <li>{@code getMimeType} - Does not define any customized MIME types for the
+ * {@code Content-Type} header in the response, and always returns {@code null}.
+ * </li>
+ * <li>{@code handleSecurity} - Performs implementation-defined authentication
+ * on the request.</li>
+ * <li>{@code getResource} - Assumes the named resource is in the bundle of the
+ * servlet service. This method calls the servlet bundle's
+ * {@code Bundle.getResource} method, and returns the appropriate URL to access
+ * the resource. On a Java runtime environment that supports permissions, the
+ * Http Service needs to be granted
+ * {@code org.osgi.framework.AdminPermission[*,RESOURCE]}.</li>
+ * </ul>
+ *
+ *
+ * @ThreadSafe
* @author $Id$
*/
+@ConsumerType
public interface HttpContext {
/**
* {@code HttpServletRequest} attribute specifying the name of the
@@ -114,8 +135,8 @@ public interface HttpContext {
* {@code getAuthType} and {@code getRemoteUser} methods, respectively, on
* the request.
*
- * @param request the HTTP request
- * @param response the HTTP response
+ * @param request The HTTP request.
+ * @param response The HTTP response.
* @return {@code true} if the request should be serviced, {@code false} if
* the request should not be serviced and Http Service will send the
* response back to the client.
@@ -130,33 +151,34 @@ public interface HttpContext {
* <p>
* Called by the Http Service to map a resource name to a URL. For servlet
* registrations, Http Service will call this method to support the
- * {@code ServletContext} methods {@code getResource} and
- * {@code getResourceAsStream}. For resource registrations, Http Service
- * will call this method to locate the named resource. The context can
- * control from where resources come. For example, the resource can be
+ * <code>ServletContext</code> methods <code>getResource</code> and
+ * <code>getResourceAsStream</code>. For resource registrations, Http
+ * Service will call this method to locate the named resource. The context
+ * can control from where resources come. For example, the resource can be
* mapped to a file in the bundle's persistent storage area via
- * {@code bundleContext.getDataFile(name).toURL()} or to a resource in the
- * context's bundle via {@code getClass().getResource(name)}
+ * <code>bundleContext.getDataFile(name).toURL()</code> or to a resource in
+ * the context's bundle via <code>getClass().getResource(name)</code>
*
* @param name the name of the requested resource
* @return URL that Http Service can use to read the resource or
- * {@code null} if the resource does not exist.
+ * <code>null</code> if the resource does not exist.
*/
public URL getResource(String name);
/**
* Maps a name to a MIME type.
*
- * Called by the Http Service to determine the MIME type for the name. For
- * servlet registrations, the Http Service will call this method to support
- * the {@code ServletContext} method {@code getMimeType}. For resource
- * registrations, the Http Service will call this method to determine the
- * MIME type for the Content-Type header in the response.
+ * <p>
+ * Called by the Http Service to determine the MIME type for the specified
+ * name. For servlets, the Http Service will call this method to support the
+ * {@code ServletContext} method {@code getMimeType}. For resources, the
+ * Http Service will call this method to determine the MIME type for the
+ * {@code Content-Type} header in the response.
*
- * @param name determine the MIME type for this name.
- * @return MIME type (e.g. text/html) of the name or {@code null} to
- * indicate that the Http Service should determine the MIME type
- * itself.
+ * @param name The name for which to determine the MIME type.
+ * @return The MIME type (e.g. text/html) of the specified name or
+ * {@code null} to indicate that the Http Service should determine
+ * the MIME type itself.
*/
public String getMimeType(String name);
}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/HttpService.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/HttpService.java
index c7dcd5824..fd0cd031b 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/HttpService.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/HttpService.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2014). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,16 +19,18 @@ package org.osgi.service.http;
import java.util.Dictionary;
import javax.servlet.Servlet;
import javax.servlet.ServletException;
+import org.osgi.annotation.versioning.ProviderType;
/**
* The Http Service allows other bundles in the OSGi environment to dynamically
* register resources and servlets into the URI namespace of Http Service. A
* bundle may later unregister its resources or servlets.
*
- * @noimplement
+ * @ThreadSafe
* @author $Id$
* @see HttpContext
*/
+@ProviderType
public interface HttpService {
/**
* Registers a servlet into the URI namespace.
@@ -76,7 +78,7 @@ public interface HttpService {
* @throws java.lang.IllegalArgumentException if any of the arguments are
* invalid
*/
- public void registerServlet(String alias, Servlet servlet, Dictionary initparams, HttpContext context) throws ServletException, NamespaceException;
+ public void registerServlet(String alias, Servlet servlet, Dictionary<String, String> initparams, HttpContext context) throws ServletException, NamespaceException;
/**
* Registers resources into the URI namespace.
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/NamespaceException.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/NamespaceException.java
index 6e4d8f6f5..bfc8f8361 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/NamespaceException.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/NamespaceException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2014). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/context/ServletContextHelper.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/context/ServletContextHelper.java
new file mode 100644
index 000000000..0052bc23b
--- /dev/null
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/context/ServletContextHelper.java
@@ -0,0 +1,304 @@
+/*
+ * Copyright (c) OSGi Alliance (2000, 2014). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.service.http.context;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Set;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.osgi.annotation.versioning.ConsumerType;
+import org.osgi.framework.Bundle;
+
+/**
+ * Helper service for the servlet context used by whiteboard services for HTTP
+ * requests.
+ *
+ * <p>
+ * This service defines methods that the Http Whiteboard Service implementation
+ * may call to get information for a request when dealing with whiteboard
+ * services.
+ *
+ * <p>
+ * Servlets, servlet filters, resources, and listeners services may be
+ * {@link org.osgi.service.http.whiteboard.HttpWhiteboardConstants#HTTP_WHITEBOARD_CONTEXT_NAME
+ * associated} with an {@code ServletContextHelper} service. Those whiteboard
+ * services that are associated using the same {@code ServletContextHelper}
+ * object will share the same {@code ServletContext} object.
+ *
+ * <p>
+ * If no {@code ServletContextHelper} service is associated, a default
+ * {@code ServletContextHelper} is used. The behavior of the methods on the
+ * default {@code ServletContextHelper} is defined as follows:
+ * <ul>
+ * <li>{@code getMimeType} - Does not define any customized MIME types for the
+ * {@code Content-Type} header in the response, and calls the parent context if
+ * it exists. Otherwise it always returns {@code null}.</li>
+ * <li>{@code handleSecurity} - Performs implementation-defined authentication
+ * on the request.</li>
+ * <li>{@code getResource} - Assumes the named resource is in the bundle of the
+ * whiteboard service. This method calls the whiteboard service bundle's
+ * {@code Bundle.getEntry} method, and returns the appropriate URL to access the
+ * resource. On a Java runtime environment that supports permissions, the Http
+ * Whiteboard Service needs to be granted
+ * {@code org.osgi.framework.AdminPermission[*,RESOURCE]}.</li>
+ * <li>{@code getResourcePaths} - Assumes that the resources are in the bundle
+ * of the whiteboard service. This method calls {@code Bundle.findEntries}
+ * method, and returns the found entries. On a Java runtime environment that
+ * supports permissions, the Http Whiteboard Service needs to be granted
+ * {@code org.osgi.framework.AdminPermission[*,RESOURCE]}.</li>
+ * <li>{@code getRealPath} - This method returns {@code null}.
+ * </ul>
+ *
+ * It is possible to register own {@code ServletContextHelper} services with a
+ * {@link org.osgi.service.http.whiteboard.HttpWhiteboardConstants#HTTP_WHITEBOARD_CONTEXT_NAME
+ * service property}.
+ *
+ * <p>
+ * A context can be registered with the
+ * {@link org.osgi.service.http.whiteboard.HttpWhiteboardConstants#HTTP_WHITEBOARD_CONTEXT_PATH
+ * service property} to define a path under which all services registered with
+ * this context are reachable.
+ *
+ * @ThreadSafe
+ * @author $Id$
+ * @see org.osgi.service.http.whiteboard.HttpWhiteboardConstants#HTTP_WHITEBOARD_CONTEXT_NAME
+ * @see org.osgi.service.http.whiteboard.HttpWhiteboardConstants#HTTP_WHITEBOARD_CONTEXT_PATH
+ */
+@ConsumerType
+public abstract class ServletContextHelper {
+ /**
+ * {@code HttpServletRequest} attribute specifying the name of the
+ * authenticated user. The value of the attribute can be retrieved by
+ * {@code HttpServletRequest.getRemoteUser}. This attribute name is
+ * {@code org.osgi.service.http.authentication.remote.user}.
+ */
+ public static final String REMOTE_USER = "org.osgi.service.http.authentication.remote.user";
+ /**
+ * {@code HttpServletRequest} attribute specifying the scheme used in
+ * authentication. The value of the attribute can be retrieved by
+ * {@code HttpServletRequest.getAuthType}. This attribute name is
+ * {@code org.osgi.service.http.authentication.type}.
+ */
+ public static final String AUTHENTICATION_TYPE = "org.osgi.service.http.authentication.type";
+ /**
+ * {@code HttpServletRequest} attribute specifying the {@code Authorization}
+ * object obtained from the {@code org.osgi.service.useradmin.UserAdmin}
+ * service. The value of the attribute can be retrieved by
+ * {@code HttpServletRequest.getAttribute(HttpContext.AUTHORIZATION)}. This
+ * attribute name is {@code org.osgi.service.useradmin.authorization}.
+ */
+ public static final String AUTHORIZATION = "org.osgi.service.useradmin.authorization";
+
+ /** Bundle associated with this context. */
+ private final Bundle bundle;
+
+ /**
+ * Default constructor
+ */
+ public ServletContextHelper() {
+ // default constructor
+ this(null);
+ }
+
+ /**
+ * Construct a new context helper and set the bundle associated with this
+ * context.
+ *
+ * @param b The bundle
+ */
+ public ServletContextHelper(final Bundle b) {
+ this.bundle = b;
+ }
+
+ /**
+ * Handles security for the specified request.
+ *
+ * <p>
+ * The Http Whiteboard Service calls this method prior to servicing the
+ * specified request. This method controls whether the request is processed
+ * in the normal manner or an error is returned.
+ *
+ * <p>
+ * If the request requires authentication and the Authorization header in
+ * the request is missing or not acceptable, then this method should set the
+ * WWW-Authenticate header in the response object, set the status in the
+ * response object to Unauthorized(401) and return {@code false}. See also
+ * RFC 2617: <i>HTTP Authentication: Basic and Digest Access Authentication
+ * </i> (available at http://www.ietf.org/rfc/rfc2617.txt).
+ *
+ * <p>
+ * If the request requires a secure connection and the {@code getScheme}
+ * method in the request does not return 'https' or some other acceptable
+ * secure protocol, then this method should set the status in the response
+ * object to Forbidden(403) and return {@code false}.
+ *
+ * <p>
+ * When this method returns {@code false}, the Http Whiteboard Service will
+ * send the response back to the client, thereby completing the request.
+ * When this method returns {@code true}, the Http Whitboard Service will
+ * proceed with servicing the request.
+ *
+ * <p>
+ * If the specified request has been authenticated, this method must set the
+ * {@link #AUTHENTICATION_TYPE} request attribute to the type of
+ * authentication used, and the {@link #REMOTE_USER} request attribute to
+ * the remote user (request attributes are set using the
+ * {@code setAttribute} method on the request). If this method does not
+ * perform any authentication, it must not set these attributes.
+ *
+ * <p>
+ * If the authenticated user is also authorized to access certain resources,
+ * this method must set the {@link #AUTHORIZATION} request attribute to the
+ * {@code Authorization} object obtained from the
+ * {@code org.osgi.service.useradmin.UserAdmin} service.
+ *
+ * <p>
+ * The servlet responsible for servicing the specified request determines
+ * the authentication type and remote user by calling the
+ * {@code getAuthType} and {@code getRemoteUser} methods, respectively, on
+ * the request.
+ *
+ * @param context The servlet context helper context for this call.
+ * @param request The HTTP request.
+ * @param response The HTTP response.
+ * @return {@code true} if the request should be serviced, {@code false} if
+ * the request should not be serviced and Http Whiteboard Service
+ * will send the response back to the client.
+ * @throws java.io.IOException may be thrown by this method. If this occurs,
+ * the Http Whiteboard Service will terminate the request and close
+ * the socket.
+ */
+ public boolean handleSecurity(final ServletContextHelperContext context,
+ final HttpServletRequest request,
+ final HttpServletResponse response)
+ throws IOException {
+ final ServletContextHelper parent = context.getParentContext(this);
+ if ( parent != null ) {
+ return parent.handleSecurity(context, request, response);
+ }
+ return true;
+ }
+
+ /**
+ * Maps a resource name to a URL.
+ *
+ * <p>
+ * Called by the Http Whiteboard Service to map the specified resource name
+ * to a URL. For servlets, Http Whiteboard Service will call this method to
+ * support the {@code ServletContext} methods {@code getResource} and
+ * {@code getResourceAsStream}. For resource servlets, Http Whiteboard
+ * Service will call this method to locate the named resource.
+ *
+ * <p>
+ * The context can control from where resources come. For example, the
+ * resource can be mapped to a file in the bundle's persistent storage area
+ * via {@code bundleContext.getDataFile(name).toURL()} or to a resource in
+ * the context's bundle via {@code getClass().getResource(name)}
+ *
+ * @param context The servlet context helper context for this call.
+ * @param name The name of the requested resource.
+ * @return A URL that Http Whiteboard Service can use to read the resource
+ * or {@code null} if the resource does not exist.
+ */
+ public URL getResource(final ServletContextHelperContext context, String name) {
+ final Bundle localBundle = this.bundle;
+ if (name != null && localBundle != null) {
+ if (name.startsWith("/")) {
+ name = name.substring(1);
+ }
+
+ return this.bundle.getEntry(name);
+ }
+ return null;
+ }
+
+ /**
+ * Maps a name to a MIME type.
+ *
+ * <p>
+ * Called by the Http Whiteboard Service to determine the MIME type for the
+ * specified name. For whiteboard services, the Http Whiteboard Service will
+ * call this method to support the {@code ServletContext} method
+ * {@code getMimeType}. For resource servlets, the Http Whiteboard Service
+ * will call this method to determine the MIME type for the
+ * {@code Content-Type} header in the response.
+ *
+ * @param context The servlet context helper context for this call.
+ * @param name The name for which to determine the MIME type.
+ * @return The MIME type (e.g. text/html) of the specified name or
+ * {@code null} to indicate that the Http Service should determine
+ * the MIME type itself.
+ */
+ public String getMimeType(final ServletContextHelperContext context, final String name) {
+ final ServletContextHelper parent = context.getParentContext(this);
+ if (parent != null) {
+ parent.getMimeType(context, name);
+ }
+ return null;
+ }
+
+ /**
+ * Returns a directory-like listing of all the paths to resources within the
+ * web application whose longest sub-path matches the supplied path
+ * argument.
+ *
+ * <p>
+ * Called by the Http Whiteboard Service to support the
+ * {@code ServletContext} method {@code getResourcePaths} for whiteboard
+ * services.
+ *
+ * @param context The servlet context helper context for this call.
+ * @param path the partial path used to match the resources, which must
+ * start with a /
+ * @return a Set containing the directory listing, or null if there are no
+ * resources in the web application whose path begins with the
+ * supplied path.
+ */
+ public Set<String> getResourcePaths(final ServletContextHelperContext context, final String path) {
+ final Bundle localBundle = this.bundle;
+ if (path != null && localBundle != null) {
+ final Enumeration<URL> e = localBundle.findEntries(path, null, false);
+ if (e != null) {
+ final Set<String> result = new HashSet<String>();
+ while (e.hasMoreElements()) {
+ result.add(e.nextElement().getPath());
+ }
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Gets the real path corresponding to the given virtual path.
+ *
+ * <p>
+ * Called by the Http Whiteboard Service to support the
+ * {@code ServletContext} method {@code getRealPath} for whiteboard
+ * services.
+ *
+ * @param context The servlet context helper context for this call.
+ * @param path the virtual path to be translated to a real path
+ * @return the real path, or null if the translation cannot be performed
+ */
+ public String getRealPath(final ServletContextHelperContext context, final String path) {
+ return null;
+ }
+}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/context/ServletContextHelperContext.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/context/ServletContextHelperContext.java
new file mode 100644
index 000000000..fe7a2ac51
--- /dev/null
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/context/ServletContextHelperContext.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) OSGi Alliance (2000, 2014). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.service.http.context;
+
+import org.osgi.annotation.versioning.ProviderType;
+
+/**
+ * This context object is passed to each method of the
+ * {@code ServletContextHelper}.
+ *
+ * @NotThreadSafe
+ * @author $Id$
+ */
+@ProviderType
+public interface ServletContextHelperContext {
+
+ /**
+ * Return the parent context for the given {@code ServletContextHelper}
+ *
+ * @param context The current {@code ServletContextHelper}
+ * @return The parent {@code ServletContextHelper} or {@code null}
+ */
+ ServletContextHelper getParentContext(ServletContextHelper context);
+}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/context/package-info.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/context/package-info.java
new file mode 100644
index 000000000..906ef6142
--- /dev/null
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/context/package-info.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) OSGi Alliance (2010, 2014). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Http Service Context Package Version 1.0.
+ *
+ * <p>
+ * Bundles wishing to use this package must list the package in the
+ * Import-Package header of the bundle's manifest. This package has two types of
+ * users: the consumers that use the API in this package and the providers that
+ * implement the API in this package.
+ *
+ * <p>
+ * Example import for consumers using the API in this package:
+ * <p>
+ * {@code Import-Package: org.osgi.service.http.context; version="[1.0,2.0)"}
+ * <p>
+ * Example import for providers implementing the API in this package:
+ * <p>
+ * {@code Import-Package: org.osgi.service.http.context; version="[1.0,1.1)"}
+ *
+ * @author $Id$
+ */
+
+@Version("1.0")
+package org.osgi.service.http.context;
+
+import org.osgi.annotation.versioning.Version;
+
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/context/packageinfo b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/context/packageinfo
new file mode 100644
index 000000000..7c8de0324
--- /dev/null
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/context/packageinfo
@@ -0,0 +1 @@
+version 1.0
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/package-info.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/package-info.java
index 349de707c..1d0550157 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/package-info.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2014). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,7 +15,7 @@
*/
/**
- * Http Service Package Version 1.2.
+ * Http Service Package Version 1.3.
*
* <p>
* Bundles wishing to use this package must list the package in the
@@ -26,15 +26,17 @@
* <p>
* Example import for consumers using the API in this package:
* <p>
- * {@code Import-Package: org.osgi.service.http; version="[1.2,2.0)"}
+ * {@code Import-Package: org.osgi.service.http; version="[1.2.2,2.0)"}
* <p>
* Example import for providers implementing the API in this package:
* <p>
- * {@code Import-Package: org.osgi.service.http; version="[1.2,1.3)"}
+ * {@code Import-Package: org.osgi.service.http; version="[1.2.2,1.3)"}
*
- * @version 1.2.1
* @author $Id$
*/
+@Version("1.2.2")
package org.osgi.service.http;
+import org.osgi.annotation.versioning.Version;
+
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/packageinfo b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/packageinfo
index 6ebb891f1..19727573b 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/packageinfo
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/packageinfo
@@ -1 +1 @@
-version 1.2.1
+version 1.2.2
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/HttpServiceRuntime.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/HttpServiceRuntime.java
new file mode 100644
index 000000000..a4b1539bc
--- /dev/null
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/HttpServiceRuntime.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.service.http.runtime;
+
+import org.osgi.annotation.versioning.ProviderType;
+import org.osgi.service.http.runtime.dto.RequestInfoDTO;
+import org.osgi.service.http.runtime.dto.RuntimeDTO;
+
+/**
+ * The {@code HttpServiceRuntime} service represents the runtime information of
+ * a Http (Whiteboard) Service implementation.
+ *
+ * <p>
+ * It provides access to DTOs representing the current state of the service.
+ * <p>
+ * The {@code HttpServiceRuntime} service must at least be registered with the
+ * {@link HttpServiceRuntimeConstants#HTTP_SERVICE_ENDPOINT_ATTRIBUTE}
+ * attribute.
+ *
+ * @ThreadSafe
+ * @author $Id$
+ */
+@ProviderType
+public interface HttpServiceRuntime {
+
+ /**
+ * Return the runtime DTO representing the current state.
+ * @return The runtime DTO
+ */
+ public RuntimeDTO getRuntimeDTO();
+
+ /**
+ * Return a request info DTO containing the services
+ * involved with processing a request for the given
+ * path.
+ * @param path The request path, relative to the root of the
+ * Http (Whiteboard) Service.
+ * @return A request info DTO
+ */
+ public RequestInfoDTO calculateRequestInfoDTO(String path);
+}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/HttpServiceRuntimeConstants.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/HttpServiceRuntimeConstants.java
new file mode 100644
index 000000000..7357ae7c1
--- /dev/null
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/HttpServiceRuntimeConstants.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.service.http.runtime;
+
+
+/**
+ * Defines standard names for Http Runtime Service constants.
+ *
+ * @author $Id$
+ */
+public final class HttpServiceRuntimeConstants {
+ private HttpServiceRuntimeConstants() {
+ // non-instantiable
+ }
+
+ /**
+ * Http service runtime registration property specifying the endpoints upon
+ * which the Http service runtime is listening.
+ *
+ * <p>
+ * An endpoint value is a URL or a relative path, to which the Http service
+ * runtime is listening. For example, {@code http://192.168.1.10:8080/} or
+ * {@code /myapp/}. A relative path may be used if the scheme and authority
+ * parts of the URL are not known, e.g. in a bridged Http Service
+ * implementation. If the Http Service implementation is serving the root context and
+ * neither scheme nor authority is known, the value of the property is "/".
+ * Both, a URL and a relative path, must end with a slash.
+ * <p>
+ * An Http Service Runtime can be listening on multiple endpoints.
+ *
+ * <p>
+ * The value of this attribute must be of type {@code String},
+ * {@code String[]}, or {@code Collection<String>}.
+ */
+ public static final String HTTP_SERVICE_ENDPOINT_ATTRIBUTE = "osgi.http.endpoint";
+}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/BaseServletDTO.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/BaseServletDTO.java
new file mode 100644
index 000000000..569064a25
--- /dev/null
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/BaseServletDTO.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.service.http.runtime.dto;
+
+import java.util.Map;
+import org.osgi.dto.DTO;
+
+/**
+ * Represents common information about a {@code javax.servlet.Servlet} service.
+ *
+ * @NotThreadSafe
+ * @author $Id$
+ */
+public abstract class BaseServletDTO extends DTO {
+ /**
+ * The name of the servlet.
+ */
+ public String name;
+
+ /**
+ * The information string from the servlet.
+ * <p>
+ * This is the value returned by the {@code Servlet.getServletInfo()}
+ * method.
+ */
+ public String servletInfo;
+
+ /**
+ * Specifies whether the servlet supports asynchronous processing.
+ */
+ public boolean asyncSupported;
+
+ /**
+ * The servlet initialization parameters as provided during registration
+ * of the servlet. Additional parameters like the Http Service Runtime
+ * attributes are not included.
+ */
+ public Map<String, String> initParams;
+
+ /**
+ * The service id of the {@code ServletContext} for the servlet.
+ */
+ public long servletContextId;
+
+ /**
+ * Service property identifying the servlet. In the case of a servlet registered
+ * in the service registry and picked up by a whiteboard implementation, this value
+ * is not negative and corresponds to the service id in the registry.
+ * If the servlet has not been registered in the service registry, the value
+ * is negative and a unique negative value is generated by the Http Service Runtime
+ * in this case.
+ */
+ public long serviceId;
+}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/DTOConstants.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/DTOConstants.java
new file mode 100644
index 000000000..fd445b21b
--- /dev/null
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/DTOConstants.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.service.http.runtime.dto;
+
+/**
+ * Defines standard constants for the DTOs.
+ */
+public final class DTOConstants {
+ private DTOConstants() {
+ // non-instantiable
+ }
+
+ /**
+ * Failure reason is unknown
+ * <p>
+ * The value of {@code FAILURE_REASON_UNKNOWN} is 0.
+ */
+ public static final int FAILURE_REASON_UNKNOWN = 0;
+
+ /**
+ * No matching servlet context
+ * <p>
+ * The value of {@code FAILURE_REASON_NO_SERVLET_CONTEXT_MATCHING} is 1.
+ **/
+ public static final int FAILURE_REASON_NO_SERVLET_CONTEXT_MATCHING = 1;
+
+ /**
+ * Matching servlet context, but servlet context is not used due to a
+ * problem with the context.
+ * <p>
+ * The value of {@code FAILURE_REASON_SERVLET_CONTEXT_FAILURE} is 2.
+ */
+ public static final int FAILURE_REASON_SERVLET_CONTEXT_FAILURE = 2;
+
+ /**
+ * Service is shadowed by another service, e.g. a service with the same
+ * registration properties but a higher service ranking.
+ * <p>
+ * The value of {@code FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE} is 3.
+ */
+ public static final int FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE = 3;
+
+ /**
+ * An exception occurred during initializing of the service. This reason can
+ * only happen for servlets and servlet filters.
+ * <p>
+ * The value of {@code FAILURE_REASON_EXCEPTION_ON_INIT} is 4.
+ */
+ public static final int FAILURE_REASON_EXCEPTION_ON_INIT = 4;
+
+ /**
+ * The service is registered in the servlet registry but getting the service
+ * fails as it returns {@code null}.
+ * <p>
+ * The value of {@code FAILURE_REASON_SERVICE_NOT_GETTABLE} is 5.
+ */
+ public static final int FAILURE_REASON_SERVICE_NOT_GETTABLE = 5;
+}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/ErrorPageDTO.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/ErrorPageDTO.java
new file mode 100644
index 000000000..8230d5c92
--- /dev/null
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/ErrorPageDTO.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.service.http.runtime.dto;
+
+/**
+ * Represents a {@code javax.servlet.Servlet} servlet for handling errors and
+ * currently being used by a servlet context.
+ *
+ * @NotThreadSafe
+ * @author $Id$
+ */
+public class ErrorPageDTO extends BaseServletDTO {
+ /**
+ * The exceptions the error page is used for. This array might be
+ * empty.
+ */
+ public String[] exceptions;
+
+ /**
+ * The error codes the error page is used for. This array might be
+ * empty.
+ */
+ public long[] errorCodes;
+}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/FailedErrorPageDTO.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/FailedErrorPageDTO.java
new file mode 100644
index 000000000..0003c01bf
--- /dev/null
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/FailedErrorPageDTO.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.service.http.runtime.dto;
+
+/**
+ * Represents a {@code javax.servlet.Servlet} service registered as an error
+ * page but currently not being used for a servlet context due to a problem.
+ * <p>
+ * As the servlet represented by this DTO is not used due to a failure, the
+ * field {@link FailedErrorPageDTO#servletContextId} always returns {@code 0}
+ * and does not point to an existing servlet context.
+ *
+ * @NotThreadSafe
+ * @author $Id$
+ */
+public class FailedErrorPageDTO extends ErrorPageDTO {
+
+ /**
+ * The reason why the servlet represented by this DTO is not used.
+ *
+ * @see DTOConstants#FAILURE_REASON_UNKNOWN
+ * @see DTOConstants#FAILURE_REASON_EXCEPTION_ON_INIT
+ * @see DTOConstants#FAILURE_REASON_NO_SERVLET_CONTEXT_MATCHING
+ * @see DTOConstants#FAILURE_REASON_SERVICE_NOT_GETTABLE
+ * @see DTOConstants#FAILURE_REASON_SERVLET_CONTEXT_FAILURE
+ * @see DTOConstants#FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE
+ */
+ public int failureReason;
+
+}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/FailedFilterDTO.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/FailedFilterDTO.java
new file mode 100644
index 000000000..01f84828b
--- /dev/null
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/FailedFilterDTO.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.service.http.runtime.dto;
+
+/**
+ * Represents a servlet {@code Filter} filter which is currently not being
+ * used for a servlet context due to a problem.
+ * <p>
+ * As the service represented by this DTO is not used due to a failure, the
+ * field {@link FailedFilterDTO#servletContextId} always returns {@code 0} and
+ * does not point to an existing servlet context.
+ *
+ * @NotThreadSafe
+ * @author $Id$
+ */
+public class FailedFilterDTO extends FilterDTO {
+
+ /**
+ * The reason why the filter represented by this DTO is not used.
+ *
+ * @see DTOConstants#FAILURE_REASON_UNKNOWN
+ * @see DTOConstants#FAILURE_REASON_EXCEPTION_ON_INIT
+ * @see DTOConstants#FAILURE_REASON_NO_SERVLET_CONTEXT_MATCHING
+ * @see DTOConstants#FAILURE_REASON_SERVICE_NOT_GETTABLE
+ * @see DTOConstants#FAILURE_REASON_SERVLET_CONTEXT_FAILURE
+ * @see DTOConstants#FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE
+ */
+ public int failureReason;
+
+}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/FailedListenerDTO.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/FailedListenerDTO.java
new file mode 100644
index 000000000..e6b1e1a42
--- /dev/null
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/FailedListenerDTO.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.service.http.runtime.dto;
+
+/**
+ * Represents a listener service which is currently not being
+ * used for a servlet context due to a problem.
+ * <p>
+ * As the listener represented by this DTO is not used due to a failure, the
+ * field {@link FailedErrorPageDTO#servletContextId} always returns {@code 0}
+ * and does not point to an existing servlet context.
+ *
+ * @NotThreadSafe
+ * @author $Id$
+ */
+public class FailedListenerDTO extends ListenerDTO {
+
+ /**
+ * The reason why the listener represented by this DTO is not used.
+ *
+ * @see DTOConstants#FAILURE_REASON_UNKNOWN
+ * @see DTOConstants#FAILURE_REASON_EXCEPTION_ON_INIT
+ * @see DTOConstants#FAILURE_REASON_NO_SERVLET_CONTEXT_MATCHING
+ * @see DTOConstants#FAILURE_REASON_SERVICE_NOT_GETTABLE
+ * @see DTOConstants#FAILURE_REASON_SERVLET_CONTEXT_FAILURE
+ * @see DTOConstants#FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE
+ */
+ public int failureReason;
+
+}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/FailedResourceDTO.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/FailedResourceDTO.java
new file mode 100644
index 000000000..9ebead085
--- /dev/null
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/FailedResourceDTO.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.service.http.runtime.dto;
+
+/**
+ * Represents a resource definition which is currently not being
+ * used for a servlet context due to a problem.
+ * <p>
+ * As the service represented by this DTO is not used due to a failure, the
+ * field {@link FailedResourceDTO#servletContextId} always returns {@code 0} and
+ * does not point to an existing servlet context.
+ *
+ * @NotThreadSafe
+ * @author $Id$
+ */
+public class FailedResourceDTO extends ResourceDTO {
+
+ /**
+ * The reason why the resource represented by this DTO is not used.
+ *
+ * @see DTOConstants#FAILURE_REASON_UNKNOWN
+ * @see DTOConstants#FAILURE_REASON_EXCEPTION_ON_INIT
+ * @see DTOConstants#FAILURE_REASON_NO_SERVLET_CONTEXT_MATCHING
+ * @see DTOConstants#FAILURE_REASON_SERVICE_NOT_GETTABLE
+ * @see DTOConstants#FAILURE_REASON_SERVLET_CONTEXT_FAILURE
+ * @see DTOConstants#FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE
+ */
+ public int failureReason;
+
+}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/FailedServletContextDTO.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/FailedServletContextDTO.java
new file mode 100644
index 000000000..6d47980b4
--- /dev/null
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/FailedServletContextDTO.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.service.http.runtime.dto;
+
+/**
+ * Represents a {@code javax.servlet.ServletContext} servlet context that is
+ * currently not used due to some problem.
+ *
+ * The following fields return an empty array for a
+ * {@code FailedServletContextDTO}:
+ * <ul>
+ * <li>{@link ServletContextDTO#servletDTOs}</li>
+ * <li>{@link ServletContextDTO#resourceDTOs}</li>
+ * <li>{@link ServletContextDTO#filterDTOs}</li>
+ * <li>{@link ServletContextDTO#errorPageDTOs}</li>
+ * <li>{@link ServletContextDTO#listenerDTOs}</li>
+ * </ul>
+ * <p>
+ * The method {@link ServletContextDTO#attributes} returns an empty map for a
+ * {@code FailedServletContextDTO}.
+ *
+ * @NotThreadSafe
+ * @author $Id$
+ */
+public class FailedServletContextDTO extends ServletContextDTO {
+
+ /**
+ * The reason why the servlet context represented by this DTO is not used.
+ *
+ * @see DTOConstants#FAILURE_REASON_UNKNOWN
+ * @see DTOConstants#FAILURE_REASON_EXCEPTION_ON_INIT
+ * @see DTOConstants#FAILURE_REASON_NO_SERVLET_CONTEXT_MATCHING
+ * @see DTOConstants#FAILURE_REASON_SERVICE_NOT_GETTABLE
+ * @see DTOConstants#FAILURE_REASON_SERVLET_CONTEXT_FAILURE
+ * @see DTOConstants#FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE
+ */
+ public int failureReason;
+}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/FailedServletDTO.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/FailedServletDTO.java
new file mode 100644
index 000000000..6127b1869
--- /dev/null
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/FailedServletDTO.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.service.http.runtime.dto;
+
+/**
+ * Represents a {@code javax.servlet.Servlet} servlet which is currently not
+ * being used for a servlet context due to a problem.
+ * <p>
+ * As the servlet represented by this DTO is not used due to a failure, the
+ * field {@link FailedErrorPageDTO#servletContextId} always returns {@code 0}
+ * and does not point to an existing servlet context.
+ *
+ * @NotThreadSafe
+ * @author $Id$
+ */
+public class FailedServletDTO extends ServletDTO {
+
+ /**
+ * The reason why the servlet represented by this DTO is not used.
+ *
+ * @see DTOConstants#FAILURE_REASON_UNKNOWN
+ * @see DTOConstants#FAILURE_REASON_EXCEPTION_ON_INIT
+ * @see DTOConstants#FAILURE_REASON_NO_SERVLET_CONTEXT_MATCHING
+ * @see DTOConstants#FAILURE_REASON_SERVICE_NOT_GETTABLE
+ * @see DTOConstants#FAILURE_REASON_SERVLET_CONTEXT_FAILURE
+ * @see DTOConstants#FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE
+ */
+ public int failureReason;
+}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/FilterDTO.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/FilterDTO.java
new file mode 100644
index 000000000..88adede63
--- /dev/null
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/FilterDTO.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.service.http.runtime.dto;
+
+import java.util.Map;
+import org.osgi.dto.DTO;
+
+/**
+ * Represents a servlet {@code javax.servlet.Filter} filter currently being used
+ * for a servlet context.
+ *
+ * @NotThreadSafe
+ * @author $Id$
+ */
+public class FilterDTO extends DTO {
+ /**
+ * The name of the servlet filter.
+ */
+ public String name;
+
+ /**
+ * The request mappings for the servlet filter.
+ *
+ * <p>
+ * The specified patterns are used to determine whether a request is
+ * mapped to the servlet filter.
+ */
+ public String[] patterns;
+
+ /**
+ * The servlet names for the servlet filter.
+ *
+ * <p>
+ * The specified names are used to determine the servlets whose requests
+ * are mapped to the servlet filter.
+ */
+ public String[] servletNames;
+
+ /**
+ * The request mappings for the servlet filter.
+ *
+ * <p>
+ * The specified regular expressions are used to determine whether a request
+ * is mapped to the servlet filter.
+ */
+ public String[] regexs;
+
+ /**
+ * Specifies whether the servlet filter supports asynchronous processing.
+ */
+ public boolean asyncSupported;
+
+ /**
+ * The dispatcher associations for the servlet filter.
+ *
+ * <p>
+ * The specified names are used to determine in what occasions the servlet
+ * filter is called
+ */
+ public String[] dispatcher;
+
+ /**
+ * The filter initialization parameters as provided during registration
+ * of the filter. Additional parameters like the Http Service Runtime
+ * attributes are not included.
+ */
+ public Map<String, String> initParams;
+
+ /**
+ * Service property identifying the filter. In the case of a filter registered
+ * in the service registry and picked up by a whiteboard implementation, this value
+ * is not negative and corresponds to the service id in the registry.
+ * If the filter has not been registered in the service registry, the value
+ * is negative and a unique negative value is generated by the Http Service Runtime
+ * in this case.
+ */
+ public long serviceId;
+
+ /**
+ * The service id of the {@code ServletContext} for the servlet filter.
+ */
+ public long servletContextId;
+}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/ListenerDTO.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/ListenerDTO.java
new file mode 100644
index 000000000..05556c184
--- /dev/null
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/ListenerDTO.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.service.http.runtime.dto;
+
+import org.osgi.dto.DTO;
+
+/**
+ * Represents a listener currently being used for a servlet context.
+ *
+ * @NotThreadSafe
+ * @author $Id$
+ */
+public class ListenerDTO extends DTO {
+
+ /**
+ * The fully qualified type names the listener.
+ */
+ public String[] types;
+
+ /**
+ * Service property identifying the listener. In the case of a listener
+ * registered in the service registry and picked up by a whiteboard
+ * implementation, this value is not negative and corresponds to the service
+ * id in the registry. If the listener has not been registered in the
+ * service registry, the value is negative and a unique negative value is
+ * generated by the Http Service Runtime in this case.
+ */
+ public long serviceId;
+
+ /**
+ * The service id of the {@code ServletContext} for the listener.
+ */
+ public long servletContextId;
+}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/RequestInfoDTO.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/RequestInfoDTO.java
new file mode 100644
index 000000000..e6df7dc86
--- /dev/null
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/RequestInfoDTO.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.service.http.runtime.dto;
+
+import org.osgi.dto.DTO;
+
+/**
+ * Represents the services used to process a specific request.
+ *
+ * @NotThreadSafe
+ * @author $Id$
+ */
+public class RequestInfoDTO extends DTO {
+ /**
+ * The path of the request relative to the root.
+ */
+ public String path;
+
+ /**
+ * The service id of the {@code ServletContext} for this request.
+ */
+ public long servletContextId;
+
+ /**
+ * The filters processing this request.
+ */
+ public FilterDTO[] filterDTOs;
+
+ /**
+ * The servlet processing this request.
+ * If the request is processed by a servlet, this field
+ * points to the DTO of the servlet. If the request is
+ * processed by another type of component like a resource, this
+ * field is null.
+ */
+ public ServletDTO servletDTO;
+
+ /**
+ * The resource processing this request.
+ * If the request is processed by a resource, this field
+ * points to the DTO of the resource. If the request is
+ * processed by another type of component like a servlet, this
+ * field is null.
+ */
+ public ResourceDTO resourceDTO;
+}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/ResourceDTO.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/ResourceDTO.java
new file mode 100644
index 000000000..4b8b1925a
--- /dev/null
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/ResourceDTO.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.service.http.runtime.dto;
+
+import org.osgi.dto.DTO;
+
+/**
+ * Represents a resource definition currently being used for a servlet context.
+ *
+ * @NotThreadSafe
+ * @author $Id$
+ */
+public class ResourceDTO extends DTO {
+ /**
+ * The request mappings for the resource.
+ *
+ * <p>
+ * The specified patterns are used to determine whether a request is
+ * mapped to the resource.
+ */
+ public String[] patterns;
+
+ /**
+ * The prefix of the resource.
+ */
+ public String prefix;
+
+ /**
+ * Service property identifying the resource. In the case of a resource registered
+ * in the service registry and picked up by a whiteboard implementation, this value
+ * is not negative and corresponds to the service id in the registry.
+ * If the resource has not been registered in the service registry, the value
+ * is negative and a unique negative value is generated by the Http Service Runtime
+ * in this case.
+ */
+ public long serviceId;
+
+ /**
+ * The service id of the {@code ServletContext} for the resource.
+ */
+ public long servletContextId;
+}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/RuntimeDTO.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/RuntimeDTO.java
new file mode 100644
index 000000000..61a7c833e
--- /dev/null
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/RuntimeDTO.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.service.http.runtime.dto;
+
+import java.util.Map;
+import org.osgi.dto.DTO;
+
+/**
+ * Represents the state of a Http Service Runtime.
+ *
+ * @NotThreadSafe
+ * @author $Id$
+ */
+public class RuntimeDTO extends DTO {
+
+ /**
+ * The runtime attributes.
+ */
+ public Map<String, String> attributes;
+
+ /**
+ * Returns the representations of the {@code javax.servlet.ServletContext} objects used by
+ * the Http service runtime. The returned array may be empty if the Http service
+ * runtime is currently not using any {@code ServletContext} objects.
+ */
+ public ServletContextDTO[] servletContextDTOs;
+
+ /**
+ * Returns the representations of the {@code javax.servlet.ServletContext} objects
+ * currently not used by the Http service runtime due to some problem.
+ * The returned array may be empty.
+ */
+ public FailedServletContextDTO[] failedServletContextDTOs;
+
+ /**
+ * Returns the representations of the {@code javax.servlet.Servlet} servlets associated
+ * with this runtime but currently not used due to some problem.
+ * The returned array may be empty.
+ */
+ public FailedServletDTO[] failedServletDTOs;
+
+ /**
+ * Returns the representations of the resources associated with this
+ * runtime but currently not used due to some problem.
+ * The returned array may be empty.
+ */
+ public FailedResourceDTO[] failedResourceDTOs;
+
+ /**
+ * Returns the representations of the servlet {@code javax.servlet.Filter} filters
+ * associated with this runtime but currently not used due to some problem.
+ * The returned array may be empty.
+ */
+ public FailedFilterDTO[] failedFilterDTOs;
+
+ /**
+ * Returns the representations of the error page {@code javax.servlet.Servlet} servlets
+ * associated with this runtime but currently not used due to some problem.
+ * The returned array may be empty.
+ */
+ public FailedErrorPageDTO[] failedErrorPageDTOs;
+
+ /**
+ * Returns the representations of the listeners
+ * associated with this runtime but currently not used due to some problem.
+ * The returned array may be empty.
+ */
+ public FailedListenerDTO[] failedListenerDTOs;
+}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/ServletContextDTO.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/ServletContextDTO.java
new file mode 100644
index 000000000..d4d067f5b
--- /dev/null
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/ServletContextDTO.java
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.service.http.runtime.dto;
+
+import java.util.Map;
+import org.osgi.dto.DTO;
+
+/**
+ * Represents a {@code javax.servlet.ServletContext} created for used servlets,
+ * resources, servlet filters, and listeners. The servlet context is backed by a
+ * {@link org.osgi.service.http.context.ServletContextHelper} service.
+ *
+ * @NotThreadSafe
+ * @author $Id$
+ */
+public class ServletContextDTO extends DTO {
+ /**
+ * The names of the HTTP context.
+ *
+ * An array of the names the corresponding
+ * {@link org.osgi.service.http.context.ServletContextHelper} is used for.
+ */
+ public String[] names;
+
+ /**
+ * The context name of the servlet context.
+ *
+ * <p>
+ * This is the value returned by the
+ * {@code ServletContext.getServletContextName()} method.
+ */
+ public String contextName;
+
+ /**
+ * The servlet context path.
+ *
+ * This is the value returned by the {@code ServletContext.getContextPath()}
+ * method.
+ */
+ public String contextPath;
+
+ /**
+ * The servlet context initialization parameters. This is the set of parameters
+ * provided when registering this context. Additional parameters like the Http Service Runtime
+ * attributes are not included.
+ */
+ public Map<String, String> initParams;
+
+ /**
+ * The servlet context attributes.
+ *
+ * <p>
+ * The value type must be a numerical type, Boolean, String, DTO or an array
+ * of any of the former. Therefore this method will only return the
+ * attributes of the servlet context conforming to this constraint.
+ */
+ public Map<String, Object> attributes;
+
+ /**
+ * Service property identifying the servlet context. In the case of a servlet context registered
+ * in the service registry and picked up by a whiteboard implementation, this value
+ * is not negative and corresponds to the service id in the registry.
+ * If the servlet context has not been registered in the service registry, the value
+ * is negative and a unique negative value is generated by the Http Service Runtime
+ * in this case.
+ */
+ public long serviceId;
+
+ /**
+ * Returns the representations of the {@code Servlet} services associated
+ * with this context.
+ *
+ * The representations of the {@code Servlet} services associated with this
+ * context. The returned array may be empty if this context is currently not
+ * associated with any {@code Servlet} services.
+ */
+ public ServletDTO[] servletDTOs;
+
+ /**
+ * Returns the representations of the resource services associated with this
+ * context.
+ *
+ * The representations of the resource services associated with this
+ * context. The returned array may be empty if this context is currently not
+ * associated with any resource services.
+ */
+ public ResourceDTO[] resourceDTOs;
+
+ /**
+ * Returns the representations of the servlet {@code Filter} services
+ * associated with this context.
+ *
+ * The representations of the servlet {@code Filter} services associated
+ * with this context. The returned array may be empty if this context is
+ * currently not associated with any servlet {@code Filter} services.
+ */
+ public FilterDTO[] filterDTOs;
+
+ /**
+ * Returns the representations of the error page {@code Servlet} services
+ * associated with this context.
+ *
+ * The representations of the error page {@code Servlet} services associated
+ * with this context. The returned array may be empty if this context is
+ * currently not associated with any error pages.
+ */
+ public ErrorPageDTO[] errorPageDTOs;
+
+ /**
+ * Returns the representations of the listener services associated with this
+ * context.
+ *
+ * The representations of the listener services associated with this
+ * context. The returned array may be empty if this context is currently not
+ * associated with any listener services.
+ */
+ public ListenerDTO[] listenerDTOs;
+}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/ServletDTO.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/ServletDTO.java
new file mode 100644
index 000000000..a40ffc801
--- /dev/null
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/ServletDTO.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.service.http.runtime.dto;
+
+
+/**
+ * Represents a {@code javax.servlet.Servlet} currently being used for a servlet
+ * context.
+ *
+ * @NotThreadSafe
+ * @author $Id$
+ */
+public class ServletDTO extends BaseServletDTO {
+ /**
+ * The request mappings for the servlet.
+ *
+ * <p>
+ * The specified patterns are used to determine whether a request is
+ * mapped to the servlet.
+ */
+ public String[] patterns;
+}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/package-info.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/package-info.java
new file mode 100644
index 000000000..77c57c18e
--- /dev/null
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/package-info.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) OSGi Alliance (2010, 2014). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Http Service Runtime DTO Package Version 1.0.
+ *
+ * <p>
+ * Bundles wishing to use this package must list the package in the
+ * Import-Package header of the bundle's manifest. This package has two types of
+ * users: the consumers that use the API in this package and the providers that
+ * implement the API in this package.
+ *
+ * <p>
+ * Example import for consumers using the API in this package:
+ * <p>
+ * {@code Import-Package: org.osgi.service.http.runtime.dto; version="[1.0,2.0)"}
+ * <p>
+ * Example import for providers implementing the API in this package:
+ * <p>
+ * {@code Import-Package: org.osgi.service.http.runtime.dto; version="[1.0,1.1)"}
+ *
+ * @author $Id$
+ */
+
+@Version("1.0")
+package org.osgi.service.http.runtime.dto;
+
+import org.osgi.annotation.versioning.Version;
+
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/packageinfo b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/packageinfo
new file mode 100644
index 000000000..7c8de0324
--- /dev/null
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/dto/packageinfo
@@ -0,0 +1 @@
+version 1.0
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/package-info.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/package-info.java
new file mode 100644
index 000000000..80f86d1fe
--- /dev/null
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/package-info.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) OSGi Alliance (2010, 2014). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Http Service Runtime Package Version 1.0.
+ *
+ * <p>
+ * Bundles wishing to use this package must list the package in the
+ * Import-Package header of the bundle's manifest. This package has two types of
+ * users: the consumers that use the API in this package and the providers that
+ * implement the API in this package.
+ *
+ * <p>
+ * Example import for consumers using the API in this package:
+ * <p>
+ * {@code Import-Package: org.osgi.service.http.runtime; version="[1.0,2.0)"}
+ * <p>
+ * Example import for providers implementing the API in this package:
+ * <p>
+ * {@code Import-Package: org.osgi.service.http.runtime; version="[1.0,1.1)"}
+ *
+ * @author $Id$
+ */
+
+@Version("1.0")
+package org.osgi.service.http.runtime;
+
+import org.osgi.annotation.versioning.Version;
+
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/packageinfo b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/packageinfo
new file mode 100644
index 000000000..7c8de0324
--- /dev/null
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/runtime/packageinfo
@@ -0,0 +1 @@
+version 1.0
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/whiteboard/HttpWhiteboardConstants.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/whiteboard/HttpWhiteboardConstants.java
new file mode 100644
index 000000000..1308cfa4a
--- /dev/null
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/whiteboard/HttpWhiteboardConstants.java
@@ -0,0 +1,374 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.service.http.whiteboard;
+
+/**
+ * Defines standard names for Http Whiteboard Service constants.
+ *
+ * @author $Id$
+ */
+public final class HttpWhiteboardConstants {
+ private HttpWhiteboardConstants() {
+ // non-instantiable
+ }
+
+ /**
+ * The name of the default
+ * {@link org.osgi.service.http.context.ServletContextHelper}. If a service
+ * is registered with this property, it is overriding the default context
+ * with a custom provided context.
+ *
+ * @see #HTTP_WHITEBOARD_CONTEXT_NAME
+ */
+ public static final String HTTP_WHITEBOARD_DEFAUT_CONTEXT_NAME = "default";
+
+ /**
+ * Service property specifying the name(s) of an
+ * {@link org.osgi.service.http.context.ServletContextHelper} service.
+ *
+ * <p>
+ * For {@link org.osgi.service.http.context.ServletContextHelper} services,
+ * this service property must be specified. Context services without this
+ * service property must be ignored.
+ *
+ * <p>
+ * Servlet, listener, servlet filter, and resource servlet services might
+ * refer to a specific
+ * {@link org.osgi.service.http.context.ServletContextHelper} service
+ * referencing the name with the {@link #HTTP_WHITEBOARD_CONTEXT_SELECT}
+ * property.
+ *
+ * <p>
+ * For {@link org.osgi.service.http.context.ServletContextHelper} services,
+ * the value of this service property must be of type {@code String},
+ * {@code String[]}, or {@code Collection<String>}. Each value must follow
+ * the "symbolic-name" specification from Section 1.3.2 of the OSGi Core
+ * Specification.
+ *
+ * @see #HTTP_WHITEBOARD_CONTEXT_PATH
+ * @see #HTTP_WHITEBOARD_CONTEXT_SELECT
+ * @see #HTTP_WHITEBOARD_DEFAUT_CONTEXT_NAME
+ */
+ public static final String HTTP_WHITEBOARD_CONTEXT_NAME = "osgi.http.whiteboard.context.name";
+
+ /**
+ * Service property specifying the path of an
+ * {@link org.osgi.service.http.context.ServletContextHelper} service.
+ *
+ * <p>
+ * For {@link org.osgi.service.http.context.ServletContextHelper} services
+ * this service property is required. Context services without this service
+ * property must be ignored.
+ *
+ * <p>
+ * This property defines a context path under which all whiteboard services
+ * are registered. Having different contexts with different paths allows to
+ * separate the URL space.
+ *
+ * <p>
+ * For {@link org.osgi.service.http.context.ServletContextHelper} services,
+ * the value of this service property must be of type {@code String}. The
+ * path must start with a slash but not end with a slash. Contexts with an
+ * invalid path are ignored.
+ *
+ * @see #HTTP_WHITEBOARD_CONTEXT_NAME
+ * @see #HTTP_WHITEBOARD_CONTEXT_SELECT
+ */
+ public static final String HTTP_WHITEBOARD_CONTEXT_PATH = "osgi.http.whiteboard.context.path";
+
+ /**
+ * Service property referencing the
+ * {@link org.osgi.service.http.context.ServletContextHelper} service.
+ *
+ * <p>
+ * For servlet, listener, servlet filter, or resource servlet services, this
+ * service property refers to the associated Servlet Context Helper service.
+ * The value of this property either directly referencing a context name or
+ * is a filter expression which is matched against the service registration
+ * properties of the Servlet Context Helper. If this service property is not
+ * specified, then the default context must be used. If there is no context
+ * service matching, the servlet, listener, servlet filter, or resource
+ * servlet service must be ignored.
+ *
+ * <p>
+ * For servlet, listener, servlet filter, or resource servlet services, the
+ * value of this service property must be of type {@code String}.
+ *
+ * @see #HTTP_WHITEBOARD_CONTEXT_NAME
+ * @see #HTTP_WHITEBOARD_CONTEXT_PATH
+ */
+ public static final String HTTP_WHITEBOARD_CONTEXT_SELECT = "osgi.http.whiteboard.context.select";
+
+ /**
+ * Service property specifying the servlet name of a {@code Servlet}
+ * service.
+ *
+ * <p>
+ * This name is used as the value for the
+ * {@code ServletConfig.getServletName()} method. If this service property
+ * is not specified, the fully qualified name of the service object's class
+ * is used as the servlet name. Filter services may refer to servlets by
+ * this name in their {@link #HTTP_WHITEBOARD_FILTER_SERVLET} service
+ * property to apply the filter to the servlet.
+ *
+ * <p>
+ * Servlet names must be unique among all servlet services associated with
+ * an {@link org.osgi.service.http.context.ServletContextHelper}. If
+ * multiple servlet services associated with the same HttpContext have the
+ * same servlet name, then all but the highest ranked servlet service must
+ * be ignored.
+ *
+ * <p>
+ * The value of this service property must be of type {@code String}.
+ */
+ public static final String HTTP_WHITEBOARD_SERVLET_NAME = "osgi.http.whiteboard.servlet.name";
+
+ /**
+ * Service property specifying the request mappings for a {@code Servlet}
+ * service.
+ *
+ * <p>
+ * The specified patterns are used to determine whether a request should be
+ * mapped to the servlet. Servlet services without this service property or
+ * {@link #HTTP_WHITEBOARD_SERVLET_ERROR_PAGE} must be ignored.
+ *
+ * <p>
+ * The value of this service property must be of type {@code String},
+ * {@code String[]}, or {@code Collection<String>}.
+ *
+ * @see "Java Servlet Specification Version 3.0, Section 12.2 Specification of Mappings"
+ */
+ public static final String HTTP_WHITEBOARD_SERVLET_PATTERN = "osgi.http.whiteboard.servlet.pattern";
+
+ /**
+ * Service property specifying whether a {@code Servlet} service acts as an
+ * error page.
+ *
+ * <p>
+ * The service property values may be the name of a fully qualified
+ * exception class or a three digit HTTP status code. Any value that is not
+ * a three digit number is considered to be the name of a fully qualified
+ * exception class.
+ *
+ * <p>
+ * The value of this service property must be of type {@code String},
+ * {@code String[]}, or {@code Collection<String>}.
+ */
+ public static final String HTTP_WHITEBOARD_SERVLET_ERROR_PAGE = "osgi.http.whiteboard.servlet.errorPage";
+
+ /**
+ * Service property specifying whether a {@code Servlet} service supports
+ * asynchronous processing.
+ *
+ * <p>
+ * By default Servlet services do not support asynchronous processing.
+ *
+ * <p>
+ * The value of this service property must be of type {@code Boolean}.
+ *
+ * @see "Java Servlet Specification Version 3.0, Section 2.3.3.3 Asynchronous Processing"
+ */
+ public static final String HTTP_WHITEBOARD_SERVLET_ASYNC_SUPPORTED = "osgi.http.whiteboard.servlet.asyncSupported";
+
+ /**
+ * Service property specifying the servlet filter name of a {@code Filter}
+ * service.
+ *
+ * <p>
+ * This name is used as the value for the
+ * {@code FilterConfig.getFilterName()} method. If this service property is
+ * not specified, the fully qualified name of the service object's class is
+ * used as the servlet filter name.
+ *
+ * <p>
+ * Servlet filter names must be unique among all servlet filter services
+ * associated with an
+ * {@link org.osgi.service.http.context.ServletContextHelper}. If multiple
+ * servlet filter services associated with the same HttpContext have the
+ * same servlet filter name, then all but the highest ranked servlet filter
+ * service must be ignored.
+ *
+ * <p>
+ * The value of this service property must be of type {@code String}.
+ */
+ public static final String HTTP_WHITEBOARD_FILTER_NAME = "osgi.http.whiteboard.filter.name";
+
+ /**
+ * Service property specifying the request mappings for a {@code Filter}
+ * service.
+ *
+ * <p>
+ * The specified patterns are used to determine whether a request should be
+ * mapped to the servlet filter. Filter services without this service
+ * property or the {@link #HTTP_WHITEBOARD_FILTER_SERVLET} or the
+ * {@link #HTTP_WHITEBOARD_FILTER_REGEX} service property must be ignored.
+ *
+ * <p>
+ * The value of this service property must be of type {@code String},
+ * {@code String[]}, or {@code Collection<String>}.
+ *
+ * @see "Java Servlet Specification Version 3.0, Section 12.2 Specification of Mappings"
+ */
+ public static final String HTTP_WHITEBOARD_FILTER_PATTERN = "osgi.http.whiteboard.filter.pattern";
+
+ /**
+ * Service property specifying the {@link #HTTP_WHITEBOARD_SERVLET_NAME
+ * servlet names} for a {@code Filter} service.
+ *
+ * <p>
+ * The specified names are used to determine the servlets whose requests
+ * should be mapped to the servlet filter. Filter services without this
+ * service property or the {@link #HTTP_WHITEBOARD_FILTER_PATTERN} or the
+ * {@link #HTTP_WHITEBOARD_FILTER_REGEX} service property must be ignored.
+ *
+ * <p>
+ * The value of this service property must be of type {@code String},
+ * {@code String[]}, or {@code Collection<String>}.
+ */
+ public static final String HTTP_WHITEBOARD_FILTER_SERVLET = "osgi.http.whiteboard.filter.servlet";
+
+ /**
+ * Service property specifying the request mappings for a {@code Filter}
+ * service.
+ *
+ * <p>
+ * The specified regular expressions are used to determine whether a request
+ * should be mapped to the servlet filter. The regular expressions must
+ * follow the syntax defined in {@link java.util.regex.Pattern}. Filter
+ * services without this service property or the
+ * {@link #HTTP_WHITEBOARD_FILTER_SERVLET} or the
+ * {@link #HTTP_WHITEBOARD_FILTER_PATTERN} service property must be ignored.
+ *
+ * <p>
+ * The value of this service property must be of type {@code String},
+ * {@code String[]}, or {@code Collection<String>}.
+ *
+ * @see java.util.regex.Pattern
+ */
+ public static final String HTTP_WHITEBOARD_FILTER_REGEX = "osgi.http.whiteboard.filter.regex";
+
+ /**
+ * Service property specifying whether a {@code Filter} service supports
+ * asynchronous processing.
+ *
+ * <p>
+ * By default Filters services do not support asynchronous processing.
+ *
+ * <p>
+ * The value of this service property must be of type {@code Boolean}.
+ *
+ * @see "Java Servlet Specification Version 3.0, Section 2.3.3.3 Asynchronous Processing"
+ */
+ public static final String HTTP_WHITEBOARD_FILTER_ASYNC_SUPPORTED = "osgi.http.whiteboard.filter.asyncSupported";
+
+ /**
+ * Service property specifying the dispatcher handling of a {@code Filter}.
+ *
+ * <p>
+ * By default Filters services are associated with client requests only (see
+ * value {@link #DISPATCHER_REQUEST}).
+ *
+ * <p>
+ * The value of this service property must be of type {@code String},
+ * {@code String[]}, or {@code Collection<String>}. Allowed values are
+ * {@link #DISPATCHER_ASYNC}, {@link #DISPATCHER_ERROR},
+ * {@link #DISPATCHER_FORWARD}, {@link #DISPATCHER_INCLUDE},
+ * {@link #DISPATCHER_REQUEST}.
+ *
+ * @see "Java Servlet Specification Version 3.0, Section 6.2.5 Filters and the RequestDispatcher"
+ */
+ public static final String HTTP_WHITEBOARD_FILTER_DISPATCHER = "osgi.http.whiteboard.filter.dispatcher";
+
+ /**
+ * Possible value for the {@link #HTTP_WHITEBOARD_FILTER_DISPATCHER}
+ * property indicating the filter is applied to client requests.
+ *
+ * @see "Java Servlet Specification Version 3.0, Section 6.2.5 Filters and the RequestDispatcher"
+ */
+ public static final String DISPATCHER_REQUEST = "REQUEST";
+
+ /**
+ * Possible value for the {@link #HTTP_WHITEBOARD_FILTER_DISPATCHER}
+ * property indicating the filter is applied to include calls to the
+ * dispatcher.
+ *
+ * @see "Java Servlet Specification Version 3.0, Section 6.2.5 Filters and the RequestDispatcher"
+ */
+ public static final String DISPATCHER_INCLUDE = "INCLUDE";
+
+ /**
+ * Possible value for the {@link #HTTP_WHITEBOARD_FILTER_DISPATCHER}
+ * property indicating the filter is applied to forward calls to the
+ * dispatcher.
+ *
+ * @see "Java Servlet Specification Version 3.0, Section 6.2.5 Filters and the RequestDispatcher"
+ */
+ public static final String DISPATCHER_FORWARD = "FORWARD";
+
+ /**
+ * Possible value for the {@link #HTTP_WHITEBOARD_FILTER_DISPATCHER}
+ * property indicating the filter is applied in the async context.
+ *
+ * @see "Java Servlet Specification Version 3.0, Section 6.2.5 Filters and the RequestDispatcher"
+ */
+ public static final String DISPATCHER_ASYNC = "ASYNC";
+
+ /**
+ * Possible value for the {@link #HTTP_WHITEBOARD_FILTER_DISPATCHER}
+ * property indicating the filter is applied when an error page is called.
+ *
+ * @see "Java Servlet Specification Version 3.0, Section 6.2.5 Filters and the RequestDispatcher"
+ */
+ public static final String DISPATCHER_ERROR = "ERROR";
+
+ /**
+ * Service property specifying the resource entry prefix for a
+ * {@link javax.servlet.Servlet} servlet service.
+ *
+ * <p>
+ * If a servlet service is registerd with this property, it is marked as a
+ * resource serving servlet serving bundle resources.
+ *
+ * <p>
+ * This prefix is used to map a requested resource to the bundle's entries.
+ * TODO do we distinguish between "/xyz" and "xyz"?
+ * <p>
+ * The value of this service property must be of type {@code String}.
+ */
+ public static final String HTTP_WHITEBOARD_RESOURCE_PREFIX = "osgi.http.whiteboard.resource.prefix";
+
+ /**
+ * Service property specifying the target filter to select the Http
+ * Whiteboard Service runtime to process the service.
+ *
+ * <p>
+ * An Http Whiteboard Service implementation can define any number of
+ * attributes which can be referenced by the target filter. The attributes
+ * should always include the
+ * {@link org.osgi.service.http.runtime.HttpServiceRuntimeConstants#HTTP_SERVICE_ENDPOINT_ATTRIBUTE
+ * osgi.http.endpoint} attribute if the endpoint information is known.
+ *
+ * <p>
+ * If this service property is not specified, then all Http Whiteboard
+ * Services can process the service.
+ *
+ * <p>
+ * The value of this service property must be of type {@code String} and be
+ * a valid {@link org.osgi.framework.Filter filter string}.
+ */
+ public static final String HTTP_WHITEBOARD_TARGET = "osgi.http.whiteboard.target";
+}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/whiteboard/package-info.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/whiteboard/package-info.java
new file mode 100644
index 000000000..ed71ba3bf
--- /dev/null
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/whiteboard/package-info.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) OSGi Alliance (2010, 2014). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Http Service Whiteboard Package Version 1.0.
+ *
+ * <p>
+ * Bundles wishing to use this package must list the package in the
+ * Import-Package header of the bundle's manifest. This package has two types of
+ * users: the consumers that use the API in this package and the providers that
+ * implement the API in this package.
+ *
+ * <p>
+ * Example import for consumers using the API in this package:
+ * <p>
+ * {@code Import-Package: org.osgi.service.http.whiteboard; version="[1.0,2.0)"}
+ * <p>
+ * Example import for providers implementing the API in this package:
+ * <p>
+ * {@code Import-Package: org.osgi.service.http.whiteboard; version="[1.0,1.1)"}
+ *
+ * @author $Id$
+ */
+
+@Version("1.0")
+package org.osgi.service.http.whiteboard;
+
+import org.osgi.annotation.versioning.Version;
+
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/whiteboard/packageinfo b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/whiteboard/packageinfo
new file mode 100644
index 000000000..7c8de0324
--- /dev/null
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/whiteboard/packageinfo
@@ -0,0 +1 @@
+version 1.0

Back to the top