Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Auge2016-01-14 12:10:21 +0000
committerRaymond Auge2016-01-14 12:10:21 +0000
commitd697189047e4dde27d001ae177b78a663fd9d9f0 (patch)
tree0cc0bdd32e7d22c36d66c978be45621da1818e23 /bundles
parent219ee5019313bcc58ae855ae56aa88b7b3b0622a (diff)
downloadrt.equinox.bundles-d697189047e4dde27d001ae177b78a663fd9d9f0.tar.gz
rt.equinox.bundles-d697189047e4dde27d001ae177b78a663fd9d9f0.tar.xz
rt.equinox.bundles-d697189047e4dde27d001ae177b78a663fd9d9f0.zip
Bug 479124 - [http] Mars SR1 version of org.eclipse.equinox.http.jetty incompatible with Apache commons fileupload
Signed-off-by: Raymond Auge <raymond.auge@liferay.com>
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.equinox.http.jetty9/src/org/eclipse/equinox/http/jetty/internal/Activator.java15
-rw-r--r--bundles/org.eclipse.equinox.http.jetty9/src/org/eclipse/equinox/http/jetty/internal/HttpServerManager.java18
-rw-r--r--bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/ServletTest.java10
3 files changed, 36 insertions, 7 deletions
diff --git a/bundles/org.eclipse.equinox.http.jetty9/src/org/eclipse/equinox/http/jetty/internal/Activator.java b/bundles/org.eclipse.equinox.http.jetty9/src/org/eclipse/equinox/http/jetty/internal/Activator.java
index ef142d7f..210e29d3 100644
--- a/bundles/org.eclipse.equinox.http.jetty9/src/org/eclipse/equinox/http/jetty/internal/Activator.java
+++ b/bundles/org.eclipse.equinox.http.jetty9/src/org/eclipse/equinox/http/jetty/internal/Activator.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2005, 2015 Cognos Incorporated, IBM Corporation and others.
+ * Copyright (c) 2005, 2016 Cognos Incorporated, IBM Corporation and others.
* 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 - bug fixes and enhancements
+ * Raymond Augé - bug fixes
*******************************************************************************/
package org.eclipse.equinox.http.jetty.internal;
@@ -42,6 +43,9 @@ public class Activator implements BundleActivator {
// (default threshold is "warn")
private static final String LOG_STDERR_THRESHOLD = "org.eclipse.equinox.http.jetty.log.stderr.threshold"; //$NON-NLS-1$
+ // Jetty will not have Servlet 3 multipart
+ private static final String SERVLET3_MULTIPART = "org.eclipse.equinox.http.jetty.servlet3.multipart"; //$NON-NLS-1$
+
// The staticServerManager is use by the start and stopServer methods and must be accessed in a static synchronized block
// to ensure it is correctly handled in terms of the bundle life-cycle.
private static HttpServerManager staticServerManager;
@@ -51,11 +55,16 @@ public class Activator implements BundleActivator {
private ServiceRegistration registration;
public void start(BundleContext context) throws Exception {
- File jettyWorkDir = new File(context.getDataFile(""), JETTY_WORK_DIR); //$NON-NLS-1$
+ File jettyWorkDir = new File(context.getDataFile(""), JETTY_WORK_DIR); //$NON-NLS-1$
jettyWorkDir.mkdir();
EquinoxStdErrLog.setThresholdLogger(context.getProperty(LOG_STDERR_THRESHOLD));
httpServerManager = new HttpServerManager(jettyWorkDir);
+ String servlet3multipart = context.getProperty(SERVLET3_MULTIPART);
+ if ((servlet3multipart != null) && Boolean.valueOf(servlet3multipart).booleanValue()) {
+ httpServerManager.setServlet3multipart(Boolean.valueOf(servlet3multipart).booleanValue());
+ }
+
String autostart = context.getProperty(AUTOSTART);
if ((autostart == null || Boolean.valueOf(autostart).booleanValue()) && !isBundleActivationPolicyUsed(context)) {
Dictionary<String, Object> defaultSettings = createDefaultSettings(context);
diff --git a/bundles/org.eclipse.equinox.http.jetty9/src/org/eclipse/equinox/http/jetty/internal/HttpServerManager.java b/bundles/org.eclipse.equinox.http.jetty9/src/org/eclipse/equinox/http/jetty/internal/HttpServerManager.java
index 2d8ef58d..2371e468 100644
--- a/bundles/org.eclipse.equinox.http.jetty9/src/org/eclipse/equinox/http/jetty/internal/HttpServerManager.java
+++ b/bundles/org.eclipse.equinox.http.jetty9/src/org/eclipse/equinox/http/jetty/internal/HttpServerManager.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2007, 2015 IBM Corporation and others.
+ * Copyright (c) 2007, 2016 IBM Corporation and others.
* 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:
* IBM Corporation - initial API and implementation
* Red Hat, Inc. - Jetty 9 adoption.
+ * Raymond Augé - bug fixes
*******************************************************************************/
package org.eclipse.equinox.http.jetty.internal;
@@ -43,6 +44,7 @@ public class HttpServerManager implements ManagedServiceFactory {
private Map<String, Server> servers = new HashMap<String, Server>();
private File workDir;
+ private boolean servlet3multipart = false;
public HttpServerManager(File workDir) {
this.workDir = workDir;
@@ -54,7 +56,7 @@ public class HttpServerManager implements ManagedServiceFactory {
try {
server.stop();
} catch (Exception e) {
- // TODO: consider logging this, but we should still continue cleaning up
+ // TODO: consider logging this, but we should still continue cleaning up
e.printStackTrace();
}
File contextWorkDir = new File(workDir, DIR_PREFIX + pid.hashCode());
@@ -149,6 +151,10 @@ public class HttpServerManager implements ManagedServiceFactory {
servers.put(pid, server);
}
+ public void setServlet3multipart(boolean servlet3multipart) {
+ this.servlet3multipart = servlet3multipart;
+ }
+
private ServerConnector createHttpsConnector(@SuppressWarnings("rawtypes") Dictionary dictionary, Server server, HttpConfiguration http_config) {
ServerConnector httpsConnector = null;
if (isHttpsEnabled(dictionary)) {
@@ -327,7 +333,7 @@ public class HttpServerManager implements ManagedServiceFactory {
try {
return (JettyCustomizer) Class.forName(customizerClass).newInstance();
} catch (Exception e) {
- // TODO: consider logging this, but we should still continue
+ // TODO: consider logging this, but we should still continue
e.printStackTrace();
return null;
}
@@ -425,6 +431,10 @@ public class HttpServerManager implements ManagedServiceFactory {
}
private void setupMultiPartConfig(@SuppressWarnings("rawtypes") Dictionary dictionary, ServletHolder holder) {
+ if (!servlet3multipart) {
+ return;
+ }
+
MultipartConfigElement multipartConfigElement = new MultipartConfigElement(System.getProperty("java.io.tmpdir")); //$NON-NLS-1$
holder.getRegistration().setMultipartConfig(multipartConfigElement);
}
diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/ServletTest.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/ServletTest.java
index b2eb491e..a292261f 100644
--- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/ServletTest.java
+++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/ServletTest.java
@@ -1806,6 +1806,11 @@ public class ServletTest extends TestCase {
* 3.1 file uploads
*/
public void test_Servlet16() throws Exception {
+ String servlet3multipart = getProperty("org.eclipse.equinox.http.jetty.servlet3.multipart");
+ if ((servlet3multipart == null) || !Boolean.valueOf(servlet3multipart).booleanValue()) {
+ return;
+ }
+
Servlet servlet = new HttpServlet() {
private static final long serialVersionUID = 1L;
@@ -1848,6 +1853,11 @@ public class ServletTest extends TestCase {
* 3.0 file uploads
*/
public void test_Servlet17() throws Exception {
+ String servlet3multipart = getProperty("org.eclipse.equinox.http.jetty.servlet3.multipart");
+ if ((servlet3multipart == null) || !Boolean.valueOf(servlet3multipart).booleanValue()) {
+ return;
+ }
+
Servlet servlet = new HttpServlet() {
private static final long serialVersionUID = 1L;

Back to the top