Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Kaegi2006-09-28 16:14:09 +0000
committerSimon Kaegi2006-09-28 16:14:09 +0000
commit788e5fc2580c43595fd3fb2f89553ce9b95c2f0a (patch)
tree383129345d2f600d1b2d996c3bd2568e80d94d23
parent776557b9e400799f6003d387259959aa7f363d59 (diff)
downloadrt.equinox.bundles-788e5fc2580c43595fd3fb2f89553ce9b95c2f0a.tar.gz
rt.equinox.bundles-788e5fc2580c43595fd3fb2f89553ce9b95c2f0a.tar.xz
rt.equinox.bundles-788e5fc2580c43595fd3fb2f89553ce9b95c2f0a.zip
Adding the serverside eclipse projects to the main depot
-rw-r--r--bundles/org.eclipse.equinox.http.jetty5/META-INF/MANIFEST.MF16
-rw-r--r--bundles/org.eclipse.equinox.http.jetty5/build.properties4
-rw-r--r--bundles/org.eclipse.equinox.http.jetty5/src/org/eclipse/equinox/http/jetty/internal/Activator.java139
-rw-r--r--bundles/org.eclipse.equinox.http.jetty6/META-INF/MANIFEST.MF16
-rw-r--r--bundles/org.eclipse.equinox.http.jetty6/build.properties4
-rw-r--r--bundles/org.eclipse.equinox.http.jetty6/src/org/eclipse/equinox/http/jetty/internal/Activator.java139
-rw-r--r--bundles/org.eclipse.equinox.http.registry/.classpath7
-rw-r--r--bundles/org.eclipse.equinox.http.registry/.cvsignore1
-rw-r--r--bundles/org.eclipse.equinox.http.registry/.project28
-rw-r--r--bundles/org.eclipse.equinox.http.registry/.settings/org.eclipse.jdt.core.prefs258
-rw-r--r--bundles/org.eclipse.equinox.http.registry/.settings/org.eclipse.jdt.ui.prefs9
-rw-r--r--bundles/org.eclipse.equinox.http.registry/META-INF/MANIFEST.MF19
-rw-r--r--bundles/org.eclipse.equinox.http.registry/build.properties5
-rw-r--r--bundles/org.eclipse.equinox.http.registry/plugin.xml7
-rw-r--r--bundles/org.eclipse.equinox.http.registry/schema/httpcontexts.exsd125
-rw-r--r--bundles/org.eclipse.equinox.http.registry/schema/resources.exsd134
-rw-r--r--bundles/org.eclipse.equinox.http.registry/schema/servlets.exsd174
-rw-r--r--bundles/org.eclipse.equinox.http.registry/src/org/eclipse/equinox/http/registry/NamedHttpContextService.java32
-rw-r--r--bundles/org.eclipse.equinox.http.registry/src/org/eclipse/equinox/http/registry/internal/Activator.java81
-rw-r--r--bundles/org.eclipse.equinox.http.registry/src/org/eclipse/equinox/http/registry/internal/ExtensionPointTracker.java135
-rw-r--r--bundles/org.eclipse.equinox.http.registry/src/org/eclipse/equinox/http/registry/internal/HttpContextManager.java194
-rw-r--r--bundles/org.eclipse.equinox.http.registry/src/org/eclipse/equinox/http/registry/internal/HttpServiceTracker.java105
-rw-r--r--bundles/org.eclipse.equinox.http.registry/src/org/eclipse/equinox/http/registry/internal/ResourceManager.java84
-rw-r--r--bundles/org.eclipse.equinox.http.registry/src/org/eclipse/equinox/http/registry/internal/ServletManager.java160
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/.classpath7
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/.cvsignore1
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/.project28
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/.settings/org.eclipse.jdt.core.prefs253
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/.settings/org.eclipse.jdt.ui.prefs8
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/META-INF/MANIFEST.MF15
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/build.properties4
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/HttpServiceServlet.java73
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/Activator.java85
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/DefaultHttpContext.java41
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/HttpServiceFactory.java34
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/HttpServiceImpl.java83
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/HttpServletRequestAdaptor.java127
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/HttpSessionAdaptor.java92
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/ProxyContext.java36
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/ProxyServlet.java169
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/Registration.java57
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/RequestDispatcherAdaptor.java28
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/ResourceRegistration.java142
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/ServletConfigImpl.java53
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/ServletContextAdaptor.java187
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/ServletRegistration.java87
-rw-r--r--bundles/org.eclipse.equinox.http.servletbridge/.classpath7
-rw-r--r--bundles/org.eclipse.equinox.http.servletbridge/.cvsignore1
-rw-r--r--bundles/org.eclipse.equinox.http.servletbridge/.project28
-rw-r--r--bundles/org.eclipse.equinox.http.servletbridge/.settings/org.eclipse.jdt.core.prefs253
-rw-r--r--bundles/org.eclipse.equinox.http.servletbridge/.settings/org.eclipse.jdt.ui.prefs8
-rw-r--r--bundles/org.eclipse.equinox.http.servletbridge/META-INF/MANIFEST.MF15
-rw-r--r--bundles/org.eclipse.equinox.http.servletbridge/build.properties4
-rw-r--r--bundles/org.eclipse.equinox.http.servletbridge/src/org/eclipse/equinox/http/servletbridge/internal/Activator.java32
-rw-r--r--bundles/org.eclipse.equinox.servletbridge/.classpath7
-rw-r--r--bundles/org.eclipse.equinox.servletbridge/.cvsignore2
-rw-r--r--bundles/org.eclipse.equinox.servletbridge/.project28
-rw-r--r--bundles/org.eclipse.equinox.servletbridge/.settings/org.eclipse.jdt.core.prefs253
-rw-r--r--bundles/org.eclipse.equinox.servletbridge/.settings/org.eclipse.jdt.ui.prefs8
-rw-r--r--bundles/org.eclipse.equinox.servletbridge/META-INF/MANIFEST.MF12
-rw-r--r--bundles/org.eclipse.equinox.servletbridge/about.html24
-rw-r--r--bundles/org.eclipse.equinox.servletbridge/build.properties9
-rw-r--r--bundles/org.eclipse.equinox.servletbridge/scripts/webappBuilder.xml92
-rw-r--r--bundles/org.eclipse.equinox.servletbridge/src/org/eclipse/equinox/servletbridge/BridgeServlet.java222
-rw-r--r--bundles/org.eclipse.equinox.servletbridge/src/org/eclipse/equinox/servletbridge/FrameworkLauncher.java577
-rw-r--r--bundles/org.eclipse.equinox.servletbridge/templates/WEB-INF/eclipse/.eclipseproduct0
-rw-r--r--bundles/org.eclipse.equinox.servletbridge/templates/WEB-INF/eclipse/configuration/config.ini3
-rw-r--r--bundles/org.eclipse.equinox.servletbridge/templates/WEB-INF/eclipse/launch.ini9
-rw-r--r--bundles/org.eclipse.equinox.servletbridge/templates/WEB-INF/eclipse/plugins/org.eclipse.equinox.servletbridge.extensionbundle_3.2.0/META-INF/MANIFEST.MF9
-rw-r--r--bundles/org.eclipse.equinox.servletbridge/templates/WEB-INF/web.xml31
70 files changed, 5120 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.http.jetty5/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.http.jetty5/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..8f93581a2
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.jetty5/META-INF/MANIFEST.MF
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Jetty Http Service
+Bundle-SymbolicName: org.eclipse.equinox.http.jetty
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.equinox.http.jetty.internal.Activator
+Import-Package: javax.servlet;version="[2.4.0,2.5.0)",
+ javax.servlet.http;version="[2.4.0,2.5.0)",
+ org.eclipse.equinox.http.servlet;version="[1.0.0,2.0.0)",
+ org.mortbay.http;version="[5.1.0,6.0.0)",
+ org.mortbay.jetty.servlet;version="[5.1.0,6.0.0)",
+ org.mortbay.util;version="[5.1.0,6.0.0)",
+ org.osgi.framework;version="1.3.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.4,
+ CDC-1.0/Foundation-1.0,
+ J2SE-1.3
diff --git a/bundles/org.eclipse.equinox.http.jetty5/build.properties b/bundles/org.eclipse.equinox.http.jetty5/build.properties
new file mode 100644
index 000000000..34d2e4d2d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.jetty5/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/bundles/org.eclipse.equinox.http.jetty5/src/org/eclipse/equinox/http/jetty/internal/Activator.java b/bundles/org.eclipse.equinox.http.jetty5/src/org/eclipse/equinox/http/jetty/internal/Activator.java
new file mode 100644
index 000000000..b156cd039
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.jetty5/src/org/eclipse/equinox/http/jetty/internal/Activator.java
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * Copyright (c) 2006 Cognos Incorporated.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+
+package org.eclipse.equinox.http.jetty.internal;
+
+import java.io.File;
+import org.eclipse.equinox.http.servlet.HttpServiceServlet;
+import org.mortbay.http.*;
+import org.mortbay.jetty.servlet.ServletHandler;
+import org.mortbay.jetty.servlet.ServletHolder;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+ private HttpServer server;
+
+ public void start(BundleContext context) throws Exception {
+
+ server = new HttpServer();
+
+ SocketListener httpListener = createHttpListener(context);
+ if (httpListener != null)
+ server.addListener(httpListener);
+
+ SocketListener httpsListener = createHttpsListener(context);
+ if (httpsListener != null)
+ server.addListener(httpsListener);
+
+ ServletHandler servlets = new ServletHandler();
+ servlets.setAutoInitializeServlets(true);
+
+ ServletHolder holder = servlets.addServlet("/*", HttpServiceServlet.class.getName()); //$NON-NLS-1$
+ holder.setInitOrder(0);
+
+ HttpContext httpContext = createHttpContext(context);
+ httpContext.addHandler(servlets);
+
+ server.addContext(httpContext);
+ server.start();
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ server.stop();
+ }
+
+ private SocketListener createHttpListener(BundleContext context) {
+ int httpPort = 80;
+ String httpPortProperty = context.getProperty("org.osgi.service.http.port"); //$NON-NLS-1$
+ if (httpPortProperty != null) {
+ try {
+ httpPort = Integer.parseInt(httpPortProperty);
+ } catch (NumberFormatException e) {
+ //(log this) ignore and use default
+ }
+ }
+
+ if (httpPort < 1)
+ return null;
+
+ SocketListener listener = new SocketListener();
+ listener.setPort(httpPort);
+ return listener;
+ }
+
+ private SocketListener createHttpsListener(BundleContext context) {
+
+ String sslEnabled = context.getProperty("org.eclipse.equinox.http.jetty.ssl.enabled"); //$NON-NLS-1$
+ if (!Boolean.valueOf(sslEnabled).booleanValue())
+ return null;
+
+ int httpsPort = 443;
+ String httpsPortProperty = context.getProperty("org.osgi.service.http.port.secure"); //$NON-NLS-1$
+ if (httpsPortProperty != null) {
+ try {
+ httpsPort = Integer.parseInt(httpsPortProperty);
+ } catch (NumberFormatException e) {
+ //(log this) ignore and use default
+ }
+ }
+ if (httpsPort < 1)
+ return null;
+
+ SslListener listener = new SslListener();
+ listener.setPort(httpsPort);
+
+ String keyStore = context.getProperty("org.eclipse.equinox.http.jetty.ssl.keystore"); //$NON-NLS-1$
+ if (keyStore != null)
+ listener.setKeystore(keyStore);
+
+ String password = context.getProperty("org.eclipse.equinox.http.jetty.ssl.password"); //$NON-NLS-1$
+ if (password != null)
+ listener.setPassword(password);
+
+ String keyPassword = context.getProperty("org.eclipse.equinox.http.jetty.ssl.keypassword"); //$NON-NLS-1$
+ if (keyPassword != null)
+ listener.setKeyPassword(keyPassword);
+
+ String needClientAuth = context.getProperty("org.eclipse.equinox.http.jetty.ssl.needclientauth"); //$NON-NLS-1$
+ if (needClientAuth != null)
+ listener.setNeedClientAuth(Boolean.valueOf(needClientAuth).booleanValue());
+
+ String wantClientAuth = context.getProperty("org.eclipse.equinox.http.jetty.ssl.wantclientauth"); //$NON-NLS-1$
+ if (wantClientAuth != null)
+ listener.setWantClientAuth(Boolean.valueOf(wantClientAuth).booleanValue());
+
+ String protocol = context.getProperty("org.eclipse.equinox.http.jetty.ssl.protocol"); //$NON-NLS-1$
+ if (protocol != null)
+ listener.setProtocol(protocol);
+
+ String algorithm = context.getProperty("org.eclipse.equinox.http.jetty.ssl.algorithm"); //$NON-NLS-1$
+ if (algorithm != null)
+ listener.setAlgorithm(algorithm);
+
+ String keystoreType = context.getProperty("org.eclipse.equinox.http.jetty.ssl.keystoretype"); //$NON-NLS-1$
+ if (keystoreType != null)
+ listener.setKeystoreType(keystoreType);
+
+ return listener;
+ }
+
+ private HttpContext createHttpContext(BundleContext context) {
+ String contextPathProperty = context.getProperty("org.eclipse.equinox.http.jetty.contextPath"); //$NON-NLS-1$
+ if (contextPathProperty == null)
+ contextPathProperty = "/"; //$NON-NLS-1$
+ HttpContext httpContext = new HttpContext();
+ httpContext.setClassLoader(this.getClass().getClassLoader());
+ httpContext.setContextPath(contextPathProperty);
+ File jettyWorkDir = new File(context.getDataFile(""), "jettywork"); //$NON-NLS-1$ //$NON-NLS-2$
+ jettyWorkDir.mkdir();
+ httpContext.setTempDirectory(jettyWorkDir);
+
+ return httpContext;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.http.jetty6/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.http.jetty6/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..8f93581a2
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.jetty6/META-INF/MANIFEST.MF
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Jetty Http Service
+Bundle-SymbolicName: org.eclipse.equinox.http.jetty
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.equinox.http.jetty.internal.Activator
+Import-Package: javax.servlet;version="[2.4.0,2.5.0)",
+ javax.servlet.http;version="[2.4.0,2.5.0)",
+ org.eclipse.equinox.http.servlet;version="[1.0.0,2.0.0)",
+ org.mortbay.http;version="[5.1.0,6.0.0)",
+ org.mortbay.jetty.servlet;version="[5.1.0,6.0.0)",
+ org.mortbay.util;version="[5.1.0,6.0.0)",
+ org.osgi.framework;version="1.3.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.4,
+ CDC-1.0/Foundation-1.0,
+ J2SE-1.3
diff --git a/bundles/org.eclipse.equinox.http.jetty6/build.properties b/bundles/org.eclipse.equinox.http.jetty6/build.properties
new file mode 100644
index 000000000..34d2e4d2d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.jetty6/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/bundles/org.eclipse.equinox.http.jetty6/src/org/eclipse/equinox/http/jetty/internal/Activator.java b/bundles/org.eclipse.equinox.http.jetty6/src/org/eclipse/equinox/http/jetty/internal/Activator.java
new file mode 100644
index 000000000..b156cd039
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.jetty6/src/org/eclipse/equinox/http/jetty/internal/Activator.java
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * Copyright (c) 2006 Cognos Incorporated.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+
+package org.eclipse.equinox.http.jetty.internal;
+
+import java.io.File;
+import org.eclipse.equinox.http.servlet.HttpServiceServlet;
+import org.mortbay.http.*;
+import org.mortbay.jetty.servlet.ServletHandler;
+import org.mortbay.jetty.servlet.ServletHolder;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+ private HttpServer server;
+
+ public void start(BundleContext context) throws Exception {
+
+ server = new HttpServer();
+
+ SocketListener httpListener = createHttpListener(context);
+ if (httpListener != null)
+ server.addListener(httpListener);
+
+ SocketListener httpsListener = createHttpsListener(context);
+ if (httpsListener != null)
+ server.addListener(httpsListener);
+
+ ServletHandler servlets = new ServletHandler();
+ servlets.setAutoInitializeServlets(true);
+
+ ServletHolder holder = servlets.addServlet("/*", HttpServiceServlet.class.getName()); //$NON-NLS-1$
+ holder.setInitOrder(0);
+
+ HttpContext httpContext = createHttpContext(context);
+ httpContext.addHandler(servlets);
+
+ server.addContext(httpContext);
+ server.start();
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ server.stop();
+ }
+
+ private SocketListener createHttpListener(BundleContext context) {
+ int httpPort = 80;
+ String httpPortProperty = context.getProperty("org.osgi.service.http.port"); //$NON-NLS-1$
+ if (httpPortProperty != null) {
+ try {
+ httpPort = Integer.parseInt(httpPortProperty);
+ } catch (NumberFormatException e) {
+ //(log this) ignore and use default
+ }
+ }
+
+ if (httpPort < 1)
+ return null;
+
+ SocketListener listener = new SocketListener();
+ listener.setPort(httpPort);
+ return listener;
+ }
+
+ private SocketListener createHttpsListener(BundleContext context) {
+
+ String sslEnabled = context.getProperty("org.eclipse.equinox.http.jetty.ssl.enabled"); //$NON-NLS-1$
+ if (!Boolean.valueOf(sslEnabled).booleanValue())
+ return null;
+
+ int httpsPort = 443;
+ String httpsPortProperty = context.getProperty("org.osgi.service.http.port.secure"); //$NON-NLS-1$
+ if (httpsPortProperty != null) {
+ try {
+ httpsPort = Integer.parseInt(httpsPortProperty);
+ } catch (NumberFormatException e) {
+ //(log this) ignore and use default
+ }
+ }
+ if (httpsPort < 1)
+ return null;
+
+ SslListener listener = new SslListener();
+ listener.setPort(httpsPort);
+
+ String keyStore = context.getProperty("org.eclipse.equinox.http.jetty.ssl.keystore"); //$NON-NLS-1$
+ if (keyStore != null)
+ listener.setKeystore(keyStore);
+
+ String password = context.getProperty("org.eclipse.equinox.http.jetty.ssl.password"); //$NON-NLS-1$
+ if (password != null)
+ listener.setPassword(password);
+
+ String keyPassword = context.getProperty("org.eclipse.equinox.http.jetty.ssl.keypassword"); //$NON-NLS-1$
+ if (keyPassword != null)
+ listener.setKeyPassword(keyPassword);
+
+ String needClientAuth = context.getProperty("org.eclipse.equinox.http.jetty.ssl.needclientauth"); //$NON-NLS-1$
+ if (needClientAuth != null)
+ listener.setNeedClientAuth(Boolean.valueOf(needClientAuth).booleanValue());
+
+ String wantClientAuth = context.getProperty("org.eclipse.equinox.http.jetty.ssl.wantclientauth"); //$NON-NLS-1$
+ if (wantClientAuth != null)
+ listener.setWantClientAuth(Boolean.valueOf(wantClientAuth).booleanValue());
+
+ String protocol = context.getProperty("org.eclipse.equinox.http.jetty.ssl.protocol"); //$NON-NLS-1$
+ if (protocol != null)
+ listener.setProtocol(protocol);
+
+ String algorithm = context.getProperty("org.eclipse.equinox.http.jetty.ssl.algorithm"); //$NON-NLS-1$
+ if (algorithm != null)
+ listener.setAlgorithm(algorithm);
+
+ String keystoreType = context.getProperty("org.eclipse.equinox.http.jetty.ssl.keystoretype"); //$NON-NLS-1$
+ if (keystoreType != null)
+ listener.setKeystoreType(keystoreType);
+
+ return listener;
+ }
+
+ private HttpContext createHttpContext(BundleContext context) {
+ String contextPathProperty = context.getProperty("org.eclipse.equinox.http.jetty.contextPath"); //$NON-NLS-1$
+ if (contextPathProperty == null)
+ contextPathProperty = "/"; //$NON-NLS-1$
+ HttpContext httpContext = new HttpContext();
+ httpContext.setClassLoader(this.getClass().getClassLoader());
+ httpContext.setContextPath(contextPathProperty);
+ File jettyWorkDir = new File(context.getDataFile(""), "jettywork"); //$NON-NLS-1$ //$NON-NLS-2$
+ jettyWorkDir.mkdir();
+ httpContext.setTempDirectory(jettyWorkDir);
+
+ return httpContext;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.http.registry/.classpath b/bundles/org.eclipse.equinox.http.registry/.classpath
new file mode 100644
index 000000000..ce7393340
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.registry/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.equinox.http.registry/.cvsignore b/bundles/org.eclipse.equinox.http.registry/.cvsignore
new file mode 100644
index 000000000..ba077a403
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.registry/.cvsignore
@@ -0,0 +1 @@
+bin
diff --git a/bundles/org.eclipse.equinox.http.registry/.project b/bundles/org.eclipse.equinox.http.registry/.project
new file mode 100644
index 000000000..b05bbea7d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.registry/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.equinox.http.registry</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.equinox.http.registry/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.http.registry/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..f36d473bb
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.registry/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,258 @@
+#Thu Sep 28 11:27:11 EDT 2006
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.1
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.3
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=ignore
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=ignore
+org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines=false
+org.eclipse.jdt.core.formatter.comment.format_comments=false
+org.eclipse.jdt.core.formatter.comment.format_header=true
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=800
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
diff --git a/bundles/org.eclipse.equinox.http.registry/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.http.registry/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 000000000..cd04d82f8
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.registry/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,9 @@
+#Thu Sep 28 11:27:15 EDT 2006
+eclipse.preferences.version=1
+formatter_profile=_core
+formatter_settings_version=10
+internal.default.compliance=default
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=;
+org.eclipse.jdt.ui.ondemandthreshold=3
+org.eclipse.jdt.ui.staticondemandthreshold=3
diff --git a/bundles/org.eclipse.equinox.http.registry/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.http.registry/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..5c4d22ac1
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.registry/META-INF/MANIFEST.MF
@@ -0,0 +1,19 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Http Service Registry Extensions
+Bundle-SymbolicName: org.eclipse.equinox.http.registry;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.equinox.http.registry.internal.Activator
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.equinox.common,
+ org.eclipse.equinox.registry
+Import-Package: javax.servlet;version="[2.3.0,2.5.0)",
+ javax.servlet.http;version="[2.3.0,2.5.0)",
+ org.osgi.framework,
+ org.osgi.service.http;version="1.2.0",
+ org.osgi.service.packageadmin,
+ org.osgi.util.tracker
+Bundle-RequiredExecutionEnvironment: J2SE-1.4,
+ CDC-1.0/Foundation-1.0,
+ J2SE-1.3
+Export-Package: org.eclipse.equinox.http.registry
diff --git a/bundles/org.eclipse.equinox.http.registry/build.properties b/bundles/org.eclipse.equinox.http.registry/build.properties
new file mode 100644
index 000000000..e9863e281
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.registry/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
diff --git a/bundles/org.eclipse.equinox.http.registry/plugin.xml b/bundles/org.eclipse.equinox.http.registry/plugin.xml
new file mode 100644
index 000000000..8dedc5c10
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.registry/plugin.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+ <extension-point id="servlets" name="HttpService servlets" schema="schema/servlets.exsd"/>
+ <extension-point id="resources" name="HttpService resources" schema="schema/resources.exsd"/>
+ <extension-point id="httpcontexts" name="HttpService httpcontexts" schema="schema/httpcontexts.exsd"/>
+</plugin>
diff --git a/bundles/org.eclipse.equinox.http.registry/schema/httpcontexts.exsd b/bundles/org.eclipse.equinox.http.registry/schema/httpcontexts.exsd
new file mode 100644
index 000000000..8d9ff3c1a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.registry/schema/httpcontexts.exsd
@@ -0,0 +1,125 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.equinox.http.registry">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.equinox.http.registry" id="httpcontexts" name="Http Service Httpcontexts"/>
+ </appInfo>
+ <documentation>
+ Provides an OSGi Http Service HttpContext identified by a name. Any httpcontext extension declared with the same name will share the same single instance of the Httpcontext.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="httpcontext"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="httpcontext">
+ <complexType>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ The name of the Httpcontext instance. Httpcontexts extensions that share the same name will share the same instance and availability of resources.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="path" type="string">
+ <annotation>
+ <documentation>
+ The bundle path where resources can be loaded from.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 3.2
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ The following is an example of the &lt;code&gt;httpcontexts&lt;/code&gt; extension:
+&lt;pre&gt;
+ &lt;extension
+ id=&quot;testHttpcontext&quot;
+ point=&quot;org.eclipse.equinox.http.registry.httpcontexts&quot;&gt;
+ &lt;httpcontext
+ name=&quot;testintest&quot;
+ path=&quot;/test&quot;/&gt;
+ &lt;/extension&gt;
+&lt;/pre&gt;
+
+This httpcontexts extension will make resources in &quot;/test&quot; accessible via the OSGi Http Service&apos;s HttpContext getResource method.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ No Java code is requied for this extension point.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2006 Cognos Incorporated and others.
+&lt;br&gt;
+All rights reserved. This program and the accompanying materials are made
+available under the terms of the Eclipse Public License v1.0 which
+accompanies this distribution, and is available at
+&lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;.
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/bundles/org.eclipse.equinox.http.registry/schema/resources.exsd b/bundles/org.eclipse.equinox.http.registry/schema/resources.exsd
new file mode 100644
index 000000000..c31e13ce6
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.registry/schema/resources.exsd
@@ -0,0 +1,134 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.equinox.http.registry">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.equinox.http.registry" id="resources" name="Http Service Resources"/>
+ </appInfo>
+ <documentation>
+ This extension mimics and borrows the symantics of the OSGi HttpService registerResource method.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="resource"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="resource">
+ <complexType>
+ <attribute name="alias" type="string" use="required">
+ <annotation>
+ <documentation>
+ The equivalent of the OSGi Http Services &quot;alias&quot; in registerResource.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="base-name" type="string">
+ <annotation>
+ <documentation>
+ The equivalent of the OSGi Http Services &quot;name&quot; in registerResource.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="httpcontext-name" type="string">
+ <annotation>
+ <documentation>
+ The equivalent of the OSGi Http Services httpcontext in registerResource. The httpcontext-name is matched against the &quot;httpcontexts&quot; extension for a matching name. If this attribute is not provided the OSGi Http Service&apos;s DefaultHttpContext semantics are used.
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 3.2
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ The following is an example of the &lt;code&gt;resources&lt;/code&gt; extension:
+&lt;pre&gt;
+ &lt;extension
+ id=&quot;testResource&quot;
+ point=&quot;org.eclipse.equinox.http.registry.resources&quot;&gt;
+ &lt;resource
+ alias=&quot;/testresource&quot;
+ base-name=&quot;/test&quot;
+ httpcontext-name=&quot;testintest&quot;/&gt;
+ &lt;/extension&gt;
+&lt;/pre&gt;
+
+This equivalent to the OSGi Http Service&apos;s registerResource method.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ No Java code is requied for this extension point.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2006 Cognos Incorporated and others.
+&lt;br&gt;
+All rights reserved. This program and the accompanying materials are made
+available under the terms of the Eclipse Public License v1.0 which
+accompanies this distribution, and is available at
+&lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;.
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/bundles/org.eclipse.equinox.http.registry/schema/servlets.exsd b/bundles/org.eclipse.equinox.http.registry/schema/servlets.exsd
new file mode 100644
index 000000000..b74ce62a6
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.registry/schema/servlets.exsd
@@ -0,0 +1,174 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.equinox.http.registry">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.equinox.http.registry" id="servlets" name="Http Service Servlets"/>
+ </appInfo>
+ <documentation>
+ This extension mimics and borrows the semantics of the OSGi HttpService registerServlet method.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="servlet"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="servlet">
+ <complexType>
+ <sequence>
+ <element ref="init-param" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ The equivalent of the OSGi Http Services &quot;servlet&quot; in registerServlet. The Servlet is instantiated by the Extension Point provider and must be an instance of javax.servlet.Servlet
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="javax.servlet.Servlet"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="alias" type="string" use="required">
+ <annotation>
+ <documentation>
+ The equivalent of the OSGi Http Services &quot;alias&quot; in registerServlet.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="httpcontext-name" type="string">
+ <annotation>
+ <documentation>
+ The equivalent of the OSGi Http Services httpcontext in registerServlet. The httpcontext-name is matched against the &quot;httpcontexts&quot; extension for a matching name. If this attribute is not provided the OSGi Http Service&apos;s DefaultHttpContext semantics are used.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="load-on-startup" type="boolean">
+ <annotation>
+ <documentation>
+ Determines if the Servlet should be initialized immediately.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="init-param">
+ <annotation>
+ <documentation>
+ Similar to the Servlet Specification and its deployment descriptor&apos;s init-param elements.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="value" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 3.2
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ The following is an example of the &lt;code&gt;servlets&lt;/code&gt; extension:
+&lt;pre&gt;
+ &lt;extension
+ id=&quot;testServlet&quot;
+ point=&quot;org.eclipse.equinox.http.registry.servlets&quot;&gt;
+ &lt;servlet
+ alias=&quot;/sp_test&quot;
+ class=&quot;org.eclipse.equinox.http.registry.internal.TestServlet&quot;&gt;
+ &lt;init-param
+ name=&quot;testParam&quot;
+ value=&quot;test param value&quot;&gt;
+ &lt;/init-param&gt;
+ &lt;/servlet&gt;
+ &lt;/extension&gt;
+&lt;/pre&gt;
+
+This equivalent to the OSGi Http Service&apos;s registerServlet method.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ Servlets must be an instance of javax.servlet.Servlet
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2006 Cognos Incorporated and others.
+&lt;br&gt;
+All rights reserved. This program and the accompanying materials are made
+available under the terms of the Eclipse Public License v1.0 which
+accompanies this distribution, and is available at
+&lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;.
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/bundles/org.eclipse.equinox.http.registry/src/org/eclipse/equinox/http/registry/NamedHttpContextService.java b/bundles/org.eclipse.equinox.http.registry/src/org/eclipse/equinox/http/registry/NamedHttpContextService.java
new file mode 100644
index 000000000..dec7ee01d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.registry/src/org/eclipse/equinox/http/registry/NamedHttpContextService.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2006 Cognos Incorporated.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cognos Incorporated - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.http.registry;
+
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.http.HttpContext;
+
+/**
+ * The NamedHttpContextService provides access to an HttpContext instance whose resources are added
+ * via the "httpcontexts" extension point.
+ */
+public interface NamedHttpContextService {
+ /**
+ * returns the HttpContext associated with the HttpService reference and http context name
+ *
+ * @param httpServiceReference The ServiceReference of the http service to which this HttpContext applies
+ * @param httpContextName The name of the HttpContext. Must be provided
+ *
+ * @return The HttpContext associated with the "name" and Http Service Reference; <code>null</code>
+ * if the ServiceReference is invalid, no longer being tracked.
+ */
+ public HttpContext getNamedHttpContext(ServiceReference httpServiceReference, String httpContextName);
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.http.registry/src/org/eclipse/equinox/http/registry/internal/Activator.java b/bundles/org.eclipse.equinox.http.registry/src/org/eclipse/equinox/http/registry/internal/Activator.java
new file mode 100644
index 000000000..41a2c049b
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.registry/src/org/eclipse/equinox/http/registry/internal/Activator.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2005 Cognos Incorporated.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cognos Incorporated - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.http.registry.internal;
+
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.osgi.framework.*;
+import org.osgi.service.packageadmin.PackageAdmin;
+import org.osgi.util.tracker.ServiceTracker;
+import org.osgi.util.tracker.ServiceTrackerCustomizer;
+
+public class Activator implements BundleActivator, ServiceTrackerCustomizer {
+
+ private ServiceTracker httpServiceTracker;
+ private ServiceTracker packageAdminTracker;
+ private ServiceTracker registryTracker;
+
+ private PackageAdmin packageAdmin;
+ private IExtensionRegistry registry;
+ private BundleContext context;
+
+ public void start(BundleContext context) throws Exception {
+ this.context = context;
+ packageAdminTracker = new ServiceTracker(context, PackageAdmin.class.getName(), this);
+ packageAdminTracker.open();
+
+ registryTracker = new ServiceTracker(context, IExtensionRegistry.class.getName(), this);
+ registryTracker.open();
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ packageAdminTracker.close();
+ registryTracker.close();
+ }
+
+ public Object addingService(ServiceReference reference) {
+ Object service = context.getService(reference);
+
+ if (service instanceof PackageAdmin && packageAdmin == null)
+ packageAdmin = (PackageAdmin) service;
+
+ if (service instanceof IExtensionRegistry && registry == null)
+ registry = (IExtensionRegistry) service;
+
+ if (packageAdmin != null && registry != null) {
+ httpServiceTracker = new HttpServiceTracker(context, packageAdmin, registry);
+ httpServiceTracker.open();
+ }
+
+ return service;
+ }
+
+ public void modifiedService(ServiceReference reference, Object service) {
+ // ignore
+ }
+
+ public void removedService(ServiceReference reference, Object service) {
+ if (service == packageAdmin)
+ packageAdmin = null;
+
+ if (service == registry)
+ registry = null;
+
+ if (packageAdmin == null || registry == null) {
+ if (httpServiceTracker != null) {
+ httpServiceTracker.close();
+ httpServiceTracker = null;
+ }
+ }
+ context.ungetService(reference);
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.http.registry/src/org/eclipse/equinox/http/registry/internal/ExtensionPointTracker.java b/bundles/org.eclipse.equinox.http.registry/src/org/eclipse/equinox/http/registry/internal/ExtensionPointTracker.java
new file mode 100644
index 000000000..27e88213a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.registry/src/org/eclipse/equinox/http/registry/internal/ExtensionPointTracker.java
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (c) 2005 Cognos Incorporated.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cognos Incorporated - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.http.registry.internal;
+
+import java.util.*;
+import org.eclipse.core.runtime.*;
+
+public class ExtensionPointTracker {
+ public interface Listener {
+ public void added(IExtension extension);
+
+ public void removed(IExtension extension);
+ }
+
+ private static final Listener NULL_LISTENER = new Listener() {
+ public void added(IExtension extension) {
+ }
+
+ public void removed(IExtension extension) {
+ }
+ };
+
+ private final IExtensionRegistry registry;
+ private final String extensionPointId;
+ final String namespace;
+ final String simpleIdentifier;
+ private final Set extensionCache = new HashSet();
+ protected final Listener listener;
+ private final RegistryChangeListener registryChangeListener = new RegistryChangeListener();
+ private boolean closed = true;
+
+ public ExtensionPointTracker(IExtensionRegistry registry, String extensionPointId, Listener listener) {
+ this.registry = registry;
+ this.extensionPointId = extensionPointId;
+ this.listener = (listener != null) ? listener : NULL_LISTENER;
+
+ if (extensionPointId == null || -1 == extensionPointId.indexOf('.'))
+ throw new IllegalArgumentException("Unexpected Extension Point Identifier: " + extensionPointId); //$NON-NLS-1$
+ int lastDotIndex = extensionPointId.lastIndexOf('.');
+ namespace = extensionPointId.substring(0, lastDotIndex);
+ simpleIdentifier = extensionPointId.substring(lastDotIndex + 1);
+ }
+
+ public void open() {
+ IExtension[] extensions = null;
+ synchronized (this) {
+ if (!closed) {
+ return;
+ }
+ registry.addRegistryChangeListener(registryChangeListener, namespace);
+ try {
+ IExtensionPoint point = registry.getExtensionPoint(extensionPointId);
+ if (point != null) {
+ extensions = point.getExtensions();
+ extensionCache.addAll(Arrays.asList(extensions));
+ }
+ closed = false;
+ } catch (InvalidRegistryObjectException e) {
+ registry.removeRegistryChangeListener(registryChangeListener);
+ throw e;
+ }
+ }
+ if (extensions != null) {
+ for (int i = 0; i < extensions.length; ++i) {
+ listener.added(extensions[i]);
+ }
+ }
+ }
+
+ public void close() {
+ IExtension[] extensions = null;
+ synchronized (this) {
+ if (closed) {
+ return;
+ }
+ closed = true;
+ registry.removeRegistryChangeListener(registryChangeListener);
+ extensions = this.getExtensions();
+ extensionCache.clear();
+ }
+ for (int i = 0; i < extensions.length; ++i) {
+ listener.removed(extensions[i]);
+ }
+ }
+
+ synchronized boolean removeExtension(IExtension extension) {
+ if (closed) {
+ return false;
+ }
+ return extensionCache.remove(extension);
+ }
+
+ synchronized boolean addExtension(IExtension extension) {
+ if (closed) {
+ return false;
+ }
+ return extensionCache.add(extension);
+ }
+
+ public synchronized IExtension[] getExtensions() {
+ return (IExtension[]) extensionCache.toArray(new IExtension[extensionCache.size()]);
+ }
+
+ class RegistryChangeListener implements IRegistryChangeListener {
+ public void registryChanged(IRegistryChangeEvent event) {
+ IExtensionDelta[] deltas = event.getExtensionDeltas(namespace, simpleIdentifier);
+ for (int i = 0; i < deltas.length; ++i) {
+ IExtensionDelta delta = deltas[i];
+ IExtension extension = delta.getExtension();
+ switch (delta.getKind()) {
+ case IExtensionDelta.ADDED :
+ if (addExtension(extension)) {
+ listener.added(extension);
+ }
+ break;
+ case IExtensionDelta.REMOVED :
+ if (removeExtension(extension)) {
+ listener.removed(extension);
+ }
+ default :
+ break;
+ }
+ }
+ }
+ }
+}
diff --git a/bundles/org.eclipse.equinox.http.registry/src/org/eclipse/equinox/http/registry/internal/HttpContextManager.java b/bundles/org.eclipse.equinox.http.registry/src/org/eclipse/equinox/http/registry/internal/HttpContextManager.java
new file mode 100644
index 000000000..48fdbb462
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.registry/src/org/eclipse/equinox/http/registry/internal/HttpContextManager.java
@@ -0,0 +1,194 @@
+/*******************************************************************************
+ * Copyright (c) 2005 Cognos Incorporated.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cognos Incorporated - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.http.registry.internal;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.*;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.eclipse.core.runtime.*;
+import org.osgi.framework.Bundle;
+import org.osgi.service.http.HttpContext;
+import org.osgi.service.http.HttpService;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+public class HttpContextManager {
+
+ private static final String HTTPCONTEXTS_EXTENSION_POINT = "org.eclipse.equinox.http.registry.httpcontexts"; //$NON-NLS-1$
+
+ private Map contextsMap = new HashMap();
+
+ HttpService httpService;
+
+ ExtensionPointTracker tracker;
+
+ PackageAdmin packageAdmin;
+
+ public HttpContextManager(HttpService httpService, PackageAdmin packageAdmin, IExtensionRegistry registry) {
+ this.httpService = httpService;
+ this.packageAdmin = packageAdmin;
+ tracker = new ExtensionPointTracker(registry, HTTPCONTEXTS_EXTENSION_POINT, null);
+ }
+
+ public HttpContext getDefaultHttpContext(String bundleName) {
+ return new DefaultHttpContextImpl(getBundle(bundleName));
+ }
+
+ public synchronized HttpContext getHttpContext(String httpContextName) {
+ HttpContext context = (HttpContext) contextsMap.get(httpContextName);
+ if (context == null) {
+ context = new HttpContextImpl(httpContextName);
+ contextsMap.put(httpContextName, context);
+ }
+ return context;
+ }
+
+ public void start() {
+ tracker.open();
+ }
+
+ public void stop() {
+ tracker.close();
+ synchronized (this) {
+ contextsMap.clear();
+ }
+ }
+
+ private Bundle getBundle(String symbolicName) {
+ Bundle[] bundles = packageAdmin.getBundles(symbolicName, null);
+ if (bundles == null)
+ return null;
+ //Return the first bundle that is not installed or uninstalled
+ for (int i = 0; i < bundles.length; i++) {
+ if ((bundles[i].getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) {
+ return bundles[i];
+ }
+ }
+ return null;
+ }
+
+ private class DefaultHttpContextImpl implements HttpContext {
+ private Bundle bundle;
+ private HttpContext delegate;
+
+ public DefaultHttpContextImpl(Bundle bundle) {
+ this.bundle = bundle;
+ delegate = httpService.createDefaultHttpContext();
+ }
+
+ public String getMimeType(String arg0) {
+ return delegate.getMimeType(arg0);
+ }
+
+ public boolean handleSecurity(HttpServletRequest arg0, HttpServletResponse arg1) throws IOException {
+ return delegate.handleSecurity(arg0, arg1);
+ }
+
+ public URL getResource(String resourceName) {
+ return bundle.getEntry(resourceName);
+ }
+
+ public Set getResourcePaths(String path) {
+ Enumeration entryPaths = bundle.getEntryPaths(path);
+ if (entryPaths == null)
+ return null;
+
+ Set result = new HashSet();
+ while (entryPaths.hasMoreElements())
+ result.add(entryPaths.nextElement());
+ return result;
+ }
+ }
+
+ private class HttpContextImpl implements HttpContext {
+
+ private static final String PATH = "path"; //$NON-NLS-1$
+
+ private static final String HTTPCONTEXT = "httpcontext"; //$NON-NLS-1$
+
+ private static final String NAME = "name"; //$NON-NLS-1$
+
+ private HttpContext delegate;
+
+ private String contextName;
+
+ public HttpContextImpl(String contextName) {
+ this.contextName = contextName;
+ delegate = httpService.createDefaultHttpContext();
+ }
+
+ public boolean handleSecurity(HttpServletRequest request, HttpServletResponse response) throws IOException {
+ return delegate.handleSecurity(request, response);
+ }
+
+ public URL getResource(String resourceName) {
+ IExtension[] extensions = tracker.getExtensions();
+ for (int i = 0; i < extensions.length; i++) {
+ IConfigurationElement[] elements = extensions[i].getConfigurationElements();
+ if (elements.length != 1 || !HTTPCONTEXT.equals(elements[0].getName()))
+ continue;
+
+ IConfigurationElement httpContextElement = elements[0];
+ String httpContextName = httpContextElement.getAttribute(NAME);
+ String path = httpContextElement.getAttribute(PATH);
+
+ if (httpContextName.equals(contextName)) {
+ Bundle b = getBundle(extensions[i].getContributor().getName());
+ if (path.endsWith("/")) { //$NON-NLS-1$
+ path = path.substring(0, path.length() - 1);
+ }
+
+ URL url = b.getEntry(path + resourceName);
+ if (url != null) {
+ return url;
+ }
+ }
+ }
+ return null;
+ }
+
+ public Set getResourcePaths(String resourcePath) {
+ Set result = null;
+ IExtension[] extensions = tracker.getExtensions();
+ for (int i = 0; i < extensions.length; i++) {
+ IConfigurationElement[] elements = extensions[i].getConfigurationElements();
+ if (elements.length != 1 || !HTTPCONTEXT.equals(elements[0].getName()))
+ continue;
+
+ IConfigurationElement httpContextElement = elements[0];
+ String httpContextName = httpContextElement.getAttribute(NAME);
+ String path = httpContextElement.getAttribute(PATH);
+
+ if (httpContextName.equals(contextName)) {
+ Bundle b = getBundle(extensions[i].getContributor().getName());
+ if (path.endsWith("/")) { //$NON-NLS-1$
+ path = path.substring(0, path.length() - 1);
+ }
+
+ Enumeration entryPaths = b.getEntryPaths(path + resourcePath);
+ if (entryPaths != null) {
+ if (result == null)
+ result = new HashSet();
+ while (entryPaths.hasMoreElements())
+ result.add(entryPaths.nextElement());
+ }
+ }
+ }
+ return result;
+ }
+
+ public String getMimeType(String name) {
+ return delegate.getMimeType(name);
+ }
+ }
+}
diff --git a/bundles/org.eclipse.equinox.http.registry/src/org/eclipse/equinox/http/registry/internal/HttpServiceTracker.java b/bundles/org.eclipse.equinox.http.registry/src/org/eclipse/equinox/http/registry/internal/HttpServiceTracker.java
new file mode 100644
index 000000000..cbafa8ed3
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.registry/src/org/eclipse/equinox/http/registry/internal/HttpServiceTracker.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2005 Cognos Incorporated.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cognos Incorporated - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.http.registry.internal;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.equinox.http.registry.NamedHttpContextService;
+import org.osgi.framework.*;
+import org.osgi.service.http.HttpContext;
+import org.osgi.service.http.HttpService;
+import org.osgi.service.packageadmin.PackageAdmin;
+import org.osgi.util.tracker.ServiceTracker;
+
+public class HttpServiceTracker extends ServiceTracker {
+
+ private BundleContext context;
+ private PackageAdmin packageAdmin;
+ private IExtensionRegistry registry;
+
+ private Map httpContextManagers = new HashMap();
+ private Map servletManagers = new HashMap();
+ private Map resourceManagers = new HashMap();
+ private ServiceRegistration registration;
+
+ public HttpServiceTracker(BundleContext context, PackageAdmin packageAdmin, IExtensionRegistry registry) {
+ super(context, HttpService.class.getName(), null);
+ this.context = context;
+ this.packageAdmin = packageAdmin;
+ this.registry = registry;
+ }
+
+ public void open() {
+ super.open();
+ registration = context.registerService(NamedHttpContextService.class.getName(), new NamedHttpContextServiceImpl(), null);
+ }
+
+ public void close() {
+ registration.unregister();
+ registration = null;
+ super.close();
+ }
+
+ public synchronized Object addingService(ServiceReference reference) {
+ HttpService httpService = (HttpService) context.getService(reference);
+
+ HttpContextManager httpContextManager = new HttpContextManager(httpService, packageAdmin, registry);
+ httpContextManager.start();
+ httpContextManagers.put(reference, httpContextManager);
+
+ ServletManager servletManager = new ServletManager(httpService, httpContextManager, registry);
+ servletManager.start();
+ servletManagers.put(reference, servletManager);
+
+ ResourceManager resourceManager = new ResourceManager(httpService, httpContextManager, registry);
+ resourceManager.start();
+ resourceManagers.put(reference, resourceManager);
+
+ return httpService;
+ }
+
+ public void modifiedService(ServiceReference reference, Object service) {
+ // ignored
+ }
+
+ public synchronized void removedService(ServiceReference reference, Object service) {
+ HttpContextManager httpContextManager = (HttpContextManager) httpContextManagers.remove(reference);
+ if (httpContextManager != null) {
+ httpContextManager.stop();
+ }
+
+ ServletManager servletManager = (ServletManager) servletManagers.remove(reference);
+ if (servletManager != null) {
+ servletManager.stop();
+ }
+
+ ResourceManager resourceManager = (ResourceManager) resourceManagers.remove(reference);
+ if (resourceManager != null) {
+ resourceManager.stop();
+ }
+ super.removedService(reference, service);
+ }
+
+ public class NamedHttpContextServiceImpl implements NamedHttpContextService {
+
+ public HttpContext getNamedHttpContext(ServiceReference httpServiceReference, String httpContextName) {
+ synchronized (HttpServiceTracker.this) {
+ HttpContextManager httpContextManager = (HttpContextManager) httpContextManagers.get(httpServiceReference);
+ if (httpContextManager == null)
+ return null;
+
+ return httpContextManager.getHttpContext(httpContextName);
+ }
+ }
+ }
+}
diff --git a/bundles/org.eclipse.equinox.http.registry/src/org/eclipse/equinox/http/registry/internal/ResourceManager.java b/bundles/org.eclipse.equinox.http.registry/src/org/eclipse/equinox/http/registry/internal/ResourceManager.java
new file mode 100644
index 000000000..bb51fe844
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.registry/src/org/eclipse/equinox/http/registry/internal/ResourceManager.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2005 Cognos Incorporated.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cognos Incorporated - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.http.registry.internal;
+
+import org.eclipse.core.runtime.*;
+import org.osgi.service.http.*;
+
+public class ResourceManager implements ExtensionPointTracker.Listener {
+
+ private static final String RESOURCES_EXTENSION_POINT = "org.eclipse.equinox.http.registry.resources"; //$NON-NLS-1$
+
+ private static final String HTTPCONTEXT_NAME = "httpcontext-name"; //$NON-NLS-1$
+
+ private static final String BASE_NAME = "base-name"; //$NON-NLS-1$
+
+ private static final String ALIAS = "alias"; //$NON-NLS-1$
+
+ private static final String RESOURCE = "resource"; //$NON-NLS-1$
+
+ private HttpService httpService;
+
+ private ExtensionPointTracker tracker;
+
+ private HttpContextManager httpContextManager;
+
+ public ResourceManager(HttpService httpService, HttpContextManager httpContextManager, IExtensionRegistry registry) {
+ this.httpService = httpService;
+ this.httpContextManager = httpContextManager;
+ tracker = new ExtensionPointTracker(registry, RESOURCES_EXTENSION_POINT, this);
+ }
+
+ public void start() {
+ tracker.open();
+ }
+
+ public void stop() {
+ tracker.close();
+ }
+
+ public void added(IExtension extension) {
+ IConfigurationElement[] elements = extension.getConfigurationElements();
+ if (elements.length != 1 || !RESOURCE.equals(elements[0].getName()))
+ return;
+
+ IConfigurationElement resourceElement = elements[0];
+ String alias = resourceElement.getAttribute(ALIAS);
+ String baseName = resourceElement.getAttribute(BASE_NAME);
+ if (baseName == null)
+ baseName = ""; //$NON-NLS-1$
+
+ String httpContextName = resourceElement.getAttribute(HTTPCONTEXT_NAME);
+ HttpContext context = null;
+ if (httpContextName == null)
+ context = httpContextManager.getDefaultHttpContext(extension.getContributor().getName());
+ else
+ context = httpContextManager.getHttpContext(httpContextName);
+
+ try {
+ httpService.registerResources(alias, baseName, context);
+ } catch (NamespaceException e) {
+ // TODO Should log this perhaps with the LogService?
+ e.printStackTrace();
+ }
+ }
+
+ public void removed(IExtension extension) {
+ IConfigurationElement[] elements = extension.getConfigurationElements();
+ if (elements.length != 1 || !RESOURCE.equals(elements[0].getName()))
+ return;
+
+ IConfigurationElement resourceElement = elements[0];
+ String alias = resourceElement.getAttribute(ALIAS);
+ httpService.unregister(alias);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.http.registry/src/org/eclipse/equinox/http/registry/internal/ServletManager.java b/bundles/org.eclipse.equinox.http.registry/src/org/eclipse/equinox/http/registry/internal/ServletManager.java
new file mode 100644
index 000000000..85714556f
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.registry/src/org/eclipse/equinox/http/registry/internal/ServletManager.java
@@ -0,0 +1,160 @@
+/*******************************************************************************
+ * Copyright (c) 2005 Cognos Incorporated.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cognos Incorporated - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.http.registry.internal;
+
+import java.io.IOException;
+import java.util.Dictionary;
+import java.util.Hashtable;
+import javax.servlet.*;
+import org.eclipse.core.runtime.*;
+import org.osgi.service.http.*;
+
+public class ServletManager implements ExtensionPointTracker.Listener {
+
+ private static final String SERVLETS_EXTENSION_POINT = "org.eclipse.equinox.http.registry.servlets"; //$NON-NLS-1$
+
+ private static final String HTTPCONTEXT_NAME = "httpcontext-name"; //$NON-NLS-1$
+
+ private static final String PARAM_VALUE = "value"; //$NON-NLS-1$
+
+ private static final String PARAM_NAME = "name"; //$NON-NLS-1$
+
+ private static final String INIT_PARAM = "init-param"; //$NON-NLS-1$
+
+ private static final String SERVLET = "servlet"; //$NON-NLS-1$
+
+ private static final String ALIAS = "alias"; //$NON-NLS-1$
+
+ private static final String LOAD_ON_STARTUP = "load-on-startup"; //$NON-NLS-1$
+
+ private HttpService httpService;
+
+ private ExtensionPointTracker tracker;
+
+ private HttpContextManager httpContextManager;
+
+ public ServletManager(HttpService httpService, HttpContextManager httpContextManager, IExtensionRegistry registry) {
+ this.httpService = httpService;
+ this.httpContextManager = httpContextManager;
+ tracker = new ExtensionPointTracker(registry, SERVLETS_EXTENSION_POINT, this);
+ }
+
+ public void start() {
+ tracker.open();
+ }
+
+ public void stop() {
+ tracker.close();
+ }
+
+ public void added(IExtension extension) {
+ IConfigurationElement[] elements = extension.getConfigurationElements();
+ if (elements.length != 1 || !SERVLET.equals(elements[0].getName()))
+ return;
+
+ IConfigurationElement servletElement = elements[0];
+ ServletWrapper wrapper = new ServletWrapper(servletElement);
+ String alias = servletElement.getAttribute(ALIAS);
+
+ Dictionary initparams = new Hashtable();
+ IConfigurationElement[] initParams = servletElement.getChildren(INIT_PARAM);
+ for (int i = 0; i < initParams.length; ++i) {
+ String paramName = initParams[i].getAttribute(PARAM_NAME);
+ String paramValue = initParams[i].getAttribute(PARAM_VALUE);
+ initparams.put(paramName, paramValue);
+ }
+
+ boolean loadOnStartup = new Boolean(servletElement.getAttribute(LOAD_ON_STARTUP)).booleanValue();
+
+ String httpContextName = servletElement.getAttribute(HTTPCONTEXT_NAME);
+ HttpContext context = null;
+ if (httpContextName == null)
+ context = httpContextManager.getDefaultHttpContext(extension.getContributor().getName());
+ else
+ context = httpContextManager.getHttpContext(httpContextName);
+
+ try {
+ httpService.registerServlet(alias, wrapper, initparams, context);
+ if (loadOnStartup)
+ wrapper.initializeDelegate();
+ } catch (ServletException e) {
+ // this should never happen as the init() called is the ServletWrapper implementation
+ e.printStackTrace();
+ } catch (NamespaceException e) {
+ // TODO Should log this perhaps with the LogService?
+ e.printStackTrace();
+ }
+ }
+
+ public void removed(IExtension extension) {
+ IConfigurationElement[] elements = extension.getConfigurationElements();
+ if (elements.length != 1 || !SERVLET.equals(elements[0].getName()))
+ return;
+
+ IConfigurationElement servletElement = elements[0];
+ String alias = servletElement.getAttribute(ALIAS);
+ httpService.unregister(alias);
+ }
+
+ private static class ServletWrapper implements Servlet {
+
+ private static final String CLASS = "class"; //$NON-NLS-1$
+ private IConfigurationElement element;
+ private Servlet delegate;
+ private ServletConfig config;
+
+ public ServletWrapper(IConfigurationElement element) {
+ this.element = element;
+ }
+
+ public void init(ServletConfig config) throws ServletException {
+ this.config = config;
+ }
+
+ public ServletConfig getServletConfig() {
+ return config;
+ }
+
+ public void service(ServletRequest arg0, ServletResponse arg1) throws ServletException, IOException {
+ initializeDelegate();
+ delegate.service(arg0, arg1);
+ }
+
+ public String getServletInfo() {
+ return ""; //$NON-NLS-1$
+ }
+
+ public void destroy() {
+ destroyDelegate();
+ }
+
+ private synchronized void initializeDelegate() throws ServletException {
+ if (delegate == null) {
+ try {
+ Servlet newDelegate = (Servlet) element.createExecutableExtension(CLASS);
+ newDelegate.init(config);
+ delegate = newDelegate;
+ } catch (CoreException e) {
+ throw new ServletException(e);
+ }
+ }
+ }
+
+ private synchronized void destroyDelegate() {
+ if (delegate != null) {
+ Servlet doomedDelegate = delegate;
+ delegate = null;
+ doomedDelegate.destroy();
+ }
+ }
+ }
+}
diff --git a/bundles/org.eclipse.equinox.http.servlet/.classpath b/bundles/org.eclipse.equinox.http.servlet/.classpath
new file mode 100644
index 000000000..ce0c7a5d4
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.servlet/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/CDC-1.0%Foundation-1.0"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.equinox.http.servlet/.cvsignore b/bundles/org.eclipse.equinox.http.servlet/.cvsignore
new file mode 100644
index 000000000..ba077a403
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.servlet/.cvsignore
@@ -0,0 +1 @@
+bin
diff --git a/bundles/org.eclipse.equinox.http.servlet/.project b/bundles/org.eclipse.equinox.http.servlet/.project
new file mode 100644
index 000000000..b32d05a6c
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.servlet/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.equinox.http.servlet</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.equinox.http.servlet/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.http.servlet/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..f72f4bca6
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.servlet/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,253 @@
+#Thu Sep 28 11:26:23 EDT 2006
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.1
+org.eclipse.jdt.core.compiler.compliance=1.3
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=ignore
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=ignore
+org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines=false
+org.eclipse.jdt.core.formatter.comment.format_comments=false
+org.eclipse.jdt.core.formatter.comment.format_header=true
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=800
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
diff --git a/bundles/org.eclipse.equinox.http.servlet/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.http.servlet/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 000000000..87292426d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.servlet/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,8 @@
+#Thu Sep 28 11:26:55 EDT 2006
+eclipse.preferences.version=1
+formatter_profile=_core
+formatter_settings_version=10
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=;
+org.eclipse.jdt.ui.ondemandthreshold=3
+org.eclipse.jdt.ui.staticondemandthreshold=3
diff --git a/bundles/org.eclipse.equinox.http.servlet/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.http.servlet/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..67063dcbb
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.servlet/META-INF/MANIFEST.MF
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Http Services Servlet
+Bundle-SymbolicName: org.eclipse.equinox.http.servlet
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.equinox.http.servlet.internal.Activator
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: CDC-1.0/Foundation-1.0,
+ J2SE-1.3
+Export-Package: org.eclipse.equinox.http.servlet;version="1.0.0"
+Import-Package: javax.servlet;version="[2.3.0,2.5.0)",
+ javax.servlet.http;version="[2.3.0,2.5.0)",
+ org.osgi.framework;version="1.3.0",
+ org.osgi.service.http;version="1.2.0"
+Eclipse-LazyStart: true
diff --git a/bundles/org.eclipse.equinox.http.servlet/build.properties b/bundles/org.eclipse.equinox.http.servlet/build.properties
new file mode 100644
index 000000000..34d2e4d2d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.servlet/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/HttpServiceServlet.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/HttpServiceServlet.java
new file mode 100644
index 000000000..48afc3e01
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/HttpServiceServlet.java
@@ -0,0 +1,73 @@
+package org.eclipse.equinox.http.servlet;
+
+import java.io.IOException;
+import java.util.Enumeration;
+import javax.servlet.*;
+import javax.servlet.http.HttpServlet;
+import org.eclipse.equinox.http.servlet.internal.ProxyServlet;
+
+/**
+ * The HttpServiceServlet is the "public" side of a Servlet that when registered (and init() called) in a servlet container
+ * will in-turn register and provide an OSGi Http Service implementation.
+ * This class is not meant for extending or even using directly and is purely meant for registering
+ * in a servlet container.
+ */
+public class HttpServiceServlet extends HttpServlet {
+
+ private static final long serialVersionUID = -8247735945454143446L;
+
+ private ProxyServlet delegate;
+
+ public HttpServiceServlet() {
+ delegate = new ProxyServlet();
+ }
+
+ public void destroy() {
+ delegate.destroy();
+ }
+
+ public String getInitParameter(String name) {
+ return delegate.getInitParameter(name);
+ }
+
+ public Enumeration getInitParameterNames() {
+ return delegate.getInitParameterNames();
+ }
+
+ public ServletConfig getServletConfig() {
+ return delegate.getServletConfig();
+ }
+
+ public ServletContext getServletContext() {
+ return delegate.getServletContext();
+ }
+
+ public String getServletInfo() {
+ return delegate.getServletInfo();
+ }
+
+ public String getServletName() {
+ return delegate.getServletName();
+ }
+
+ public void init() throws ServletException {
+ delegate.init();
+ }
+
+ public void init(ServletConfig config) throws ServletException {
+ delegate.init(config);
+ }
+
+ public void log(String message, Throwable t) {
+ delegate.log(message, t);
+ }
+
+ public void log(String msg) {
+ delegate.log(msg);
+ }
+
+ public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
+ delegate.service(req, res);
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/Activator.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/Activator.java
new file mode 100644
index 000000000..6556dd6ee
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/Activator.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2005 Cognos Incorporated.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cognos Incorporated - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.http.servlet.internal;
+
+import java.util.*;
+import javax.servlet.ServletConfig;
+import org.osgi.framework.*;
+import org.osgi.service.http.HttpService;
+
+public class Activator implements BundleActivator {
+
+ private static final String DEFAULT_SERVICE_DESCRIPTION = "Equinox Servlet Bridge"; //$NON-NLS-1$
+ private static final String DEFAULT_SERVICE_VENDOR = "Eclipse.org"; //$NON-NLS-1$
+
+ private static BundleContext context;
+ private static Map serviceRegistrations = new HashMap();
+
+ public void start(BundleContext context) throws Exception {
+ startHttpServiceProxy(context);
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ stopHttpServiceProxy(context);
+ }
+
+ private static synchronized void startHttpServiceProxy(BundleContext bundleContext) {
+ context = bundleContext;
+ Object[] proxyServlets = serviceRegistrations.keySet().toArray();
+ for (int i = 0; i < proxyServlets.length; ++i) {
+ ServiceRegistration registration = registerHttpService((ProxyServlet) proxyServlets[i]);
+ serviceRegistrations.put(proxyServlets[i], registration);
+ }
+ }
+
+ private static synchronized void stopHttpServiceProxy(BundleContext bundleContext) {
+ Object[] proxyServlets = serviceRegistrations.keySet().toArray();
+ for (int i = 0; i < proxyServlets.length; ++i) {
+ ServiceRegistration registration = (ServiceRegistration) serviceRegistrations.put(proxyServlets[i], null);
+ registration.unregister();
+ }
+ context = null;
+ }
+
+ static synchronized void addProxyServlet(ProxyServlet proxyServlet) {
+ ServiceRegistration registration = null;
+ if (context != null)
+ registration = registerHttpService(proxyServlet);
+
+ serviceRegistrations.put(proxyServlet, registration);
+ }
+
+ private static ServiceRegistration registerHttpService(ProxyServlet proxyServlet) {
+ HttpServiceFactory factory = new HttpServiceFactory(proxyServlet);
+ Dictionary serviceProperties = new Hashtable(2);
+ ServletConfig config = proxyServlet.getServletConfig();
+ Enumeration initparameterNames = config.getInitParameterNames();
+ while (initparameterNames.hasMoreElements()) {
+ String name = (String) initparameterNames.nextElement();
+ serviceProperties.put(name, config.getInitParameter(name));
+ }
+
+ if (serviceProperties.get(Constants.SERVICE_VENDOR) == null)
+ serviceProperties.put(Constants.SERVICE_VENDOR, DEFAULT_SERVICE_VENDOR);
+
+ if (serviceProperties.get(Constants.SERVICE_DESCRIPTION) == null)
+ serviceProperties.put(Constants.SERVICE_DESCRIPTION, DEFAULT_SERVICE_DESCRIPTION);
+
+ return context.registerService(HttpService.class.getName(), factory, serviceProperties);
+ }
+
+ static synchronized void removeProxyServlet(ProxyServlet proxyServlet) {
+ ServiceRegistration registration = (ServiceRegistration) serviceRegistrations.remove(proxyServlet);
+ if (registration != null)
+ registration.unregister();
+ }
+}
diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/DefaultHttpContext.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/DefaultHttpContext.java
new file mode 100644
index 000000000..528f8299f
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/DefaultHttpContext.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2005 Cognos Incorporated.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cognos Incorporated - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.http.servlet.internal;
+
+import java.io.IOException;
+import java.net.URL;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.osgi.framework.Bundle;
+import org.osgi.service.http.HttpContext;
+
+public class DefaultHttpContext implements HttpContext {
+
+ private Bundle bundle;
+
+ public DefaultHttpContext(Bundle bundle) {
+ this.bundle = bundle;
+ }
+
+ public boolean handleSecurity(HttpServletRequest request, HttpServletResponse response) throws IOException {
+ // default behaviour assumes the container has already performed authentication
+ return true;
+ }
+
+ public URL getResource(String name) {
+ return bundle.getResource(name);
+ }
+
+ public String getMimeType(String name) {
+ return null;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/HttpServiceFactory.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/HttpServiceFactory.java
new file mode 100644
index 000000000..0af26c647
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/HttpServiceFactory.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2005 Cognos Incorporated.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cognos Incorporated - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.http.servlet.internal;
+
+import org.osgi.framework.*;
+
+// Factory to create http services. This is because the service needs to be customized for each bundle in order to implement the default resource lookups.
+public class HttpServiceFactory implements ServiceFactory {
+
+ private ProxyServlet proxy;
+
+ public HttpServiceFactory(ProxyServlet proxy) {
+ this.proxy = proxy;
+ }
+
+ public Object getService(Bundle bundle, ServiceRegistration registration) {
+ return new HttpServiceImpl(bundle, proxy);
+ }
+
+ public void ungetService(Bundle bundle, ServiceRegistration registration, Object service) {
+ ((HttpServiceImpl) service).unregisterAliases();
+
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/HttpServiceImpl.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/HttpServiceImpl.java
new file mode 100644
index 000000000..cb7a6bea8
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/HttpServiceImpl.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2005 Cognos Incorporated.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cognos Incorporated - initial API and implementation
+ * IBM Corporation - comments, and costmetic changes
+ *******************************************************************************/
+
+package org.eclipse.equinox.http.servlet.internal;
+
+import java.util.*;
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import org.osgi.framework.Bundle;
+import org.osgi.service.http.*;
+
+public class HttpServiceImpl implements HttpService {
+
+ private Bundle bundle; //The bundle associated with this instance of http service
+
+ private ProxyServlet proxy; //The proxy that does the dispatching of the incoming requests
+
+ Set aliases = new HashSet(); //Aliases registered against this particular instance of the service
+
+ public HttpServiceImpl(Bundle bundle, ProxyServlet proxy) {
+ this.bundle = bundle;
+ this.proxy = proxy;
+ }
+
+ //Clean up method
+ public synchronized void unregisterAliases() {
+ for (Iterator it = aliases.iterator(); it.hasNext();) {
+ String alias = (String) it.next();
+ proxy.unregister(alias, false);
+ }
+ aliases.clear();
+ }
+
+ /**
+ * @see HttpService#registerServlet(String, Servlet, Dictionary, HttpContext)
+ */
+ public synchronized void registerServlet(String alias, Servlet servlet, Dictionary initparams, HttpContext context) throws ServletException, NamespaceException {
+ if (context == null) {
+ context = createDefaultHttpContext();
+ }
+ proxy.registerServlet(alias, servlet, initparams, context, bundle);
+ aliases.add(alias);
+ }
+
+ /**
+ * @see HttpService#registerResources(String, String, HttpContext)
+ */
+ public synchronized void registerResources(String alias, String name, HttpContext context) throws NamespaceException {
+ if (context == null) {
+ context = createDefaultHttpContext();
+ }
+ proxy.registerResources(alias, name, context);
+ aliases.add(alias);
+ }
+
+ /**
+ * @see HttpService#unregister(String)
+ */
+ public synchronized void unregister(String alias) {
+ if (aliases.remove(alias)) {
+ proxy.unregister(alias, true);
+ } else {
+ // TODO perhaps this is too strong a reacttion ?
+ throw new IllegalArgumentException("Alias not found."); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @see HttpService#createDefaultHttpContext()
+ */
+ public HttpContext createDefaultHttpContext() {
+ return new DefaultHttpContext(bundle);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/HttpServletRequestAdaptor.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/HttpServletRequestAdaptor.java
new file mode 100644
index 000000000..ab8d5e72a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/HttpServletRequestAdaptor.java
@@ -0,0 +1,127 @@
+/*******************************************************************************
+ * Copyright (c) 2005 Cognos Incorporated.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cognos Incorporated - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.http.servlet.internal;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.http.*;
+
+public class HttpServletRequestAdaptor extends HttpServletRequestWrapper {
+
+ private String alias;
+ private Servlet servlet;
+ private boolean isRequestDispatcherInclude;
+
+ static final String INCLUDE_REQUEST_URI_ATTRIBUTE = "javax.servlet.include.request_uri"; //$NON-NLS-1$
+ static final String INCLUDE_CONTEXT_PATH_ATTRIBUTE = "javax.servlet.include.context_path"; //$NON-NLS-1$
+ static final String INCLUDE_SERVLET_PATH_ATTRIBUTE = "javax.servlet.include.servlet_path"; //$NON-NLS-1$
+ static final String INCLUDE_PATH_INFO_ATTRIBUTE = "javax.servlet.include.path_info"; //$NON-NLS-1$
+
+ public HttpServletRequestAdaptor(HttpServletRequest req, String alias, Servlet servlet) {
+ super(req);
+ this.alias = alias;
+ this.servlet = servlet;
+ isRequestDispatcherInclude = req.getAttribute(HttpServletRequestAdaptor.INCLUDE_REQUEST_URI_ATTRIBUTE) != null;
+ }
+
+ public String getPathInfo() {
+ if (isRequestDispatcherInclude)
+ return super.getPathInfo();
+
+ if (alias.equals("/")) { //$NON-NLS-1$
+ return super.getPathInfo();
+ }
+ return super.getPathInfo().substring(alias.length());
+ }
+
+ public String getServletPath() {
+ if (isRequestDispatcherInclude)
+ return super.getServletPath();
+
+ if (alias.equals("/")) { //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+ return alias;
+ }
+
+ public String getContextPath() {
+ if (isRequestDispatcherInclude)
+ return super.getContextPath();
+
+ return super.getContextPath() + super.getServletPath();
+ }
+
+ public Object getAttribute(String attributeName) {
+ if (isRequestDispatcherInclude) {
+ if (attributeName.equals(HttpServletRequestAdaptor.INCLUDE_CONTEXT_PATH_ATTRIBUTE)) {
+ String contextPath = (String) super.getAttribute(HttpServletRequestAdaptor.INCLUDE_CONTEXT_PATH_ATTRIBUTE);
+ if (contextPath == null || contextPath.equals("/")) //$NON-NLS-1$
+ contextPath = ""; //$NON-NLS-1$
+
+ String servletPath = (String) super.getAttribute(HttpServletRequestAdaptor.INCLUDE_SERVLET_PATH_ATTRIBUTE);
+ if (servletPath == null || servletPath.equals("/")) //$NON-NLS-1$
+ servletPath = ""; //$NON-NLS-1$
+
+ return contextPath + servletPath;
+ } else if (attributeName.equals(HttpServletRequestAdaptor.INCLUDE_SERVLET_PATH_ATTRIBUTE)) {
+ if (alias.equals("/")) { //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+ return alias;
+ } else if (attributeName.equals(HttpServletRequestAdaptor.INCLUDE_PATH_INFO_ATTRIBUTE)) {
+ String pathInfo = (String) super.getAttribute(HttpServletRequestAdaptor.INCLUDE_PATH_INFO_ATTRIBUTE);
+ if (alias.equals("/")) { //$NON-NLS-1$
+ return pathInfo;
+ }
+ return pathInfo.substring(alias.length());
+ }
+ }
+
+ return super.getAttribute(attributeName);
+ }
+
+ public RequestDispatcher getRequestDispatcher(String arg0) {
+ return new RequestDispatcherAdaptor(super.getRequestDispatcher(super.getServletPath() + arg0));
+ }
+
+ public static String getDispatchPathInfo(HttpServletRequest req) {
+ if (req.getAttribute(INCLUDE_REQUEST_URI_ATTRIBUTE) != null)
+ return (String) req.getAttribute(INCLUDE_PATH_INFO_ATTRIBUTE);
+
+ return req.getPathInfo();
+ }
+
+ public static String getDispatchServletPath(HttpServletRequest req) {
+ if (req.getAttribute(INCLUDE_REQUEST_URI_ATTRIBUTE) != null) {
+ String servletPath = (String) req.getAttribute(INCLUDE_SERVLET_PATH_ATTRIBUTE);
+ return (servletPath == null) ? "" : servletPath; //$NON-NLS-1$
+ }
+ return req.getServletPath();
+ }
+
+ public HttpSession getSession() {
+ HttpSession session = super.getSession();
+ if (session != null)
+ return new HttpSessionAdaptor(session, servlet);
+
+ return null;
+ }
+
+ public HttpSession getSession(boolean create) {
+ HttpSession session = super.getSession(create);
+ if (session != null)
+ return new HttpSessionAdaptor(session, servlet);
+
+ return null;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/HttpSessionAdaptor.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/HttpSessionAdaptor.java
new file mode 100644
index 000000000..78b7643a7
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/HttpSessionAdaptor.java
@@ -0,0 +1,92 @@
+package org.eclipse.equinox.http.servlet.internal;
+
+import java.util.Enumeration;
+import javax.servlet.Servlet;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpSession;
+
+// This class adapts HttpSessions in order to return the right ServletContext
+public class HttpSessionAdaptor implements HttpSession {
+
+ private HttpSession session;
+ private Servlet servlet;
+
+ public HttpSessionAdaptor(HttpSession session, Servlet servlet) {
+ this.session = session;
+ this.servlet = servlet;
+ }
+
+ public ServletContext getServletContext() {
+ return servlet.getServletConfig().getServletContext();
+ }
+
+ public Object getAttribute(String arg0) {
+ return session.getAttribute(arg0);
+ }
+
+ public Enumeration getAttributeNames() {
+ return session.getAttributeNames();
+ }
+
+ public long getCreationTime() {
+ return session.getCreationTime();
+ }
+
+ public String getId() {
+ return session.getId();
+ }
+
+ public long getLastAccessedTime() {
+ return session.getLastAccessedTime();
+ }
+
+ public int getMaxInactiveInterval() {
+ return session.getMaxInactiveInterval();
+ }
+
+ /**@deprecated*/
+ public javax.servlet.http.HttpSessionContext getSessionContext() {
+ return session.getSessionContext();
+ }
+
+ /**@deprecated*/
+ public Object getValue(String arg0) {
+ return session.getValue(arg0);
+ }
+
+ /**@deprecated*/
+ public String[] getValueNames() {
+ return session.getValueNames();
+ }
+
+ public void invalidate() {
+ session.invalidate();
+ }
+
+ public boolean isNew() {
+ return session.isNew();
+ }
+
+ /**@deprecated*/
+ public void putValue(String arg0, Object arg1) {
+ session.putValue(arg0, arg1);
+ }
+
+ public void removeAttribute(String arg0) {
+ session.removeAttribute(arg0);
+ }
+
+ /**@deprecated*/
+ public void removeValue(String arg0) {
+ session.removeValue(arg0);
+ }
+
+ public void setAttribute(String arg0, Object arg1) {
+ session.setAttribute(arg0, arg1);
+ }
+
+ public void setMaxInactiveInterval(int arg0) {
+ session.setMaxInactiveInterval(arg0);
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/ProxyContext.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/ProxyContext.java
new file mode 100644
index 000000000..fd3a6717a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/ProxyContext.java
@@ -0,0 +1,36 @@
+package org.eclipse.equinox.http.servlet.internal;
+
+import java.util.*;
+import javax.servlet.http.HttpServletRequest;
+import org.osgi.service.http.HttpContext;
+
+/**
+ * The ProxyContext provides something similar to a ServletContext for all servlets and resources under a particular ProxyServlet.
+ * In particular it holds and represent the concept of "context path" through the Proxy Servlets servlet path.
+ * The Http Service also requires a ServletContext namespaced by eachindividual HttpContext. The ProxyContext provides support for the
+ * attribute map of a ServletContext again namespaced by HttpContext as specified in the Http Service specification. A WeakHashMap is
+ * used to hold the various attributes so that when the HttpContext is no longer referenced the associated context attributes can be
+ * garbage collected.
+ */
+public class ProxyContext {
+ private String servletPath;
+ private WeakHashMap contextAttributes = new WeakHashMap();
+
+ synchronized void initializeServletPath(HttpServletRequest req) {
+ if (servletPath == null)
+ servletPath = HttpServletRequestAdaptor.getDispatchServletPath(req);
+ }
+
+ synchronized String getServletPath() {
+ return servletPath;
+ }
+
+ synchronized void createContextAttributes(HttpContext httpContext) {
+ if (!contextAttributes.containsKey(httpContext))
+ contextAttributes.put(httpContext, new Hashtable());
+ }
+
+ synchronized Dictionary getContextAttributes(HttpContext httpContext) {
+ return (Dictionary) contextAttributes.get(httpContext);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/ProxyServlet.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/ProxyServlet.java
new file mode 100644
index 000000000..dc7dac279
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/ProxyServlet.java
@@ -0,0 +1,169 @@
+/*******************************************************************************
+ * Copyright (c) 2005 Cognos Incorporated.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cognos Incorporated - initial API and implementation
+ * IBM Corporation - comments and javadoc
+ *******************************************************************************/
+
+package org.eclipse.equinox.http.servlet.internal;
+
+import java.io.IOException;
+import java.security.AccessController;
+import java.util.*;
+import javax.servlet.*;
+import javax.servlet.http.*;
+import org.osgi.framework.Bundle;
+import org.osgi.service.http.HttpContext;
+import org.osgi.service.http.NamespaceException;
+
+/**
+ * The ProxyServlet is the private side of a Servlet that when registered (and init() called) in a servlet container
+ * will in-turn register and provide an OSGi Http Service implementation.
+ * This class is not meant for extending or even using directly and is purely meant for registering
+ * in a servlet container.
+ */
+public class ProxyServlet extends HttpServlet {
+
+ private static final long serialVersionUID = 4117456123807468871L;
+ private Map registrations = new HashMap(); //alias --> registration
+ private Set servlets = new HashSet(); //All the servlets objects that have been registered
+ private ProxyContext proxyContext;
+
+ public void init(ServletConfig config) throws ServletException {
+ super.init(config);
+ proxyContext = new ProxyContext();
+ Activator.addProxyServlet(this);
+ }
+
+ public void destroy() {
+ Activator.removeProxyServlet(this);
+ proxyContext = null;
+ super.destroy();
+ }
+
+ /**
+ * @see HttpServlet#service(ServletRequest, ServletResponse)
+ */
+ protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+ proxyContext.initializeServletPath(req);
+ String alias = HttpServletRequestAdaptor.getDispatchPathInfo(req);
+ if (alias == null)
+ alias = "/"; //$NON-NLS-1$
+
+ // perfect match
+ if (processAlias(req, resp, alias, null))
+ return;
+
+ String extensionAlias = findExtensionAlias(alias);
+ alias = alias.substring(0, alias.lastIndexOf('/'));
+
+ // longest path match
+ while (alias.length() != 0) {
+ if (processAlias(req, resp, alias, extensionAlias))
+ return;
+ alias = alias.substring(0, alias.lastIndexOf('/'));
+ }
+
+ // default handler match
+ if (extensionAlias != null)
+ extensionAlias = extensionAlias.substring(1); // remove the leading '/'
+ if (processAlias(req, resp, "/", extensionAlias)) //Handle '/' aliases //$NON-NLS-1$
+ return;
+ resp.sendError(HttpServletResponse.SC_NOT_FOUND, "ProxyServlet: " + req.getRequestURI()); //$NON-NLS-1$
+ }
+
+ private String findExtensionAlias(String alias) {
+ String lastSegment = alias.substring(alias.lastIndexOf('/') + 1);
+ int dot = lastSegment.indexOf('.');
+ if (dot == -1)
+ return null;
+ String extension = lastSegment.substring(dot + 1);
+ if (extension.length() == 0)
+ return null;
+ return "/*." + extension; //$NON-NLS-1$
+ }
+
+ private boolean processAlias(HttpServletRequest req, HttpServletResponse resp, String alias, String extensionAlias) throws ServletException, IOException {
+ Registration registration = null;
+ synchronized (this) {
+ if (extensionAlias == null)
+ registration = (Registration) registrations.get(alias);
+ else {
+ registration = (Registration) registrations.get(alias + extensionAlias);
+ if (registration != null) // extensions should be handled on the full alias
+ alias = HttpServletRequestAdaptor.getDispatchPathInfo(req);
+ else
+ registration = (Registration) registrations.get(alias);
+ }
+
+ if (registration != null)
+ registration.addReference();
+ }
+ if (registration != null) {
+ try {
+ if (registration.handleRequest(req, resp, alias))
+ return true;
+ } finally {
+ registration.removeReference();
+ }
+ }
+ return false;
+ }
+
+ //Effective unregistration of servlet and resources as defined in HttpService#unregister()
+ synchronized void unregister(String alias, boolean destroy) {
+ Registration removedRegistration = (Registration) registrations.remove(alias);
+ if (removedRegistration != null) {
+ if (destroy)
+ removedRegistration.destroy();
+ removedRegistration.close();
+ }
+ }
+
+ //Effective registration of the servlet as defined HttpService#registerServlet()
+ synchronized void registerServlet(String alias, Servlet servlet, Dictionary initparams, HttpContext context, Bundle bundle) throws ServletException, NamespaceException {
+ checkAlias(alias);
+ if (servlet == null)
+ throw new IllegalArgumentException("Servlet cannot be null"); //$NON-NLS-1$
+
+ ServletRegistration registration = new ServletRegistration(servlet, context, bundle, servlets);
+ registration.checkServletRegistration();
+
+ ServletContext wrappedServletContext = new ServletContextAdaptor(proxyContext, getServletContext(), context, AccessController.getContext());
+ ServletConfig servletConfig = new ServletConfigImpl(servlet, initparams, wrappedServletContext);
+
+ registration.init(servletConfig);
+ registrations.put(alias, registration);
+ }
+
+ //Effective registration of the resources as defined HttpService#registerResources()
+ synchronized void registerResources(String alias, String name, HttpContext context) throws NamespaceException {
+ checkAlias(alias);
+ checkName(name);
+ registrations.put(alias, new ResourceRegistration(name, context, getServletContext(), AccessController.getContext()));
+ }
+
+ private void checkName(String name) {
+ if (name == null)
+ throw new IllegalArgumentException("Name cannot be null"); //$NON-NLS-1$
+
+ if (name.endsWith("/") && !name.equals("/")) //$NON-NLS-1$ //$NON-NLS-2$
+ throw new IllegalArgumentException("Invalid Name '" + name + "'"); //$NON-NLS-1$//$NON-NLS-2$
+ }
+
+ private void checkAlias(String alias) throws NamespaceException {
+ if (alias == null)
+ throw new IllegalArgumentException("Alias cannot be null"); //$NON-NLS-1$
+
+ if (!alias.startsWith("/") || (alias.endsWith("/") && !alias.equals("/"))) //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$
+ throw new IllegalArgumentException("Invalid alias '" + alias + "'"); //$NON-NLS-1$//$NON-NLS-2$
+
+ if (registrations.containsKey(alias))
+ throw new NamespaceException("The alias '" + alias + "' is already in use."); //$NON-NLS-1$//$NON-NLS-2$
+ }
+}
diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/Registration.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/Registration.java
new file mode 100644
index 000000000..e70869bfb
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/Registration.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2005 Cognos Incorporated.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cognos Incorporated - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.http.servlet.internal;
+
+import java.io.IOException;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public abstract class Registration {
+
+ protected int referenceCount;
+
+ public synchronized void addReference() {
+ ++referenceCount;
+ }
+
+ public synchronized void removeReference() {
+ --referenceCount;
+ if (referenceCount == 0) {
+ notifyAll();
+ }
+ }
+
+ public synchronized void destroy() {
+ boolean interrupted = false;
+ try {
+ while (referenceCount != 0) {
+ try {
+ wait();
+ } catch (InterruptedException e) {
+ // wait until the servlet is inactive but save the interrupted status
+ interrupted = true;
+ }
+ }
+ } finally {
+ if (interrupted)
+ Thread.currentThread().interrupt(); //restore the interrupted state
+ }
+ }
+
+ public abstract boolean handleRequest(HttpServletRequest req, HttpServletResponse resp, String alias) throws IOException, ServletException;
+
+ public void close() {
+ // do nothing
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/RequestDispatcherAdaptor.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/RequestDispatcherAdaptor.java
new file mode 100644
index 000000000..2e43fc1ba
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/RequestDispatcherAdaptor.java
@@ -0,0 +1,28 @@
+package org.eclipse.equinox.http.servlet.internal;
+
+import java.io.IOException;
+import javax.servlet.*;
+
+//This class unwraps the request so it can be processed by the underlying servlet container.
+public class RequestDispatcherAdaptor implements RequestDispatcher {
+
+ private RequestDispatcher requestDispatcher;
+
+ public RequestDispatcherAdaptor(RequestDispatcher requestDispatcher) {
+ this.requestDispatcher = requestDispatcher;
+ }
+
+ public void forward(ServletRequest req, ServletResponse resp) throws ServletException, IOException {
+ if (req instanceof HttpServletRequestAdaptor)
+ req = ((HttpServletRequestAdaptor) req).getRequest();
+
+ requestDispatcher.forward(req, resp);
+ }
+
+ public void include(ServletRequest req, ServletResponse resp) throws ServletException, IOException {
+ if (req instanceof HttpServletRequestAdaptor)
+ req = ((HttpServletRequestAdaptor) req).getRequest();
+
+ requestDispatcher.include(req, resp);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/ResourceRegistration.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/ResourceRegistration.java
new file mode 100644
index 000000000..95c696808
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/ResourceRegistration.java
@@ -0,0 +1,142 @@
+/*******************************************************************************
+ * Copyright (c) 2005 Cognos Incorporated.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cognos Incorporated - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.http.servlet.internal;
+
+import java.io.*;
+import java.net.URL;
+import java.net.URLConnection;
+import java.security.*;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.osgi.service.http.HttpContext;
+
+public class ResourceRegistration extends Registration {
+ private static final String LAST_MODIFIED = "Last-Modified"; //$NON-NLS-1$
+ private static final String IF_MODIFIED_SINCE = "If-Modified-Since"; //$NON-NLS-1$
+ private static final String IF_NONE_MATCH = "If-None-Match"; //$NON-NLS-1$
+ private static final String ETAG = "ETag"; //$NON-NLS-1$
+
+ private String internalName;
+ HttpContext httpContext;
+ private ServletContext servletContext;
+ private AccessControlContext acc;
+
+ public ResourceRegistration(String internalName, HttpContext context, ServletContext servletContext, AccessControlContext acc) {
+ this.internalName = internalName;
+ if (internalName.equals("/")) { //$NON-NLS-1$
+ this.internalName = ""; //$NON-NLS-1$
+ }
+ this.httpContext = context;
+ this.servletContext = servletContext;
+ this.acc = acc;
+ }
+
+ public boolean handleRequest(HttpServletRequest req, final HttpServletResponse resp, String alias) throws IOException {
+ if (httpContext.handleSecurity(req, resp)) {
+
+ String method = req.getMethod();
+ if (method.equals("GET") || method.equals("POST") || method.equals("HEAD")) { //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+
+ String pathInfo = HttpServletRequestAdaptor.getDispatchPathInfo(req);
+ int aliasLength = alias.equals("/") ? 0 : alias.length(); //$NON-NLS-1$
+ String resourcePath = internalName + pathInfo.substring(aliasLength);
+ URL testURL = httpContext.getResource(resourcePath);
+ if (testURL == null) {
+ return false;
+ }
+ return writeResource(req, resp, resourcePath);
+ }
+ resp.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
+ }
+ return true;
+ }
+
+ private boolean writeResource(final HttpServletRequest req, final HttpServletResponse resp, final String resourcePath) throws IOException {
+ Boolean result = Boolean.TRUE;
+ try {
+ result = (Boolean) AccessController.doPrivileged(new PrivilegedExceptionAction() {
+
+ public Object run() throws Exception {
+ URL url = httpContext.getResource(resourcePath);
+ if (url == null)
+ return Boolean.FALSE;
+
+ URLConnection connection = url.openConnection();
+ long lastModified = connection.getLastModified();
+ int contentLength = connection.getContentLength();
+
+ String etag = null;
+ if (lastModified != -1 && contentLength != -1)
+ etag = "W/\"" + contentLength + "-" + lastModified + "\""; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
+
+ // Check for cache revalidation.
+ // We should prefer ETag validation as the guarantees are stronger and all HTTP 1.1 clients should be using it
+ String ifNoneMatch = req.getHeader(IF_NONE_MATCH);
+ if (ifNoneMatch != null && etag != null && ifNoneMatch.indexOf(etag) != -1) {
+ resp.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
+ return Boolean.TRUE;
+ } else {
+ long ifModifiedSince = req.getDateHeader(IF_MODIFIED_SINCE);
+ // for purposes of comparison we add 999 to ifModifiedSince since the fidelity
+ // of the IMS header generally doesn't include milli-seconds
+ if (ifModifiedSince > -1 && lastModified > 0 && lastModified <= (ifModifiedSince + 999)) {
+ resp.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
+ return Boolean.TRUE;
+ }
+ }
+
+ // return the full contents regularly
+ if (contentLength != -1)
+ resp.setContentLength(contentLength);
+
+ String contentType = httpContext.getMimeType(resourcePath);
+ if (contentType == null)
+ contentType = servletContext.getMimeType(resourcePath);
+
+ if (contentType != null)
+ resp.setContentType(contentType);
+
+ if (lastModified > 0)
+ resp.setDateHeader(LAST_MODIFIED, lastModified);
+
+ if (etag != null)
+ resp.setHeader(ETAG, etag);
+
+ InputStream is = null;
+ try {
+ is = connection.getInputStream();
+ OutputStream os = resp.getOutputStream();
+ byte[] buffer = new byte[8192];
+ int bytesRead = is.read(buffer);
+ int writtenContentLength = 0;
+ while (bytesRead != -1) {
+ os.write(buffer, 0, bytesRead);
+ writtenContentLength += bytesRead;
+ bytesRead = is.read(buffer);
+ }
+ if (contentLength == -1 || contentLength != writtenContentLength)
+ resp.setContentLength(writtenContentLength);
+ } finally {
+ if (is != null)
+ is.close();
+ }
+ return Boolean.TRUE;
+ }
+ }, acc);
+ } catch (PrivilegedActionException e) {
+ throw (IOException) e.getException();
+ }
+ return result.booleanValue();
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/ServletConfigImpl.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/ServletConfigImpl.java
new file mode 100644
index 000000000..44ed9f113
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/ServletConfigImpl.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2005 Cognos Incorporated.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cognos Incorporated - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.http.servlet.internal;
+
+import java.util.*;
+import javax.servlet.*;
+
+public class ServletConfigImpl implements ServletConfig {
+
+ private static final Dictionary EMPTY_PARAMS = new Hashtable(0);
+ private static final String SERVLET_NAME = "servlet-name"; //$NON-NLS-1$
+ private Servlet servlet;
+ private Dictionary initparams;
+ private ServletContext servletContext;
+
+ public ServletConfigImpl(Servlet servlet, Dictionary initparams, ServletContext servletContext) {
+ this.servlet = servlet;
+ this.initparams = (initparams != null) ? initparams : EMPTY_PARAMS;
+ this.servletContext = servletContext;
+ }
+
+ /*
+ * @see javax.servlet.ServletConfig#getServletName()
+ *
+ * The OSGi Http Service does not specify a way to set a servlet name at the API level. This
+ * implementation will try to use the value of the "servlet-name" initial parameter if available.
+ */
+ public String getServletName() {
+ String servletName = (String) initparams.get(SERVLET_NAME);
+ return (servletName != null) ? servletName : servlet.getClass().getName();
+ }
+
+ public ServletContext getServletContext() {
+ return servletContext;
+ }
+
+ public String getInitParameter(String name) {
+ return (String) initparams.get(name);
+ }
+
+ public Enumeration getInitParameterNames() {
+ return initparams.keys();
+ }
+}
diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/ServletContextAdaptor.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/ServletContextAdaptor.java
new file mode 100644
index 000000000..8afc9a2f1
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/ServletContextAdaptor.java
@@ -0,0 +1,187 @@
+/*******************************************************************************
+ * Copyright (c) 2005 Cognos Incorporated.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cognos Incorporated - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.http.servlet.internal;
+
+import java.io.*;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.security.*;
+import java.util.*;
+import javax.servlet.*;
+import org.osgi.service.http.HttpContext;
+
+public class ServletContextAdaptor implements ServletContext {
+
+ private static final String JAVAX_SERVLET_CONTEXT_TEMPDIR = "javax.servlet.context.tempdir"; //$NON-NLS-1$
+ private ServletContext servletContext;
+ HttpContext httpContext;
+ private AccessControlContext acc;
+ private ProxyContext proxyContext;
+
+ public ServletContextAdaptor(ProxyContext proxyContext, ServletContext servletContext, HttpContext httpContext, AccessControlContext acc) {
+ this.servletContext = servletContext;
+ this.httpContext = httpContext;
+ this.acc = acc;
+ this.proxyContext = proxyContext;
+ proxyContext.createContextAttributes(httpContext);
+
+ if (proxyContext.getContextAttributes(httpContext).get(JAVAX_SERVLET_CONTEXT_TEMPDIR) == null) {
+ File tempDir = (File) servletContext.getAttribute(JAVAX_SERVLET_CONTEXT_TEMPDIR);
+ if (tempDir != null) {
+ File contextTempDir = new File(tempDir, "HttpContext" + httpContext.hashCode()); //$NON-NLS-1$
+ contextTempDir.mkdirs();
+ contextTempDir.deleteOnExit();
+ proxyContext.getContextAttributes(httpContext).put(JAVAX_SERVLET_CONTEXT_TEMPDIR, contextTempDir);
+ }
+ }
+ }
+
+ /**
+ * @see javax.servlet.ServletContext#getResourcePaths(java.lang.String)
+ *
+ * This method was added in the Servlet 2.3 API however the OSGi HttpService currently does not provide
+ * support for this method in the HttpContext interface. To support "getResourcePaths(...) this
+ * implementation uses reflection to check for and then call the associated HttpContext.getResourcePaths(...)
+ * method opportunistically. Null is returned if the method is not present or fails.
+ */
+ public Set getResourcePaths(String name) {
+ if (name == null || !name.startsWith("/")) //$NON-NLS-1$
+ return null;
+ try {
+ Method getResourcePathsMethod = httpContext.getClass().getMethod("getResourcePaths", new Class[] {String.class}); //$NON-NLS-1$
+ if (!getResourcePathsMethod.isAccessible())
+ getResourcePathsMethod.setAccessible(true);
+ return (Set) getResourcePathsMethod.invoke(httpContext, new Object[] {name});
+ } catch (Exception e) {
+ // ignore
+ }
+ return null;
+ }
+
+ public Object getAttribute(String attributeName) {
+ Dictionary attributes = proxyContext.getContextAttributes(httpContext);
+ return attributes.get(attributeName);
+ }
+
+ public Enumeration getAttributeNames() {
+ Dictionary attributes = proxyContext.getContextAttributes(httpContext);
+ return attributes.keys();
+ }
+
+ public void setAttribute(String attributeName, Object attributeValue) {
+ Dictionary attributes = proxyContext.getContextAttributes(httpContext);
+ attributes.put(attributeName, attributeValue);
+ }
+
+ public void removeAttribute(String attributeName) {
+ Dictionary attributes = proxyContext.getContextAttributes(httpContext);
+ attributes.remove(attributeName);
+ }
+
+ public String getMimeType(String name) {
+ String mimeType = httpContext.getMimeType(name);
+ return (mimeType != null) ? mimeType : servletContext.getMimeType(name);
+ }
+
+ public URL getResource(final String name) {
+ try {
+ return (URL) AccessController.doPrivileged(new PrivilegedExceptionAction() {
+ public Object run() throws Exception {
+ return httpContext.getResource(name);
+ }
+ }, acc);
+ } catch (PrivilegedActionException e) {
+ log(e.getException().getMessage(), e.getException());
+ }
+ return null;
+ }
+
+ public InputStream getResourceAsStream(String name) {
+ URL url = getResource(name);
+ if (url != null) {
+ try {
+ return url.openStream();
+ } catch (IOException e) {
+ log("Error opening stream for resource '" + name + "'", e); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ return null;
+ }
+
+ public ServletContext getContext(String arg0) {
+ return servletContext.getContext(arg0);
+ }
+
+ public String getInitParameter(String arg0) {
+ return servletContext.getInitParameter(arg0);
+ }
+
+ public Enumeration getInitParameterNames() {
+ return servletContext.getInitParameterNames();
+ }
+
+ public int getMajorVersion() {
+ return servletContext.getMajorVersion();
+ }
+
+ public int getMinorVersion() {
+ return servletContext.getMinorVersion();
+ }
+
+ public RequestDispatcher getNamedDispatcher(String arg0) {
+ return new RequestDispatcherAdaptor(servletContext.getNamedDispatcher(arg0));
+ }
+
+ public String getRealPath(String arg0) {
+ return servletContext.getRealPath(arg0);
+ }
+
+ public RequestDispatcher getRequestDispatcher(String arg0) {
+ return new RequestDispatcherAdaptor(servletContext.getRequestDispatcher(proxyContext.getServletPath() + arg0));
+ }
+
+ public String getServerInfo() {
+ return servletContext.getServerInfo();
+ }
+
+ /**@deprecated*/
+ public Servlet getServlet(String arg0) throws ServletException {
+ return servletContext.getServlet(arg0);
+ }
+
+ public String getServletContextName() {
+ return servletContext.getServletContextName();
+ }
+
+ /**@deprecated*/
+ public Enumeration getServletNames() {
+ return servletContext.getServletNames();
+ }
+
+ /**@deprecated*/
+ public Enumeration getServlets() {
+ return servletContext.getServlets();
+ }
+
+ /**@deprecated*/
+ public void log(Exception arg0, String arg1) {
+ servletContext.log(arg0, arg1);
+ }
+
+ public void log(String arg0, Throwable arg1) {
+ servletContext.log(arg0, arg1);
+ }
+
+ public void log(String arg0) {
+ servletContext.log(arg0);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/ServletRegistration.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/ServletRegistration.java
new file mode 100644
index 000000000..4c08a9fb6
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/ServletRegistration.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2005 Cognos Incorporated.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cognos Incorporated - initial API and implementation
+ * IBM Corporation - comments
+ *******************************************************************************/
+
+package org.eclipse.equinox.http.servlet.internal;
+
+import java.io.IOException;
+import java.util.Set;
+import javax.servlet.*;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.osgi.framework.Bundle;
+import org.osgi.service.http.HttpContext;
+
+//This class wraps the servlet object registered in the HttpService.registerServlet call, to manage the context classloader when handleRequests are being asked.
+//It is also responsible to ensure that a given servlet has only been registered once.
+public class ServletRegistration extends Registration {
+
+ private Servlet servlet; //The actual servlet object registered against the http service. All requests will eventually be delegated to it.
+ private HttpContext httpContext; //The context used during the registration of the servlet
+ private Set servlets; //All the servlets registered against the instance of the proxy servlet that "ownes" self.
+ private ClassLoader registeredContextClassLoader;
+
+ public ServletRegistration(Servlet servlet, HttpContext context, Bundle bundle, Set servlets) {
+ this.servlet = servlet;
+ this.servlets = servlets;
+ this.httpContext = context;
+ registeredContextClassLoader = Thread.currentThread().getContextClassLoader();
+ }
+
+ public void destroy() {
+ ClassLoader original = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(registeredContextClassLoader);
+ super.destroy();
+ } finally {
+ Thread.currentThread().setContextClassLoader(original);
+ }
+ servlet.destroy();
+ }
+
+ public void close() {
+ servlets.remove(servlet);
+ }
+
+ //Delegate the init call to the actual servlet
+ public void init(ServletConfig servletConfig) throws ServletException {
+ ClassLoader original = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(registeredContextClassLoader);
+ servlet.init(servletConfig);
+ } finally {
+ Thread.currentThread().setContextClassLoader(original);
+ }
+ servlets.add(servlet);
+ }
+
+ public void checkServletRegistration() throws ServletException {
+ if (servlets.contains(servlet)) {
+ throw new ServletException("This servlet has already been registered at a different alias."); //$NON-NLS-1$
+ }
+ }
+
+ //Delegate the handling of the request to the actual servlet
+ public boolean handleRequest(HttpServletRequest req, HttpServletResponse resp, String alias) throws IOException, ServletException {
+ HttpServletRequest wrappedRequest = new HttpServletRequestAdaptor(req, alias, servlet);
+
+ if (httpContext.handleSecurity(wrappedRequest, resp)) {
+ ClassLoader original = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(registeredContextClassLoader);
+ servlet.service(wrappedRequest, resp);
+ } finally {
+ Thread.currentThread().setContextClassLoader(original);
+ }
+ }
+ return true;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.http.servletbridge/.classpath b/bundles/org.eclipse.equinox.http.servletbridge/.classpath
new file mode 100644
index 000000000..ce0c7a5d4
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.servletbridge/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/CDC-1.0%Foundation-1.0"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.equinox.http.servletbridge/.cvsignore b/bundles/org.eclipse.equinox.http.servletbridge/.cvsignore
new file mode 100644
index 000000000..ba077a403
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.servletbridge/.cvsignore
@@ -0,0 +1 @@
+bin
diff --git a/bundles/org.eclipse.equinox.http.servletbridge/.project b/bundles/org.eclipse.equinox.http.servletbridge/.project
new file mode 100644
index 000000000..3db137a10
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.servletbridge/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.equinox.http.servletbridge</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.equinox.http.servletbridge/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.http.servletbridge/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..f72f4bca6
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.servletbridge/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,253 @@
+#Thu Sep 28 11:26:23 EDT 2006
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.1
+org.eclipse.jdt.core.compiler.compliance=1.3
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=ignore
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=ignore
+org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines=false
+org.eclipse.jdt.core.formatter.comment.format_comments=false
+org.eclipse.jdt.core.formatter.comment.format_header=true
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=800
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
diff --git a/bundles/org.eclipse.equinox.http.servletbridge/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.http.servletbridge/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 000000000..1790d6a39
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.servletbridge/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,8 @@
+#Thu Sep 28 11:26:27 EDT 2006
+eclipse.preferences.version=1
+formatter_profile=_core
+formatter_settings_version=10
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=;
+org.eclipse.jdt.ui.ondemandthreshold=3
+org.eclipse.jdt.ui.staticondemandthreshold=3
diff --git a/bundles/org.eclipse.equinox.http.servletbridge/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.http.servletbridge/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..815c1ec88
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.servletbridge/META-INF/MANIFEST.MF
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Servletbridge Http Service
+Bundle-SymbolicName: org.eclipse.equinox.http.servletbridge
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.equinox.http.servletbridge.internal.Activator
+Bundle-Localization: plugin
+Import-Package: javax.servlet;version="[2.3.0,2.5.0)",
+ javax.servlet.http;version="[2.3.0,2.5.0)",
+ org.eclipse.equinox.http.servlet,
+ org.eclipse.equinox.servletbridge,
+ org.osgi.framework;version="1.3.0",
+ org.osgi.service.http;version="1.2.0"
+Bundle-RequiredExecutionEnvironment: CDC-1.0/Foundation-1.0,
+ J2SE-1.3
diff --git a/bundles/org.eclipse.equinox.http.servletbridge/build.properties b/bundles/org.eclipse.equinox.http.servletbridge/build.properties
new file mode 100644
index 000000000..34d2e4d2d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.servletbridge/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/bundles/org.eclipse.equinox.http.servletbridge/src/org/eclipse/equinox/http/servletbridge/internal/Activator.java b/bundles/org.eclipse.equinox.http.servletbridge/src/org/eclipse/equinox/http/servletbridge/internal/Activator.java
new file mode 100644
index 000000000..fc0fac7ff
--- /dev/null
+++ b/bundles/org.eclipse.equinox.http.servletbridge/src/org/eclipse/equinox/http/servletbridge/internal/Activator.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2006 Cognos Incorporated.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cognos Incorporated - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.http.servletbridge.internal;
+
+import org.eclipse.equinox.http.servlet.HttpServiceServlet;
+import org.eclipse.equinox.servletbridge.BridgeServlet;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ private HttpServiceServlet httpServiceServlet;
+
+ public void start(BundleContext context) throws Exception {
+ httpServiceServlet = new HttpServiceServlet();
+ BridgeServlet.registerServletDelegate(httpServiceServlet);
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ BridgeServlet.unregisterServletDelegate(httpServiceServlet);
+ httpServiceServlet = null;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.servletbridge/.classpath b/bundles/org.eclipse.equinox.servletbridge/.classpath
new file mode 100644
index 000000000..ce0c7a5d4
--- /dev/null
+++ b/bundles/org.eclipse.equinox.servletbridge/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/CDC-1.0%Foundation-1.0"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.equinox.servletbridge/.cvsignore b/bundles/org.eclipse.equinox.servletbridge/.cvsignore
new file mode 100644
index 000000000..c74591937
--- /dev/null
+++ b/bundles/org.eclipse.equinox.servletbridge/.cvsignore
@@ -0,0 +1,2 @@
+bin
+build
diff --git a/bundles/org.eclipse.equinox.servletbridge/.project b/bundles/org.eclipse.equinox.servletbridge/.project
new file mode 100644
index 000000000..f9b866de9
--- /dev/null
+++ b/bundles/org.eclipse.equinox.servletbridge/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.equinox.servletbridge</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.equinox.servletbridge/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.servletbridge/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..72185c962
--- /dev/null
+++ b/bundles/org.eclipse.equinox.servletbridge/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,253 @@
+#Thu Sep 28 11:24:32 EDT 2006
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.1
+org.eclipse.jdt.core.compiler.compliance=1.3
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=ignore
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=ignore
+org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines=false
+org.eclipse.jdt.core.formatter.comment.format_comments=false
+org.eclipse.jdt.core.formatter.comment.format_header=true
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=800
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
diff --git a/bundles/org.eclipse.equinox.servletbridge/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.servletbridge/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 000000000..e5edadca5
--- /dev/null
+++ b/bundles/org.eclipse.equinox.servletbridge/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,8 @@
+#Thu Sep 28 11:24:45 EDT 2006
+eclipse.preferences.version=1
+formatter_profile=_core
+formatter_settings_version=10
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=;
+org.eclipse.jdt.ui.ondemandthreshold=3
+org.eclipse.jdt.ui.staticondemandthreshold=3
diff --git a/bundles/org.eclipse.equinox.servletbridge/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.servletbridge/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..58304a806
--- /dev/null
+++ b/bundles/org.eclipse.equinox.servletbridge/META-INF/MANIFEST.MF
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Servletbridge
+Bundle-SymbolicName: org.eclipse.equinox.servletbridge
+Bundle-Version: 1.0.0.qualifier
+Bundle-Localization: plugin
+Import-Package: javax.servlet;version="2.3.0",
+ javax.servlet.http;version="2.3.0"
+Export-Package: org.eclipse.equinox.servletbridge
+Bundle-ClassPath: servletbridge.jar
+Bundle-RequiredExecutionEnvironment: CDC-1.0/Foundation-1.0,
+ J2SE-1.3
diff --git a/bundles/org.eclipse.equinox.servletbridge/about.html b/bundles/org.eclipse.equinox.servletbridge/about.html
new file mode 100644
index 000000000..cdc1e5004
--- /dev/null
+++ b/bundles/org.eclipse.equinox.servletbridge/about.html
@@ -0,0 +1,24 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html>
+<head>
+<title>About</title>
+<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>September 26, 2005</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available at <a href="http://www.eclipse.org/legal/epl-v10.html" target="_blank">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content.</p>
+
+<small>Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries.</small>
+
+</body>
+</html>
diff --git a/bundles/org.eclipse.equinox.servletbridge/build.properties b/bundles/org.eclipse.equinox.servletbridge/build.properties
new file mode 100644
index 000000000..4261883e9
--- /dev/null
+++ b/bundles/org.eclipse.equinox.servletbridge/build.properties
@@ -0,0 +1,9 @@
+bin.includes = META-INF/,\
+ servletbridge.jar,\
+ scripts/,\
+ templates/,\
+ about.html
+source.servletbridge.jar = src/
+output.servletbridge.jar = bin/
+jars.compile.order = servletbridge.jar
+src.includes = about.html
diff --git a/bundles/org.eclipse.equinox.servletbridge/scripts/webappBuilder.xml b/bundles/org.eclipse.equinox.servletbridge/scripts/webappBuilder.xml
new file mode 100644
index 000000000..9faa5104c
--- /dev/null
+++ b/bundles/org.eclipse.equinox.servletbridge/scripts/webappBuilder.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0"?>
+<project name="project" default="default">
+ <description>
+ Webapp Builder
+ </description>
+
+ <!-- =================================
+ target: default
+ ================================= -->
+ <target name="init">
+ <property name="proj.dir" value="${basedir}/.."/>
+ <!-- on windows be cautious about long file names for ${build.dir}-->
+ <property name="build.dir" value="${proj.dir}/build"/>
+ <property name="templates.dir" value="${proj.dir}/templates"/>
+ <property name="webapp.name" value="bridge"/>
+ <property name="features" value="org.eclipse.equinox.servlet.bridge.feature"/>
+ <available file="${proj.dir}/servletbridge.jar" property="servletbridge.jar-present"/>
+ <!--
+ If you are using this script in a head-less build define the following properties:
+ "ignore.pdeExportFeatures" (available only in the IDE - do the feature export with PDE Build)
+ "ignore.servletbridge.jar" (if you're compiling or extracting the jar yourself)
+ -->
+ </target>
+
+ <!-- =================================
+ target: prepare
+ ================================= -->
+ <target name="prepare" depends="init">
+ <delete dir="${build.dir}/${webapp.name}"/>
+ <mkdir dir="${build.dir}/${webapp.name}/WEB-INF/lib"/>
+ </target>
+ <!-- =================================
+ target: default
+ ================================= -->
+ <target name="default" depends="copyResources, servletbridge.jar, pdeExportFeatures"/>
+
+ <!-- =================================
+ target: copyResources
+ ================================= -->
+ <target name="copyResources" depends="prepare">
+ <copy todir="${build.dir}/${webapp.name}">
+ <fileset dir="${templates.dir}"/>
+ </copy>
+ </target>
+
+ <!-- =================================
+ target: servletbridge.jar
+ ================================= -->
+ <target name="servletbridge.jar" depends="prepare" unless="ignore.servletbridge.jar">
+ <antcall target="jar-servletbridge.jar" />
+ <antcall target="copy-servletbridge.jar"/>
+ </target>
+
+ <!-- =================================
+ target: copy-servletbridge.jar
+ ================================= -->
+ <target name="copy-servletbridge.jar" if="servletbridge.jar-present">
+ <copy todir="${build.dir}/${webapp.name}/WEB-INF/lib">
+ <fileset file="${proj.dir}/servletbridge.jar"/>
+ </copy>
+ </target>
+
+ <!-- =================================
+ target: jar-servletbridge.jar
+ ================================= -->
+ <target name="jar-servletbridge.jar" unless="servletbridge.jar-present">
+ <jar destfile="${build.dir}/${webapp.name}/WEB-INF/lib/servletbridge.jar">
+ <fileset dir="${proj.dir}/bin">
+ <include name="**/*.class"/>
+ </fileset>
+ </jar>
+ </target>
+
+ <!-- =================================
+ target: pdeExportFeatures
+ ================================= -->
+ <target name="pdeExportFeatures" depends="prepare" unless="ignore.pdeExportFeatures">
+ <!--
+ Features get built asynchronously but this approach is sometimes convenient.
+ So that the pde.exportFeatures task is available in the IDE select
+ "Run in the same JRE as the workspace" from the JRE tab from "Run Ant.."
+ -->
+ <pde.exportFeatures
+ features="${features}"
+ destination="${build.dir}/${webapp.name}/WEB-INF/eclipse"
+ exportType="directory"
+ useJARFormat="false"
+ exportSource="false"
+ />
+ </target>
+</project>
+
diff --git a/bundles/org.eclipse.equinox.servletbridge/src/org/eclipse/equinox/servletbridge/BridgeServlet.java b/bundles/org.eclipse.equinox.servletbridge/src/org/eclipse/equinox/servletbridge/BridgeServlet.java
new file mode 100644
index 000000000..a12369818
--- /dev/null
+++ b/bundles/org.eclipse.equinox.servletbridge/src/org/eclipse/equinox/servletbridge/BridgeServlet.java
@@ -0,0 +1,222 @@
+/*******************************************************************************
+ * Copyright (c) 2005 Cognos Incorporated.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cognos Incorporated - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.servletbridge;
+
+import java.io.IOException;
+import javax.servlet.ServletException;
+import javax.servlet.http.*;
+
+/**
+ * The BridgeServlet provides a means to bridge the servlet and OSGi
+ * runtimes. This class has 3 main repsonsibilities:
+ * 1) Control the lifecycle of the associated FrameworkLauncher in line with its own lifecycle
+ * 2) Provide a servlet "hook" that allows all servlet requests to be delegated to the registered servlet
+ * 3) Provide means to manually control the framework lifecycle
+ */
+public class BridgeServlet extends HttpServlet {
+
+ private static final long serialVersionUID = 2825667412474494674L;
+ private static BridgeServlet instance;
+ private HttpServlet delegate;
+ private FrameworkLauncher framework;
+ private int delegateReferenceCount;
+ private boolean enableFrameworkControls;
+
+ /**
+ * init() is called by the Servlet Container and used to instantiate the frameworkLauncher which MUST be an instance of FrameworkLauncher.
+ * After instantiating the framework init, deploy, and start are called.
+ */
+ public void init() throws ServletException {
+ super.init();
+ setInstance(this);
+
+ String enableFrameworkControlsParameter = getServletConfig().getInitParameter("enableFrameworkControls"); //$NON-NLS-1$
+ enableFrameworkControls = (enableFrameworkControlsParameter != null && enableFrameworkControlsParameter.equals("true")); //$NON-NLS-1$
+
+ String frameworkLauncherClassParameter = getServletConfig().getInitParameter("frameworkLauncherClass"); //$NON-NLS-1$
+ if (frameworkLauncherClassParameter != null) {
+ try {
+ Class frameworkLauncherClass = this.getClass().getClassLoader().loadClass(frameworkLauncherClassParameter);
+ framework = (FrameworkLauncher) frameworkLauncherClass.newInstance();
+ } catch (Exception e) {
+ throw new ServletException(e);
+ }
+ } else {
+ framework = new FrameworkLauncher();
+ }
+
+ framework.init(getServletConfig());
+ framework.deploy();
+ framework.start();
+ }
+
+ /**
+ * destroy() is called by the Servlet Container and used to first stop and then destroy the framework.
+ */
+ public void destroy() {
+ framework.stop();
+ framework.destroy();
+ setInstance(null);
+ super.destroy();
+ }
+
+ /**
+ * service is called by the Servlet Container and will first determine if the request is a
+ * framework control and will otherwise try to delegate to the registered servlet delegate
+ *
+ */
+ protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+ if (enableFrameworkControls) {
+ String pathInfo = req.getPathInfo();
+ if (pathInfo != null && pathInfo.startsWith("/sp_")) { //$NON-NLS-1$
+ if (serviceFrameworkControls(req, resp)) {
+ return;
+ }
+ }
+ }
+
+ ClassLoader original = Thread.currentThread().getContextClassLoader();
+ HttpServlet servletReference = acquireDelegateReference();
+ if (servletReference == null) {
+ resp.sendError(HttpServletResponse.SC_NOT_FOUND, "BridgeServlet: " + req.getRequestURI()); //$NON-NLS-1$
+ return;
+ }
+ try {
+ Thread.currentThread().setContextClassLoader(framework.getFrameworkContextClassLoader());
+ servletReference.service(req, resp);
+ } finally {
+ releaseDelegateReference();
+ Thread.currentThread().setContextClassLoader(original);
+ }
+ }
+
+ /**
+ * serviceFrameworkControls currently supports the following commands (identified by the request's pathinfo)
+ * sp_deploy - Copies the contents of /platform to the install area
+ * sp_undeploy - Removes the copy of Eclipse from the install area
+ * sp_redeploy - Resets the platform (e.g. stops, undeploys, deploys, starts)
+ * sp_start - Starts a deployed platform
+ * sp_stop - Stops the platform
+ */
+ private boolean serviceFrameworkControls(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+ String pathInfo = req.getPathInfo();
+ if (pathInfo.equals("/sp_start")) { //$NON-NLS-1$
+ framework.start();
+ resp.getWriter().write("Platform Started"); //$NON-NLS-1$
+ return true;
+ } else if (pathInfo.equals("/sp_stop")) { //$NON-NLS-1$
+ framework.stop();
+ resp.getWriter().write("Platform Stopped"); //$NON-NLS-1$
+ return true;
+ } else if (pathInfo.equals("/sp_deploy")) { //$NON-NLS-1$
+ framework.deploy();
+ resp.getWriter().write("Platform Deployed"); //$NON-NLS-1$
+ return true;
+ } else if (pathInfo.equals("/sp_undeploy")) { //$NON-NLS-1$
+ framework.undeploy();
+ resp.getWriter().write("Platform Undeployed"); //$NON-NLS-1$
+ return true;
+ } else if (pathInfo.equals("/sp_reset")) { //$NON-NLS-1$
+ framework.stop();
+ framework.start();
+ resp.getWriter().write("Platform Reset"); //$NON-NLS-1$
+ return true;
+ } else if (pathInfo.equals("/sp_redeploy")) { //$NON-NLS-1$
+ framework.stop();
+ framework.undeploy();
+ framework.deploy();
+ framework.start();
+ resp.getWriter().write("Platform Redeployed"); //$NON-NLS-1$
+ return true;
+ }
+ return false;
+ }
+
+ private static synchronized void setInstance(BridgeServlet servlet) {
+ if ((instance != null) && (servlet != null))
+ throw new IllegalStateException("instance already set"); //$NON-NLS-1$
+ instance = servlet;
+ }
+
+ private synchronized void releaseDelegateReference() {
+ --delegateReferenceCount;
+ notifyAll();
+ }
+
+ private synchronized HttpServlet acquireDelegateReference() {
+ if (delegate != null)
+ ++delegateReferenceCount;
+ return delegate;
+ }
+
+ /**
+ * registerServletDelegate is the hook method called from inside the OSGi runtime to register
+ * a servlet for which all future servlet calls will be delegated. If not null and no delegate
+ * is currently registered, init(ServletConfig) will be called on the servletDelegate before
+ * returning.
+ * @param servletDelegate - the servlet to register for delegation
+ */
+ public static synchronized void registerServletDelegate(HttpServlet servletDelegate) {
+ if (instance == null) {
+ // shutdown already
+ return;
+ }
+
+ if (servletDelegate == null)
+ throw new NullPointerException("cannot register a null servlet delegate"); //$NON-NLS-1$
+
+ synchronized (instance) {
+ if (instance.delegate != null)
+ throw new IllegalStateException("A Servlet Proxy is already registered"); //$NON-NLS-1$
+
+ try {
+ servletDelegate.init(instance.getServletConfig());
+ } catch (ServletException e) {
+ instance.getServletContext().log("Error initializing servlet delegate", e); //$NON-NLS-1$
+ return;
+ }
+ instance.delegate = servletDelegate;
+ }
+ }
+
+ /**
+ * unregisterServletDelegate is the hook method called from inside the OSGi runtime to unregister a delegate.
+ * If the servletDelegate matches the current registered delegate destroy() is called on the servletDelegate.
+ * destroy() will not be called until the delegate is finished servicing any previous requests.
+ * @param servletDelegate - the servlet to unregister
+ */
+ public static synchronized void unregisterServletDelegate(HttpServlet servletDelegate) {
+ if (instance == null) {
+ // shutdown already
+ return;
+ }
+
+ synchronized (instance) {
+ if (instance.delegate == null)
+ throw new IllegalStateException("No servlet delegate is registered"); //$NON-NLS-1$
+
+ if (instance.delegate != servletDelegate)
+ throw new IllegalStateException("Servlet delegate does not match registered servlet delegate"); //$NON-NLS-1$
+
+ HttpServlet oldProxy = instance.delegate;
+ instance.delegate = null;
+ while (instance.delegateReferenceCount != 0) {
+ try {
+ instance.wait();
+ } catch (InterruptedException e) {
+ // keep waiting for all requests to finish
+ }
+ }
+ oldProxy.destroy();
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.servletbridge/src/org/eclipse/equinox/servletbridge/FrameworkLauncher.java b/bundles/org.eclipse.equinox.servletbridge/src/org/eclipse/equinox/servletbridge/FrameworkLauncher.java
new file mode 100644
index 000000000..48345007b
--- /dev/null
+++ b/bundles/org.eclipse.equinox.servletbridge/src/org/eclipse/equinox/servletbridge/FrameworkLauncher.java
@@ -0,0 +1,577 @@
+/*******************************************************************************
+ * Copyright (c) 2005 Cognos Incorporated.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cognos Incorporated - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.servletbridge;
+
+import java.io.*;
+import java.lang.reflect.Method;
+import java.net.*;
+import java.util.*;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+
+/**
+ * The FrameworkLauncher provides the logic to:
+ * 1) init
+ * 2) deploy
+ * 3) start
+ * 4) stop
+ * 5) undeploy
+ * 6) destroy
+ * an instance of the OSGi framework.
+ * These 6 methods are provided to help manage the lifecycle and are called from outside this
+ * class by the BridgeServlet. To create an extended FrameworkLauncher over-ride these methods to allow
+ * custom behaviour.
+ */
+public class FrameworkLauncher {
+
+ private static final String WS_DELIM = " \t\n\r\f"; //$NON-NLS-1$
+ protected static final String FILE_SCHEME = "file:"; //$NON-NLS-1$
+ protected static final String FRAMEWORK_BUNDLE_NAME = "org.eclipse.osgi"; //$NON-NLS-1$
+ protected static final String STARTER = "org.eclipse.core.runtime.adaptor.EclipseStarter"; //$NON-NLS-1$
+ protected static final String NULL_IDENTIFIER = "@null"; //$NON-NLS-1$
+ protected static final String OSGI_FRAMEWORK = "osgi.framework"; //$NON-NLS-1$
+ protected static final String OSGI_INSTANCE_AREA = "osgi.instance.area"; //$NON-NLS-1$
+ protected static final String OSGI_CONFIGURATION_AREA = "osgi.configuration.area"; //$NON-NLS-1$
+ protected static final String OSGI_INSTALL_AREA = "osgi.install.area"; //$NON-NLS-1$
+ protected static final String RESOURCE_BASE = "/WEB-INF/eclipse/"; //$NON-NLS-1$
+ protected static final String LAUNCH_INI = "launch.ini"; //$NON-NLS-1$
+
+ protected ServletConfig config;
+ protected ServletContext context;
+ private File platformDirectory;
+ private ClassLoader frameworkContextClassLoader;
+ private URLClassLoader frameworkClassLoader;
+
+ void init(ServletConfig servletConfig) {
+ config = servletConfig;
+ context = servletConfig.getServletContext();
+ init();
+ }
+
+ /**
+ * init is the first method called on the FrameworkLauncher and can be used for any initial setup.
+ * The default behaviour is to do nothing.
+ */
+ public void init() {
+ // do nothing for now
+ }
+
+ /**
+ * destory is the last method called on the FrameworkLauncher and can be used for any final cleanup.
+ * The default behaviour is to do nothing.
+ */
+ public void destroy() {
+ // do nothing for now
+ }
+
+ /**
+ * deploy is used to move the OSGi framework libraries into a location suitable for execution.
+ * The default behaviour is to copy the contents of the webapps WEB-INF/eclipse directory
+ * to the webapps temp directory.
+ */
+ public synchronized void deploy() {
+ if (platformDirectory != null) {
+ context.log("Framework is already deployed"); //$NON-NLS-1$
+ return;
+ }
+
+ File servletTemp = (File) context.getAttribute("javax.servlet.context.tempdir"); //$NON-NLS-1$
+ platformDirectory = new File(servletTemp, "eclipse"); //$NON-NLS-1$
+ if (!platformDirectory.exists()) {
+ platformDirectory.mkdirs();
+ }
+
+ copyResource(RESOURCE_BASE + "configuration/", new File(platformDirectory, "configuration")); //$NON-NLS-1$ //$NON-NLS-2$
+ copyResource(RESOURCE_BASE + "features/", new File(platformDirectory, "features")); //$NON-NLS-1$ //$NON-NLS-2$
+ copyResource(RESOURCE_BASE + "plugins/", new File(platformDirectory, "plugins")); //$NON-NLS-1$ //$NON-NLS-2$
+ copyResource(RESOURCE_BASE + ".eclipseproduct", new File(platformDirectory, ".eclipseproduct")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /** undeploy is the reverse operation of deploy and removes the OSGi framework libraries from their
+ * execution location. Typically this method will only be called if a manual undeploy is requested in the
+ * ServletBridge.
+ * By default, this method removes the OSGi install and also removes the workspace.
+ */
+ public synchronized void undeploy() {
+ if (platformDirectory == null) {
+ context.log("Undeploy unnecessary. - (not deployed)"); //$NON-NLS-1$
+ return;
+ }
+
+ if (frameworkClassLoader != null) {
+ throw new IllegalStateException("Could not undeploy Framework - (not stopped)"); //$NON-NLS-1$
+ }
+
+ deleteDirectory(new File(platformDirectory, "configuration")); //$NON-NLS-1$
+ deleteDirectory(new File(platformDirectory, "features")); //$NON-NLS-1$
+ deleteDirectory(new File(platformDirectory, "plugins")); //$NON-NLS-1$
+ deleteDirectory(new File(platformDirectory, "workspace")); //$NON-NLS-1$
+
+ new File(platformDirectory, ".eclipseproduct").delete(); //$NON-NLS-1$
+ platformDirectory = null;
+ }
+
+ /** start is used to "start" a previously deployed OSGi framework
+ * The default behaviour will read launcher.ini to create a set of initial properties and
+ * use the "commandline" configuration parameter to create the equivalent command line arguments
+ * available when starting Eclipse.
+ */
+ public synchronized void start() {
+ if (platformDirectory == null)
+ throw new IllegalStateException("Could not start the Framework - (not deployed)"); //$NON-NLS-1$
+
+ if (frameworkClassLoader != null) {
+ context.log("Framework is already started"); //$NON-NLS-1$
+ return;
+ }
+
+ Map initalPropertyMap = buildInitialPropertyMap();
+ String[] args = buildCommandLineArguments();
+
+ ClassLoader original = Thread.currentThread().getContextClassLoader();
+ try {
+ System.setProperty("osgi.framework.useSystemProperties", "false"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ URL[] osgiURLArray = {new URL((String) initalPropertyMap.get(OSGI_FRAMEWORK))};
+ frameworkClassLoader = new ChildFirstURLClassLoader(osgiURLArray, this.getClass().getClassLoader());
+ Class clazz = frameworkClassLoader.loadClass(STARTER);
+
+ Method setInitialProperties = clazz.getMethod("setInitialProperties", new Class[] {Map.class}); //$NON-NLS-1$
+ setInitialProperties.invoke(null, new Object[] {initalPropertyMap});
+
+ Method runMethod = clazz.getMethod("run", new Class[] {String[].class, Runnable.class}); //$NON-NLS-1$
+ runMethod.invoke(null, new Object[] {args, null});
+ frameworkContextClassLoader = Thread.currentThread().getContextClassLoader();
+ } catch (Exception e) {
+ context.log("Error while starting Framework", e); //$NON-NLS-1$
+ throw new RuntimeException(e.getMessage());
+ } finally {
+ Thread.currentThread().setContextClassLoader(original);
+ }
+ }
+
+ /** buildInitialPropertyMap create the inital set of properties from the contents of launch.ini
+ * and for a few other properties necessary to launch defaults are supplied if not provided.
+ * The value '@null' will set the map value to null.
+ * @return a map containing the initial properties
+ */
+ protected Map buildInitialPropertyMap() {
+ Map initialPropertyMap = new HashMap();
+ Properties launchProperties = loadProperties(RESOURCE_BASE + LAUNCH_INI);
+ for (Iterator it = launchProperties.entrySet().iterator(); it.hasNext();) {
+ Map.Entry entry = (Map.Entry) it.next();
+ if (entry.getValue().equals(NULL_IDENTIFIER))
+ initialPropertyMap.put(entry.getKey(), null);
+ else
+ initialPropertyMap.put(entry.getKey(), entry.getValue());
+ }
+
+ try {
+ // install.area if not specified
+ if (!initialPropertyMap.containsKey(OSGI_INSTALL_AREA))
+ initialPropertyMap.put(OSGI_INSTALL_AREA, platformDirectory.toURL().toExternalForm());
+
+ // configuration.area if not specified
+ if (!initialPropertyMap.containsKey(OSGI_CONFIGURATION_AREA)) {
+ File configurationDirectory = new File(platformDirectory, "configuration"); //$NON-NLS-1$
+ if (!configurationDirectory.exists()) {
+ configurationDirectory.mkdirs();
+ }
+ initialPropertyMap.put(OSGI_CONFIGURATION_AREA, configurationDirectory.toURL().toExternalForm());
+ }
+
+ // instance.area if not specified
+ if (!initialPropertyMap.containsKey(OSGI_INSTANCE_AREA)) {
+ File workspaceDirectory = new File(platformDirectory, "workspace"); //$NON-NLS-1$
+ if (!workspaceDirectory.exists()) {
+ workspaceDirectory.mkdirs();
+ }
+ initialPropertyMap.put(OSGI_INSTANCE_AREA, workspaceDirectory.toURL().toExternalForm());
+ }
+
+ // osgi.framework if not specified
+ if (!initialPropertyMap.containsKey(OSGI_FRAMEWORK)) {
+ // search for osgi.framework in osgi.install.area
+ String installArea = (String) initialPropertyMap.get(OSGI_INSTALL_AREA);
+
+ // only support file type URLs for install area
+ if (installArea.startsWith(FILE_SCHEME))
+ installArea = installArea.substring(FILE_SCHEME.length());
+
+ String path = new File(installArea, "plugins").toString(); //$NON-NLS-1$
+ path = searchFor(FRAMEWORK_BUNDLE_NAME, path);
+ if (path == null)
+ throw new RuntimeException("Could not find framework"); //$NON-NLS-1$
+
+ initialPropertyMap.put(OSGI_FRAMEWORK, new File(path).toURL().toExternalForm());
+ }
+ } catch (MalformedURLException e) {
+ throw new RuntimeException("Error establishing location"); //$NON-NLS-1$
+ }
+ return initialPropertyMap;
+ }
+
+ /**
+ * buildCommandLineArguments parses the commandline config parameter into a set of arguments
+ * @return an array of String containing the commandline arguments
+ */
+ protected String[] buildCommandLineArguments() {
+ List args = new ArrayList();
+ args.add("-nosplash"); //$NON-NLS-1$
+ String commandLine = config.getInitParameter("commandline"); //$NON-NLS-1$
+
+ if (commandLine != null) {
+ StringTokenizer tokenizer = new StringTokenizer(commandLine, WS_DELIM);
+ while (tokenizer.hasMoreTokens()) {
+ String arg = tokenizer.nextToken();
+ if (arg.startsWith("\"")) { //$NON-NLS-1$
+ String remainingArg = tokenizer.nextToken("\""); //$NON-NLS-1$
+ arg = arg.substring(1) + remainingArg;
+ // skip to next whitespace separated token
+ tokenizer.nextToken(WS_DELIM);
+ } else if (arg.startsWith("'")) { //$NON-NLS-1$
+ String remainingArg = tokenizer.nextToken("'"); //$NON-NLS-1$
+ arg = arg.substring(1) + remainingArg;
+ // skip to next whitespace separated token
+ tokenizer.nextToken(WS_DELIM);
+ }
+ args.add(arg);
+ }
+ }
+ return (String[]) args.toArray(new String[] {});
+ }
+
+ /**
+ * stop is used to "shutdown" the framework and make it avialable for garbage collection.
+ * The default implementation also has special handling for Apache Commons Logging to "release" any
+ * resources associated with the frameworkContextClassLoader.
+ */
+ public synchronized void stop() {
+ if (platformDirectory == null) {
+ context.log("Shutdown unnecessary. (not deployed)"); //$NON-NLS-1$
+ return;
+ }
+
+ if (frameworkClassLoader == null) {
+ context.log("Framework is already shutdown"); //$NON-NLS-1$
+ return;
+ }
+
+ ClassLoader original = Thread.currentThread().getContextClassLoader();
+ try {
+ Class clazz = frameworkClassLoader.loadClass(STARTER);
+ Method method = clazz.getDeclaredMethod("shutdown", (Class[]) null); //$NON-NLS-1$
+ Thread.currentThread().setContextClassLoader(frameworkContextClassLoader);
+ method.invoke(clazz, (Object[]) null);
+
+ // ACL keys its loggers off of the ContextClassLoader which prevents GC without calling release.
+ // This section explicitly calls release if ACL is used.
+ try {
+ clazz = this.getClass().getClassLoader().loadClass("org.apache.commons.logging.LogFactory"); //$NON-NLS-1$
+ method = clazz.getDeclaredMethod("release", new Class[] {ClassLoader.class}); //$NON-NLS-1$
+ method.invoke(clazz, new Object[] {frameworkContextClassLoader});
+ } catch (ClassNotFoundException e) {
+ // ignore, ACL is not being used
+ }
+ } catch (Exception e) {
+ context.log("Error while stopping Framework", e); //$NON-NLS-1$
+ return;
+ } finally {
+ frameworkClassLoader = null;
+ frameworkContextClassLoader = null;
+ Thread.currentThread().setContextClassLoader(original);
+ }
+ }
+
+ /**
+ * copyResource is a convenience method to recursively copy resources from the ServletContext to
+ * an installation target. The default behaviour will create a directory if the resourcepath ends
+ * in '/' and a file otherwise.
+ * @param resourcePath - The resource root path
+ * @param target - The root location where resources are to be copied
+ */
+ protected void copyResource(String resourcePath, File target) {
+ if (resourcePath.endsWith("/")) { //$NON-NLS-1$
+ target.mkdir();
+ Set paths = context.getResourcePaths(resourcePath);
+ if (paths == null)
+ return;
+ for (Iterator it = paths.iterator(); it.hasNext();) {
+ String path = (String) it.next();
+ File newFile = new File(target, path.substring(resourcePath.length()));
+ copyResource(path, newFile);
+ }
+ } else {
+ try {
+ if (target.createNewFile()) {
+ InputStream is = null;
+ OutputStream os = null;
+ try {
+ is = context.getResourceAsStream(resourcePath);
+ if (is == null)
+ return;
+ os = new FileOutputStream(target);
+ byte[] buffer = new byte[8192];
+ int bytesRead = is.read(buffer);
+ while (bytesRead != -1) {
+ os.write(buffer, 0, bytesRead);
+ bytesRead = is.read(buffer);
+ }
+ } finally {
+ if (is != null)
+ is.close();
+
+ if (os != null)
+ os.close();
+ }
+ }
+ } catch (IOException e) {
+ context.log("Error copying resources", e); //$NON-NLS-1$
+ }
+ }
+ }
+
+ /**
+ * deleteDirectory is a cocnvenience method to recursively delete a directory
+ * @param directory - the directory to delete.
+ * @return was the delete succesful
+ */
+ protected static boolean deleteDirectory(File directory) {
+ if (directory.exists() && directory.isDirectory()) {
+ File[] files = directory.listFiles();
+ for (int i = 0; i < files.length; i++) {
+ if (files[i].isDirectory()) {
+ deleteDirectory(files[i]);
+ } else {
+ files[i].delete();
+ }
+ }
+ }
+ return directory.delete();
+ }
+
+ /**
+ * Used when to set the ContextClassLoader when the BridgeServlet delegates to a Servlet
+ * inside the framework
+ * @return a Classloader with the OSGi framework's context classloader.
+ */
+ public synchronized ClassLoader getFrameworkContextClassLoader() {
+ return frameworkContextClassLoader;
+ }
+
+ /**
+ * Platfom Directory is where the OSGi software is installed
+ * @return the framework install location
+ */
+ protected synchronized File getPlatformDirectory() {
+ return platformDirectory;
+ }
+
+ /**
+ * loadProperties is a convenience method to load properties from a servlet context resource
+ * @param resource - The target to read properties from
+ * @return the properties
+ */
+ protected Properties loadProperties(String resource) {
+ Properties result = new Properties();
+ InputStream in = null;
+ try {
+ URL location = context.getResource(resource);
+ if (location != null) {
+ in = location.openStream();
+ result.load(in);
+ }
+ } catch (MalformedURLException e) {
+ // no url to load from
+ } catch (IOException e) {
+ // its ok if there is no file
+ } finally {
+ if (in != null) {
+ try {
+ in.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+ return result;
+ }
+
+ /***************************************************************************
+ * See org.eclipse.core.launcher [copy of searchFor, findMax,
+ * compareVersion, getVersionElements] TODO: If these methods were made
+ * public and static we could use them directly
+ **************************************************************************/
+
+ /**
+ * Searches for the given target directory starting in the "plugins" subdirectory
+ * of the given location. If one is found then this location is returned;
+ * otherwise an exception is thrown.
+ * @param target
+ *
+ * @return the location where target directory was found
+ * @param start the location to begin searching
+ */
+ protected String searchFor(final String target, String start) {
+ FileFilter filter = new FileFilter() {
+ public boolean accept(File candidate) {
+ return candidate.getName().equals(target) || candidate.getName().startsWith(target + "_"); //$NON-NLS-1$
+ }
+ };
+ File[] candidates = new File(start).listFiles(filter);
+ if (candidates == null)
+ return null;
+ String[] arrays = new String[candidates.length];
+ for (int i = 0; i < arrays.length; i++) {
+ arrays[i] = candidates[i].getName();
+ }
+ int result = findMax(arrays);
+ if (result == -1)
+ return null;
+ return candidates[result].getAbsolutePath().replace(File.separatorChar, '/') + (candidates[result].isDirectory() ? "/" : ""); //$NON-NLS-1$//$NON-NLS-2$
+ }
+
+ protected int findMax(String[] candidates) {
+ int result = -1;
+ Object maxVersion = null;
+ for (int i = 0; i < candidates.length; i++) {
+ String name = candidates[i];
+ String version = ""; //$NON-NLS-1$ // Note: directory with version suffix is always > than directory without version suffix
+ int index = name.indexOf('_');
+ if (index != -1)
+ version = name.substring(index + 1);
+ Object currentVersion = getVersionElements(version);
+ if (maxVersion == null) {
+ result = i;
+ maxVersion = currentVersion;
+ } else {
+ if (compareVersion((Object[]) maxVersion, (Object[]) currentVersion) < 0) {
+ result = i;
+ maxVersion = currentVersion;
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Compares version strings.
+ * @param left
+ * @param right
+ * @return result of comparison, as integer;
+ * <code><0</code> if left < right;
+ * <code>0</code> if left == right;
+ * <code>>0</code> if left > right;
+ */
+ private int compareVersion(Object[] left, Object[] right) {
+
+ int result = ((Integer) left[0]).compareTo((Integer) right[0]); // compare major
+ if (result != 0)
+ return result;
+
+ result = ((Integer) left[1]).compareTo((Integer) right[1]); // compare minor
+ if (result != 0)
+ return result;
+
+ result = ((Integer) left[2]).compareTo((Integer) right[2]); // compare service
+ if (result != 0)
+ return result;
+
+ return ((String) left[3]).compareTo((String) right[3]); // compare qualifier
+ }
+
+ /**
+ * Do a quick parse of version identifier so its elements can be correctly compared.
+ * If we are unable to parse the full version, remaining elements are initialized
+ * with suitable defaults.
+ * @param version
+ * @return an array of size 4; first three elements are of type Integer (representing
+ * major, minor and service) and the fourth element is of type String (representing
+ * qualifier). Note, that returning anything else will cause exceptions in the caller.
+ */
+ private Object[] getVersionElements(String version) {
+ if (version.endsWith(".jar")) //$NON-NLS-1$
+ version = version.substring(0, version.length() - 4);
+ Object[] result = {new Integer(0), new Integer(0), new Integer(0), ""}; //$NON-NLS-1$
+ StringTokenizer t = new StringTokenizer(version, "."); //$NON-NLS-1$
+ String token;
+ int i = 0;
+ while (t.hasMoreTokens() && i < 4) {
+ token = t.nextToken();
+ if (i < 3) {
+ // major, minor or service ... numeric values
+ try {
+ result[i++] = new Integer(token);
+ } catch (Exception e) {
+ // invalid number format - use default numbers (0) for the rest
+ break;
+ }
+ } else {
+ // qualifier ... string value
+ result[i++] = token;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * The ChildFirstURLClassLoader alters regular ClassLoader delegation and will check the URLs
+ * used in its initialization for matching classes before delegating to it's parent.
+ * Sometimes also referred to as a ParentLastClassLoader
+ */
+ protected class ChildFirstURLClassLoader extends URLClassLoader {
+
+ public ChildFirstURLClassLoader(URL[] urls) {
+ super(urls);
+ }
+
+ public ChildFirstURLClassLoader(URL[] urls, ClassLoader parent) {
+ super(urls, parent);
+ }
+
+ public ChildFirstURLClassLoader(URL[] urls, ClassLoader parent, URLStreamHandlerFactory factory) {
+ super(urls, parent, factory);
+ }
+
+ public URL getResource(String name) {
+ URL resource = findResource(name);
+ if (resource == null) {
+ ClassLoader parent = getParent();
+ if (parent != null)
+ resource = parent.getResource(name);
+ }
+ return resource;
+ }
+
+ protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException {
+ Class clazz = findLoadedClass(name);
+ if (clazz == null) {
+ try {
+ clazz = findClass(name);
+ } catch (ClassNotFoundException e) {
+ ClassLoader parent = getParent();
+ if (parent != null)
+ clazz = parent.loadClass(name);
+ else
+ clazz = getSystemClassLoader().loadClass(name);
+ }
+ }
+
+ if (resolve)
+ resolveClass(clazz);
+
+ return clazz;
+ }
+
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.servletbridge/templates/WEB-INF/eclipse/.eclipseproduct b/bundles/org.eclipse.equinox.servletbridge/templates/WEB-INF/eclipse/.eclipseproduct
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/bundles/org.eclipse.equinox.servletbridge/templates/WEB-INF/eclipse/.eclipseproduct
diff --git a/bundles/org.eclipse.equinox.servletbridge/templates/WEB-INF/eclipse/configuration/config.ini b/bundles/org.eclipse.equinox.servletbridge/templates/WEB-INF/eclipse/configuration/config.ini
new file mode 100644
index 000000000..e7061bab5
--- /dev/null
+++ b/bundles/org.eclipse.equinox.servletbridge/templates/WEB-INF/eclipse/configuration/config.ini
@@ -0,0 +1,3 @@
+#Eclipse Runtime Configuration File
+osgi.bundles=org.eclipse.equinox.common@2:start, org.eclipse.update.configurator@start, org.eclipse.equinox.http.servletbridge@start, org.eclipse.equinox.http.registry@start
+osgi.bundles.defaultStartLevel=4
diff --git a/bundles/org.eclipse.equinox.servletbridge/templates/WEB-INF/eclipse/launch.ini b/bundles/org.eclipse.equinox.servletbridge/templates/WEB-INF/eclipse/launch.ini
new file mode 100644
index 000000000..5c35856f4
--- /dev/null
+++ b/bundles/org.eclipse.equinox.servletbridge/templates/WEB-INF/eclipse/launch.ini
@@ -0,0 +1,9 @@
+# Eclipse Runtime Configuration Overrides
+# These properties are loaded prior to starting the framework and can also be used to override System Properties
+# @null is a special value used to override and clear the frameworks copy of a System Property prior to starting the framework
+osgi.parentClassloader=ext
+osgi.contextClassLoaderParent=ext
+eclipse.ignoreApp=true
+osgi.noShutdown=true
+osgi.bundles=@null
+osgi.bundles.defaultStartLevel=@null
diff --git a/bundles/org.eclipse.equinox.servletbridge/templates/WEB-INF/eclipse/plugins/org.eclipse.equinox.servletbridge.extensionbundle_3.2.0/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.servletbridge/templates/WEB-INF/eclipse/plugins/org.eclipse.equinox.servletbridge.extensionbundle_3.2.0/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..7eee53fda
--- /dev/null
+++ b/bundles/org.eclipse.equinox.servletbridge/templates/WEB-INF/eclipse/plugins/org.eclipse.equinox.servletbridge.extensionbundle_3.2.0/META-INF/MANIFEST.MF
@@ -0,0 +1,9 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Servletbridge Extension Bundle
+Bundle-SymbolicName: org.eclipse.equinox.servletbridge.extensionbundle
+Fragment-Host: system.bundle; extension:=framework
+Bundle-Version: 1.0.0
+Export-Package: org.eclipse.equinox.servletbridge,
+ javax.servlet; version=2.3,
+ javax.servlet.http; version=2.3
diff --git a/bundles/org.eclipse.equinox.servletbridge/templates/WEB-INF/web.xml b/bundles/org.eclipse.equinox.servletbridge/templates/WEB-INF/web.xml
new file mode 100644
index 000000000..563f9dcb0
--- /dev/null
+++ b/bundles/org.eclipse.equinox.servletbridge/templates/WEB-INF/web.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
+<web-app id="WebApp">
+ <servlet id="bridge">
+ <servlet-name>equinoxbridgeservlet</servlet-name>
+ <display-name>Equinox Bridge Servlet</display-name>
+ <description>Equinox Bridge Servlet</description>
+ <servlet-class>org.eclipse.equinox.servletbridge.BridgeServlet</servlet-class>
+ <init-param>
+ <param-name>commandline</param-name>
+ <param-value>-console</param-value>
+ </init-param>
+ <init-param>
+ <param-name>enableFrameworkControls</param-name>
+ <param-value>true</param-value>
+ </init-param>
+ <!--
+ You can specify your own framework launcher here.
+ The default is: org.eclipse.equinox.servletbridge.FrameworkLauncher
+ <init-param>
+ <param-name>frameworkLauncherClass</param-name>
+ <param-value>org.eclipse.equinox.servletbridge.FrameworkLauncher</param-value>
+ </init-param>
+ -->
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>equinoxbridgeservlet</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+</web-app>

Back to the top