From 5df7eda553d8b0a164e2f2050c1b59b83461eedf Mon Sep 17 00:00:00 2001 From: Ivan Furnadjiev Date: Fri, 5 Apr 2019 11:39:11 +0300 Subject: Fix package export for Servlet 3.1 specification For historical reasons (bug 360245), the exported by FrameworkLauncher#generateExtensionBundle package version of "javax.servlet.*" for Servlet 3.1 specification is 2.7. With the recent changes in "org.eclipse.equinox.http.servlet" MANIFEST.MF, the required "javax.servlet.*" package version is 3.1 (same as servlet spec). Change FrameworkLauncher#generateExtensionBundle to export "javax.servlet.*" for Servlet 3.1 as both 2.7 and 3.1. Bug 545682: org.eclipse.equinox.http.servlet and org.eclipse.equinox.servletbridge do not work together anymore in Tomcat 8.5.x Change-Id: I06fe1543400518ba3ea1104c8ceac52cfb6e567a Signed-off-by: Ivan Furnadjiev Signed-off-by: Thomas Watson --- .../META-INF/MANIFEST.MF | 2 +- bundles/org.eclipse.equinox.servletbridge/pom.xml | 2 +- .../equinox/servletbridge/FrameworkLauncher.java | 48 ++++++++++++---------- 3 files changed, 29 insertions(+), 23 deletions(-) diff --git a/bundles/org.eclipse.equinox.servletbridge/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.servletbridge/META-INF/MANIFEST.MF index b2c256203..75ff7c8c8 100644 --- a/bundles/org.eclipse.equinox.servletbridge/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.servletbridge/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: %bundleName Bundle-Vendor: %providerName Bundle-SymbolicName: org.eclipse.equinox.servletbridge;singleton:=true -Bundle-Version: 1.4.200.qualifier +Bundle-Version: 1.5.0.qualifier Bundle-Localization: plugin Import-Package: javax.servlet;version="2.3.0", javax.servlet.http;version="2.3.0" diff --git a/bundles/org.eclipse.equinox.servletbridge/pom.xml b/bundles/org.eclipse.equinox.servletbridge/pom.xml index 9c9fc63c8..560952552 100644 --- a/bundles/org.eclipse.equinox.servletbridge/pom.xml +++ b/bundles/org.eclipse.equinox.servletbridge/pom.xml @@ -19,6 +19,6 @@ org.eclipse.equinox org.eclipse.equinox.servletbridge - 1.4.200-SNAPSHOT + 1.5.0-SNAPSHOT eclipse-plugin 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 index 01e6f58f1..76d84a6ca 100644 --- 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2018 Cognos Incorporated, IBM Corporation and others. + * Copyright (c) 2005, 2019 Cognos Incorporated, IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -7,7 +7,7 @@ * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 - * + * * Contributors: * Cognos Incorporated - initial API and implementation * IBM Corporation - bug fixes and enhancements @@ -34,10 +34,10 @@ import javax.servlet.ServletContext; * 4) stop * 5) undeploy * 6) destroy - * an instance of the OSGi framework. + * an instance of the OSGi framework. * These 6 methods are provided to help manage the life-cycle and are called from outside this * class by the BridgeServlet. To create an extended FrameworkLauncher over-ride these methods to allow - * custom behavior. + * custom behavior. */ public class FrameworkLauncher { @@ -112,7 +112,7 @@ public class FrameworkLauncher { }; static { - // We do this to ensure the anonymous Enumeration class in allPermissions is pre-loaded + // We do this to ensure the anonymous Enumeration class in allPermissions is pre-loaded if (allPermissions.elements() == null) throw new IllegalStateException(); } @@ -273,12 +273,18 @@ public class FrameworkLauncher { // We know spec version 3.0 corresponds to package version 2.6 // we are guessing future 3.x spec versions will increment package versions minor, so ... String servletVersion = (context.getMajorVersion() - 1) + "." + (context.getMinorVersion() + 6); //$NON-NLS-1$ + String specVersion = context.getMajorVersion() + "." + context.getMinorVersion(); //$NON-NLS-1$ packageExports = "org.eclipse.equinox.servletbridge; version=1.1" + //$NON-NLS-1$ ", javax.servlet; version=" + servletVersion + //$NON-NLS-1$ + ", javax.servlet; version=" + specVersion + //$NON-NLS-1$ ", javax.servlet.annotation; version=" + servletVersion + //$NON-NLS-1$ + ", javax.servlet.annotation; version=" + specVersion + //$NON-NLS-1$ ", javax.servlet.descriptor; version=" + servletVersion + //$NON-NLS-1$ + ", javax.servlet.descriptor; version=" + specVersion + //$NON-NLS-1$ ", javax.servlet.http; version=" + servletVersion + //$NON-NLS-1$ - ", javax.servlet.resources; version=" + servletVersion; //$NON-NLS-1$ + ", javax.servlet.http; version=" + specVersion + //$NON-NLS-1$ + ", javax.servlet.resources; version=" + servletVersion + //$NON-NLS-1$ + ", javax.servlet.resources; version=" + specVersion; //$NON-NLS-1$ } else { // We know spec version 2.x directly correspond to package versions String servletVersion = context.getMajorVersion() + "." + context.getMinorVersion(); //$NON-NLS-1$ @@ -343,7 +349,7 @@ public class FrameworkLauncher { } /** 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 + * 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. */ @@ -370,7 +376,7 @@ public class FrameworkLauncher { /** start is used to "start" a previously deployed OSGi framework * The default behavior 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. + * available when starting Eclipse. */ public synchronized void start() { if (platformDirectory == null) @@ -684,7 +690,7 @@ public class FrameworkLauncher { } /** - * buildCommandLineArguments parses the commandline config parameter into a set of arguments + * buildCommandLineArguments parses the commandline config parameter into a set of arguments * @return an array of String containing the commandline arguments */ protected String[] buildCommandLineArguments() { @@ -696,9 +702,9 @@ public class FrameworkLauncher { while (tokenizer.hasMoreTokens()) { String arg = tokenizer.nextToken(); if (arg.startsWith("\"")) { //$NON-NLS-1$ - if (arg.endsWith("\"")) { //$NON-NLS-1$ + if (arg.endsWith("\"")) { //$NON-NLS-1$ if (arg.length() >= 2) { - // strip the beginning and ending quotes + // strip the beginning and ending quotes arg = arg.substring(1, arg.length() - 1); } } else { @@ -708,9 +714,9 @@ public class FrameworkLauncher { tokenizer.nextToken(WS_DELIM); } } else if (arg.startsWith("'")) { //$NON-NLS-1$ - if (arg.endsWith("'")) { //$NON-NLS-1$ + if (arg.endsWith("'")) { //$NON-NLS-1$ if (arg.length() >= 2) { - // strip the beginning and ending quotes + // strip the beginning and ending quotes arg = arg.substring(1, arg.length() - 1); } } else { @@ -758,7 +764,7 @@ public class FrameworkLauncher { Thread.currentThread().setContextClassLoader(frameworkContextClassLoader); method.invoke(clazz); - // ACL keys its loggers off of the ContextClassLoader which prevents GC without calling release. + // 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$ @@ -901,10 +907,10 @@ public class FrameworkLauncher { /** * Searches for the given target directory starting in the "plugins" subdirectory - * of the given location. If one is found then this location is returned; + * of the given location. If one is found then this location is returned; * otherwise an exception is thrown. - * @param target - * + * @param target + * * @return the location where target directory was found * @param start the location to begin searching */ @@ -952,9 +958,9 @@ public class FrameworkLauncher { } /** - * Compares version strings. - * @param left - * @param right + * Compares version strings. + * @param left + * @param right * @return result of comparison, as integer; * <0 if left < right; * 0 if left == right; @@ -981,7 +987,7 @@ public class FrameworkLauncher { * 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 + * @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. -- cgit v1.2.3