diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/.classpath b/bundles/org.eclipse.equinox.http.servlet.tests/.classpath index 5a135638408..fd856c7cd14 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/.classpath +++ b/bundles/org.eclipse.equinox.http.servlet.tests/.classpath @@ -1,6 +1,6 @@ - + diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.http.servlet.tests/.settings/org.eclipse.jdt.core.prefs index 60ef89a9202..477051282e3 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.http.servlet.tests/.settings/org.eclipse.jdt.core.prefs @@ -10,9 +10,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary= org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=17 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -27,6 +27,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -72,6 +73,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled @@ -110,8 +112,8 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.release=disabled -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=17 org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.http.servlet.tests/META-INF/MANIFEST.MF index 1f94e3d52bd..806758dd8b1 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.http.servlet.tests/META-INF/MANIFEST.MF @@ -3,8 +3,8 @@ Bundle-ManifestVersion: 2 Bundle-Name: org.eclipse.equinox.http.servlet.tests Bundle-Vendor: Eclipse.org - Equinox Bundle-SymbolicName: org.eclipse.equinox.http.servlet.tests -Bundle-Version: 1.8.500.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-Version: 1.9.0.qualifier +Bundle-RequiredExecutionEnvironment: JavaSE-17 Eclipse-BundleShape: dir Require-Bundle: org.junit;bundle-version="4.0", org.apache.felix.scr, diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter1.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter1.java index 07fac76fec4..5d5de637baf 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter1.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter1.java @@ -38,7 +38,7 @@ public class TestFilter1 extends AbstractTestServlet { public void activate(ComponentContext componentContext) throws ServletException, NamespaceException { ExtendedHttpService service = (ExtendedHttpService)getHttpService(); service.registerServlet(regexAlias(), this, null, null); - service.registerFilter(regexAlias(), f1, new Hashtable(), null); + service.registerFilter(regexAlias(), f1, new Hashtable<>(), null); } @Override diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter2.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter2.java index 2c8128cd9e7..c418fe0cda9 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter2.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter2.java @@ -38,8 +38,8 @@ public class TestFilter2 extends AbstractTestServlet { public void activate(ComponentContext componentContext) throws ServletException, NamespaceException { ExtendedHttpService service = (ExtendedHttpService)getHttpService(); service.registerServlet(regexAlias(), this, null, null); - service.registerFilter(regexAlias(), f1, new Hashtable(), null); - service.registerFilter(regexAlias(), f2, new Hashtable(), null); + service.registerFilter(regexAlias(), f1, new Hashtable<>(), null); + service.registerFilter(regexAlias(), f2, new Hashtable<>(), null); } @Override diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter3.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter3.java index bfb776c7059..4353bc2bb23 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter3.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter3.java @@ -38,9 +38,9 @@ public class TestFilter3 extends AbstractTestServlet { public void activate(ComponentContext componentContext) throws ServletException, NamespaceException { ExtendedHttpService service = (ExtendedHttpService)getHttpService(); service.registerServlet(regexAlias(), this, null, null); - service.registerFilter(regexAlias(), f1, new Hashtable(), null); - service.registerFilter(regexAlias(), f2, new Hashtable(), null); - service.registerFilter(regexAlias(), f3, new Hashtable(), null); + service.registerFilter(regexAlias(), f1, new Hashtable<>(), null); + service.registerFilter(regexAlias(), f2, new Hashtable<>(), null); + service.registerFilter(regexAlias(), f3, new Hashtable<>(), null); } @Override diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter4.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter4.java index f7f0008f758..8f20a3dd90b 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter4.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter4.java @@ -38,8 +38,8 @@ public class TestFilter4 extends AbstractTestServlet { public void activate(ComponentContext componentContext) throws ServletException, NamespaceException { ExtendedHttpService service = (ExtendedHttpService)getHttpService(); service.registerServlet(regexAlias(), this, null, null); - service.registerFilter(regexAlias(), f1, new Hashtable(), null); - service.registerFilter(regexAlias(), f2, new Hashtable(), null); + service.registerFilter(regexAlias(), f1, new Hashtable<>(), null); + service.registerFilter(regexAlias(), f2, new Hashtable<>(), null); Hashtable hashtable = new Hashtable<>(); hashtable.put("filter-priority", "1"); service.registerFilter(regexAlias(), f3, hashtable, null); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter5.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter5.java index a6ac399f59d..6c80898e3b6 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter5.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter5.java @@ -38,7 +38,7 @@ public class TestFilter5 extends AbstractTestServlet { public void activate(ComponentContext componentContext) throws ServletException, NamespaceException { ExtendedHttpService service = (ExtendedHttpService)getHttpService(); service.registerServlet(extensionAlias(), this, null, null); - service.registerFilter(extensionAlias(), f1, new Hashtable(), null); + service.registerFilter(extensionAlias(), f1, new Hashtable<>(), null); } @Override diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter6.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter6.java index d8b930aef83..ff8a89793dc 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter6.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter6.java @@ -38,8 +38,8 @@ public class TestFilter6 extends AbstractTestServlet { public void activate(ComponentContext componentContext) throws ServletException, NamespaceException { ExtendedHttpService service = (ExtendedHttpService)getHttpService(); service.registerServlet(extensionAlias(), this, null, null); - service.registerFilter(extensionAlias(), f1, new Hashtable(), null); - service.registerFilter(extensionAlias(), f2, new Hashtable(), null); + service.registerFilter(extensionAlias(), f1, new Hashtable<>(), null); + service.registerFilter(extensionAlias(), f2, new Hashtable<>(), null); } @Override diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter7.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter7.java index 0680ca4feb2..7b5c6eaf1dc 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter7.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter7.java @@ -38,9 +38,9 @@ public class TestFilter7 extends AbstractTestServlet { public void activate(ComponentContext componentContext) throws ServletException, NamespaceException { ExtendedHttpService service = (ExtendedHttpService)getHttpService(); service.registerServlet(extensionAlias(), this, null, null); - service.registerFilter(extensionAlias(), f1, new Hashtable(), null); - service.registerFilter(extensionAlias(), f2, new Hashtable(), null); - service.registerFilter(extensionAlias(), f3, new Hashtable(), null); + service.registerFilter(extensionAlias(), f1, new Hashtable<>(), null); + service.registerFilter(extensionAlias(), f2, new Hashtable<>(), null); + service.registerFilter(extensionAlias(), f3, new Hashtable<>(), null); } @Override diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter8.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter8.java index 8e6dd555493..ee67ec91e0e 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter8.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter8.java @@ -38,8 +38,8 @@ public class TestFilter8 extends AbstractTestServlet { public void activate(ComponentContext componentContext) throws ServletException, NamespaceException { ExtendedHttpService service = (ExtendedHttpService)getHttpService(); service.registerServlet(extensionAlias(), this, null, null); - service.registerFilter(extensionAlias(), f1, new Hashtable(), null); - service.registerFilter(extensionAlias(), f2, new Hashtable(), null); + service.registerFilter(extensionAlias(), f1, new Hashtable<>(), null); + service.registerFilter(extensionAlias(), f2, new Hashtable<>(), null); Hashtable hashtable = new Hashtable<>(); hashtable.put("filter-priority", "1"); service.registerFilter(extensionAlias(), f3, hashtable, null); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestResource2.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestResource2.java index 8e1acb500bf..59b55c9f3a2 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestResource2.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestResource2.java @@ -22,7 +22,6 @@ import org.eclipse.equinox.http.servlet.ExtendedHttpService; import org.eclipse.equinox.http.servlet.tests.tb.AbstractTestResource; import org.eclipse.equinox.http.servlet.tests.util.BaseFilter; - import org.osgi.service.component.ComponentContext; import org.osgi.service.http.NamespaceException; @@ -35,9 +34,9 @@ public class TestResource2 extends AbstractTestResource { public void activate(ComponentContext componentContext) throws ServletException, NamespaceException { ExtendedHttpService service = (ExtendedHttpService)getHttpService(); service.registerResources(regexAlias(), getName() , null); - service.registerFilter(regexAlias(), f1, new Hashtable(), null); - service.registerFilter(regexAlias(), f2, new Hashtable(), null); - service.registerFilter(regexAlias(), f3, new Hashtable(), null); + service.registerFilter(regexAlias(), f1, new Hashtable<>(), null); + service.registerFilter(regexAlias(), f2, new Hashtable<>(), null); + service.registerFilter(regexAlias(), f3, new Hashtable<>(), null); } @Override diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestResource4.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestResource4.java index f91c960cf0d..bea7be44652 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestResource4.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestResource4.java @@ -34,8 +34,8 @@ public class TestResource4 extends AbstractTestResource { public void activate(ComponentContext componentContext) throws ServletException, NamespaceException { ExtendedHttpService service = (ExtendedHttpService)getHttpService(); service.registerResources(regexAlias(), getName() , null); - service.registerFilter(regexAlias(), f1, new Hashtable(), null); - service.registerFilter(regexAlias(), f2, new Hashtable(), null); + service.registerFilter(regexAlias(), f1, new Hashtable<>(), null); + service.registerFilter(regexAlias(), f2, new Hashtable<>(), null); Hashtable hashtable = new Hashtable<>(); hashtable.put("filter-priority", "1"); service.registerFilter(regexAlias(), f3, hashtable, null); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_7_validation.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_7_validation.java index 6ad7379819e..d6bceafd359 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_7_validation.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_7_validation.java @@ -22,7 +22,6 @@ import java.util.Hashtable; import java.util.concurrent.atomic.AtomicReference; -import javax.servlet.ServletContext; import javax.servlet.ServletContextListener; import org.eclipse.equinox.http.servlet.testbase.BaseTest; @@ -44,7 +43,7 @@ public void test_140_7_validation() { Dictionary properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_LISTENER, "true"); ServiceRegistration sr = context.registerService( - ServletContextListener.class, new MockSCL(new AtomicReference()), properties); + ServletContextListener.class, new MockSCL(new AtomicReference<>()), properties); registrations.add(sr); ListenerDTO listenerDTO = getListenerDTOByServiceId(DEFAULT, getServiceId(sr)); diff --git a/bundles/org.eclipse.equinox.http.servlet/.classpath b/bundles/org.eclipse.equinox.http.servlet/.classpath index eca7bdba8f0..81fe078c20c 100644 --- a/bundles/org.eclipse.equinox.http.servlet/.classpath +++ b/bundles/org.eclipse.equinox.http.servlet/.classpath @@ -1,6 +1,6 @@ - + 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 index 560313cc6c0..83a8550f989 100644 --- 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 @@ -16,9 +16,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul org.eclipse.jdt.core.compiler.annotation.nullable.secondary= org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=17 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -34,6 +34,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=error org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning @@ -87,6 +88,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=igno org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled @@ -120,8 +122,8 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=warning org.eclipse.jdt.core.compiler.problem.unusedWarningToken=error org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.release=disabled -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=17 org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false diff --git a/bundles/org.eclipse.equinox.http.servlet/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.http.servlet/META-INF/MANIFEST.MF index 4ca9a4bbc91..a09125e9cf5 100644 --- a/bundles/org.eclipse.equinox.http.servlet/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.http.servlet/META-INF/MANIFEST.MF @@ -3,10 +3,10 @@ Bundle-ManifestVersion: 2 Bundle-Name: %bundleName Bundle-Vendor: %providerName Bundle-SymbolicName: org.eclipse.equinox.http.servlet -Bundle-Version: 1.7.400.qualifier +Bundle-Version: 1.8.0.qualifier Bundle-Activator: org.eclipse.equinox.http.servlet.internal.Activator Bundle-Localization: plugin -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-17 Export-Package: org.eclipse.equinox.http.servlet;version="1.2.0", org.eclipse.equinox.http.servlet.context;version="1.0.0";x-internal:=true, org.eclipse.equinox.http.servlet.session;version="1.0.0";x-internal:=true, 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 index c1f6a28bfe7..a97c8743f1f 100644 --- 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 @@ -72,12 +72,9 @@ public synchronized void registerFilter( final HttpContextHolder httpContextHolder = getHttpContextHolder(httpContext); try { - AccessController.doPrivileged(new PrivilegedExceptionAction() { - @Override - public Void run() { - httpServiceRuntime.registerHttpServiceFilter(bundle, alias, filter, initparams, httpContextHolder); - return null; - } + AccessController.doPrivileged((PrivilegedExceptionAction) () -> { + httpServiceRuntime.registerHttpServiceFilter(bundle, alias, filter, initparams, httpContextHolder); + return null; }); } catch (PrivilegedActionException e) { @@ -105,12 +102,9 @@ public synchronized void registerResources( checkShutdown(); final HttpContextHolder httpContextHolder = getHttpContextHolder(httpContext); try { - AccessController.doPrivileged(new PrivilegedExceptionAction() { - @Override - public Void run() throws NamespaceException { - httpServiceRuntime.registerHttpServiceResources(bundle, alias, name, httpContextHolder); - return null; - } + AccessController.doPrivileged((PrivilegedExceptionAction) () -> { + httpServiceRuntime.registerHttpServiceResources(bundle, alias, name, httpContextHolder); + return null; }); } catch (PrivilegedActionException e) { Throw.unchecked(e.getException()); diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/ResourceServlet.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/ResourceServlet.java index 4a9d70f6e41..17c29f09f3a 100644 --- a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/ResourceServlet.java +++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/ResourceServlet.java @@ -70,107 +70,103 @@ public void service(HttpServletRequest req, final HttpServletResponse resp) thro private void writeResource(final HttpServletRequest req, final HttpServletResponse resp, final String resourcePath, final URL resourceURL) throws IOException { try { - AccessController.doPrivileged(new PrivilegedExceptionAction() { - - @Override - public Boolean run() throws Exception { - URLConnection connection = resourceURL.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; - } + AccessController.doPrivileged((PrivilegedExceptionAction) () -> { + URLConnection connection = resourceURL.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; + } - 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; - } + 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; + } - String rangeHeader = req.getHeader(RANGE); - Range range = null; - if (rangeHeader != null) { - range = Range.createFromRangeHeader(rangeHeader); - range.completeLength = contentLength; - range.updateBytePos(); - - if (!range.isValid()) { - resp.setHeader(ACCEPT_RANGES, RANGE_UNIT_BYTES); - resp.setStatus(HttpServletResponse.SC_REQUESTED_RANGE_NOT_SATISFIABLE); - return Boolean.TRUE; - } + String rangeHeader = req.getHeader(RANGE); + Range range = null; + if (rangeHeader != null) { + range = Range.createFromRangeHeader(rangeHeader); + range.completeLength = contentLength; + range.updateBytePos(); + + if (!range.isValid()) { + resp.setHeader(ACCEPT_RANGES, RANGE_UNIT_BYTES); + resp.setStatus(HttpServletResponse.SC_REQUESTED_RANGE_NOT_SATISFIABLE); + return Boolean.TRUE; } + } - // return the full contents regularly - if (contentLength != -1) - resp.setContentLength(contentLength); + // return the full contents regularly + if (contentLength != -1) + resp.setContentLength(contentLength); - String filename = new File(resourcePath).getName(); - String contentType = servletContextHelper.getMimeType(filename); - if (contentType == null) - contentType = getServletConfig().getServletContext().getMimeType(filename); + String filename = new File(resourcePath).getName(); + String contentType = servletContextHelper.getMimeType(filename); + if (contentType == null) + contentType = getServletConfig().getServletContext().getMimeType(filename); - if (contentType != null) - resp.setContentType(contentType); + if (contentType != null) + resp.setContentType(contentType); - if (lastModified > 0) - resp.setDateHeader(LAST_MODIFIED, lastModified); + if (lastModified > 0) + resp.setDateHeader(LAST_MODIFIED, lastModified); - if (etag != null) - resp.setHeader(ETAG, etag); + if (etag != null) + resp.setHeader(ETAG, etag); - if (range == null && - (servletContextHelper instanceof RangeAwareServletContextHelper) && - ((RangeAwareServletContextHelper)servletContextHelper).rangeableContentType(contentType, req.getHeader("User-Agent"))) { //$NON-NLS-1$ + if (range == null && + (servletContextHelper instanceof RangeAwareServletContextHelper) && + ((RangeAwareServletContextHelper)servletContextHelper).rangeableContentType(contentType, req.getHeader("User-Agent"))) { //$NON-NLS-1$ - range = new Range(); - range.firstBytePos = 0; - range.completeLength = contentLength; - range.updateBytePos(); - } + range = new Range(); + range.firstBytePos = 0; + range.completeLength = contentLength; + range.updateBytePos(); + } - if (range != null) { - resp.setStatus(HttpServletResponse.SC_PARTIAL_CONTENT); - resp.setHeader(ACCEPT_RANGES, RANGE_UNIT_BYTES); - resp.setContentLength(range.contentLength()); - resp.setHeader(CONTENT_RANGE, RANGE_UNIT_BYTES + " " + range.firstBytePos + "-" + range.lastBytePos + "/" + range.completeLength); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } + if (range != null) { + resp.setStatus(HttpServletResponse.SC_PARTIAL_CONTENT); + resp.setHeader(ACCEPT_RANGES, RANGE_UNIT_BYTES); + resp.setContentLength(range.contentLength()); + resp.setHeader(CONTENT_RANGE, RANGE_UNIT_BYTES + " " + range.firstBytePos + "-" + range.lastBytePos + "/" + range.completeLength); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } - if (contentLength != 0) { - // open the input stream - try (InputStream is = connection.getInputStream()) { - // write the resource - try { - OutputStream os = resp.getOutputStream(); - int writtenContentLength = writeResourceToOutputStream(is, os, range); - if (contentLength == -1 || contentLength != writtenContentLength) - resp.setContentLength(writtenContentLength); - } catch (IllegalStateException e) { // can occur if the response output is already open as a Writer - Writer writer = resp.getWriter(); - writeResourceToWriter(is, writer, range); - // Since ContentLength is a measure of the number of bytes contained in the body - // of a message when we use a Writer we lose control of the exact byte count and - // defer the problem to the Servlet Engine's Writer implementation. - } - } catch (FileNotFoundException | SecurityException e) { - // SecurityException may indicate the following scenarios - // - url is not accessible - sendError(resp, HttpServletResponse.SC_FORBIDDEN); + if (contentLength != 0) { + // open the input stream + try (InputStream is = connection.getInputStream()) { + // write the resource + try { + OutputStream os = resp.getOutputStream(); + int writtenContentLength = writeResourceToOutputStream(is, os, range); + if (contentLength == -1 || contentLength != writtenContentLength) + resp.setContentLength(writtenContentLength); + } catch (IllegalStateException e) { // can occur if the response output is already open as a Writer + Writer writer = resp.getWriter(); + writeResourceToWriter(is, writer, range); + // Since ContentLength is a measure of the number of bytes contained in the body + // of a message when we use a Writer we lose control of the exact byte count and + // defer the problem to the Servlet Engine's Writer implementation. } + } catch (FileNotFoundException | SecurityException e) { + // SecurityException may indicate the following scenarios + // - url is not accessible + sendError(resp, HttpServletResponse.SC_FORBIDDEN); } - return Boolean.TRUE; } + return Boolean.TRUE; }, acc); } catch (PrivilegedActionException e) { throw (IOException) e.getException(); diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/ServletContextAdaptor.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/ServletContextAdaptor.java index 199f06b8d40..7fdde3bcc55 100644 --- a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/ServletContextAdaptor.java +++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/ServletContextAdaptor.java @@ -158,12 +158,7 @@ public String getMimeType(final String name) { try { mimeType = AccessController.doPrivileged( - new PrivilegedExceptionAction() { - @Override - public String run() throws Exception { - return servletContextHelper.getMimeType(name); - } - }, acc + (PrivilegedExceptionAction) () -> servletContextHelper.getMimeType(name), acc ); } catch (PrivilegedActionException e) { @@ -187,12 +182,7 @@ public RequestDispatcher getNamedDispatcher(String servletName) { public String getRealPath(final String path) { try { return AccessController.doPrivileged( - new PrivilegedExceptionAction() { - @Override - public String run() throws Exception { - return servletContextHelper.getRealPath(path); - } - }, acc + (PrivilegedExceptionAction) () -> servletContextHelper.getRealPath(path), acc ); } catch (PrivilegedActionException e) { @@ -224,12 +214,7 @@ public RequestDispatcher getRequestDispatcher(String path) { public URL getResource(final String name) { try { return AccessController.doPrivileged( - new PrivilegedExceptionAction() { - @Override - public URL run() throws Exception { - return servletContextHelper.getResource(name); - } - }, acc + (PrivilegedExceptionAction) () -> servletContextHelper.getResource(name), acc ); } catch (PrivilegedActionException e) { @@ -263,12 +248,7 @@ public Set getResourcePaths(final String name) { try { return AccessController.doPrivileged( - new PrivilegedExceptionAction>() { - @Override - public Set run() throws Exception { - return servletContextHelper.getResourcePaths(name); - } - }, acc + (PrivilegedExceptionAction>) () -> servletContextHelper.getResourcePaths(name), acc ); } catch (PrivilegedActionException e) {