package init

This commit is contained in:
root 2020-08-25 14:41:40 +08:00
parent 0465e57be7
commit 3f1d834a77
8 changed files with 951 additions and 0 deletions

View File

@ -0,0 +1,368 @@
From ebc396ca0b7257ff9fc3844cce118a6ea38a9004 Mon Sep 17 00:00:00 2001
From: Mat Booth <mat.booth@redhat.com>
Date: Mon, 11 Mar 2019 10:30:32 +0000
Subject: [PATCH 1/3] Patch out dependency on JMockit
---
.../jersey/server/ResourceConfigTest.java | 50 -----------
.../scanning/PackageNamesScannerTest.java | 81 -----------------
.../ext/cdi1x/internal/CdiUtilTest.java | 45 ----------
.../FormDataMultiPartReaderWriterTest.java | 86 -------------------
4 files changed, 262 deletions(-)
diff --git a/core-server/src/test/java/org/glassfish/jersey/server/ResourceConfigTest.java b/core-server/src/test/java/org/glassfish/jersey/server/ResourceConfigTest.java
index 4f4ee99..b0f3bb3 100644
--- a/core-server/src/test/java/org/glassfish/jersey/server/ResourceConfigTest.java
+++ b/core-server/src/test/java/org/glassfish/jersey/server/ResourceConfigTest.java
@@ -45,9 +45,6 @@ import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
-import mockit.Mocked;
-import mockit.Verifications;
-
/**
* @author Pavel Bucek (pavel.bucek at oracle.com)
*/
@@ -350,53 +347,6 @@ public class ResourceConfigTest {
assertThat(classes, hasItem(InnerStaticClass.PublicClass.class));
}
- /**
- * Reproducer for OWLS-19790: Invalidate resource finders in resource config only when needed.
- */
- @Test
- public void testInvalidateResourceFinders(@Mocked final PackageNamesScanner scanner) throws Exception {
- final ResourceConfig resourceConfig = new ResourceConfig()
- .packages(false, PublicRootResourceClass.class.getPackage().getName());
-
- // Scan packages.
- resourceConfig.getClasses();
-
- // No reset.
- new Verifications() {{
- scanner.reset();
- times = 0;
- }};
-
- resourceConfig.register(InnerStaticClass.PublicClass.class);
-
- // Reset - we called getClasses() on ResourceConfig.
- new Verifications() {{
- scanner.reset();
- times = 1;
- }};
-
- // No reset.
- resourceConfig.register(PublicRootResourceClass.class);
- resourceConfig.register(PublicRootResourceInnerStaticClass.PublicClass.class);
-
- // No reset - simple registering does not invoke cache invalidation and reset of resource finders.
- new Verifications() {{
- scanner.reset();
- times = 1;
- }};
-
- // Scan packages.
- resourceConfig.getClasses();
-
- resourceConfig.registerFinder(new PackageNamesScanner(new String[] {"javax.ws.rs"}, false));
-
- // Reset - we called getClasses() on ResourceConfig.
- new Verifications() {{
- scanner.reset();
- times = 2;
- }};
- }
-
@Test
public void testResourceFinderStreamsClosed() throws IOException {
System.out.println(new ResourceConfig().packages("javax.ws.rs").getClasses());
diff --git a/core-server/src/test/java/org/glassfish/jersey/server/internal/scanning/PackageNamesScannerTest.java b/core-server/src/test/java/org/glassfish/jersey/server/internal/scanning/PackageNamesScannerTest.java
index 29b18c0..563b998 100644
--- a/core-server/src/test/java/org/glassfish/jersey/server/internal/scanning/PackageNamesScannerTest.java
+++ b/core-server/src/test/java/org/glassfish/jersey/server/internal/scanning/PackageNamesScannerTest.java
@@ -16,11 +16,6 @@
package org.glassfish.jersey.server.internal.scanning;
-import mockit.Expectations;
-import mockit.Injectable;
-import mockit.Tested;
-import mockit.Verifications;
-import mockit.integration.junit4.JMockit;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -46,7 +41,6 @@ import static org.junit.Assert.fail;
* @author Eric Navarro
* @author Michal Gajdos
*/
-@RunWith(JMockit.class)
public class PackageNamesScannerTest {
private static final String[] packages = {"javax.ws.rs"};
@@ -96,81 +90,6 @@ public class PackageNamesScannerTest {
}
- @Tested
- PackageNamesScanner scanner1 = new PackageNamesScanner(new String[]{"javax.ws.rs"}, false);
- @Tested
- PackageNamesScanner scanner2 = new PackageNamesScanner(new String[]{"javax.ws.rs.core"}, false);
- @Tested
- PackageNamesScanner scanner3 = new PackageNamesScanner(new String[]{"javax.ws.rs.client"}, false);
-
- /**
- * Reproducer for OWLS-19790: When scanner is reset the underlying JAR input streams should be closed.
- */
- @Test
- public void testInputStreamClosedAfterReset() throws Exception {
- JarInputStream stream = new JarInputStream(
- new ByteArrayInputStream("test".getBytes(), 0, 4));
-
- new Expectations(InputStream.class){};
-
- scanner1.reset();
-
- scanner2.reset();
- scanner2.reset();
-
- scanner3.reset();
-
- new Verifications() {{
- stream.close();
- times = 4;
- }};
- }
-
- /**
- * Reproducer for OWLS-19790: When scanner is closed the underlying JAR input streams should be closed as well.
- */
- @Test
- public void testInputStreamClosedAfterClose() throws Exception {
-
- JarInputStream stream = new JarInputStream(
- new ByteArrayInputStream("test".getBytes(), 0, 4));
-
- new Expectations(JarInputStream.class){};
-
- scanner1.close();
-
- scanner2.close();
- scanner2.close();
-
- scanner3.close();
-
- new Verifications() {{
- stream.close();
- times = 3;
- }};
- }
-
- /**
- * Reproducer for OWLS-19790: When we iterate through the all entries provided by a scanner JAR input stream should be closed.
- */
- @Tested
- PackageNamesScanner scanner = new PackageNamesScanner(new String[]{"javax.ws.rs"}, false);
- @Test
- public void testInputStreamClosedAfterIteration(@Injectable("false") boolean recursive) throws Exception {
- JarInputStream stream = new JarInputStream(
- new ByteArrayInputStream("test".getBytes(), 0, 4));
-
- new Expectations(JarInputStream.class) {{
- stream.getNextJarEntry();
- result = null;
- stream.close();
- }};
-
- while (scanner.hasNext()) {
- scanner.next();
- }
- }
-
private ClassLoader createTestClassLoader(final String scheme,
final URLStreamHandler urlStreamHandler,
final String resourceFilePath) {
diff --git a/ext/cdi/jersey-cdi1x/src/test/java/org/glassfish/jersey/ext/cdi1x/internal/CdiUtilTest.java b/ext/cdi/jersey-cdi1x/src/test/java/org/glassfish/jersey/ext/cdi1x/internal/CdiUtilTest.java
index 0cdafe1..bcc2a66 100644
--- a/ext/cdi/jersey-cdi1x/src/test/java/org/glassfish/jersey/ext/cdi1x/internal/CdiUtilTest.java
+++ b/ext/cdi/jersey-cdi1x/src/test/java/org/glassfish/jersey/ext/cdi1x/internal/CdiUtilTest.java
@@ -28,11 +28,6 @@ import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
-import mockit.Mock;
-import mockit.MockUp;
-import mockit.Mocked;
-import mockit.Verifications;
-
/**
* Unit tests for {@link org.glassfish.jersey.ext.cdi1x.internal.CdiUtil}.
*
@@ -48,34 +43,6 @@ public class CdiUtilTest {
}
}
- @Test
- public void getBeanManagerCustom(@Mocked final TestBeanManagerProvider custom,
- @Mocked final DefaultBeanManagerProvider fallback) throws Exception {
- CdiUtil.getBeanManager();
-
- new Verifications() {{
- custom.getBeanManager(); times = 1;
- fallback.getBeanManager(); times = 0;
- }};
- }
-
- @Test
- public void getDefaultBeanManagerDefault(@Mocked final DefaultBeanManagerProvider fallback) throws Exception {
- new MockUp<CdiUtil>() {
- @Mock
- @SuppressWarnings("UnusedDeclaration")
- <T> T lookupService(final Class<T> clazz) {
- return null;
- }
- };
-
- CdiUtil.getBeanManager();
-
- new Verifications() {{
- fallback.getBeanManager(); times = 1;
- }};
- }
-
@Priority(500)
public static class MyServiceOne implements MyService {
}
@@ -115,16 +82,4 @@ public class CdiUtilTest {
assertThat(CdiUtil.createHk2InjectionManagerStore(), instanceOf(TestInjectionManagerStore.class));
}
- @Test
- public void createHk2LocatorManagerDefault() throws Exception {
- new MockUp<CdiUtil>() {
- @Mock
- @SuppressWarnings("UnusedDeclaration")
- <T> T lookupService(final Class<T> clazz) {
- return null;
- }
- };
-
- assertThat(CdiUtil.createHk2InjectionManagerStore(), instanceOf(SingleInjectionManagerStore.class));
- }
}
diff --git a/media/multipart/src/test/java/org/glassfish/jersey/media/multipart/internal/FormDataMultiPartReaderWriterTest.java b/media/multipart/src/test/java/org/glassfish/jersey/media/multipart/internal/FormDataMultiPartReaderWriterTest.java
index b0a851c..f57d4e7 100644
--- a/media/multipart/src/test/java/org/glassfish/jersey/media/multipart/internal/FormDataMultiPartReaderWriterTest.java
+++ b/media/multipart/src/test/java/org/glassfish/jersey/media/multipart/internal/FormDataMultiPartReaderWriterTest.java
@@ -69,10 +69,6 @@ import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import mockit.Expectations;
-import mockit.Mocked;
-import mockit.Verifications;
-
/**
* Tests for multipart {@code MessageBodyReader} and {@code MessageBodyWriter} as well as {@code FormDataMultiPart} and {@code
* FormDataParam} injections.
@@ -666,35 +662,6 @@ public class FormDataMultiPartReaderWriterTest extends MultiPartJerseyTest {
}
}
- /**
- * JERSEY-2663 reproducer. Make sure that temporary file created by MIMEPull is not copied into new temporary file created
- * by Jersey.
- */
- @Test
- public void testInjectedFileNotCopied(@Mocked final BodyPartEntity entity) throws Exception {
- final FormDataMultiPart multipart = new FormDataMultiPart();
- final FormDataBodyPart bodypart = new FormDataBodyPart(FormDataContentDisposition.name("file").fileName("file").build(),
- "CONTENT");
- multipart.bodyPart(bodypart);
-
- final Response response = target().path("FileResource").path("InjectedFileNotCopied")
- .request()
- .post(Entity.entity(multipart, MediaType.MULTIPART_FORM_DATA));
-
- // Make sure that the Mimepull temp file has been moved to specific file.
- new Verifications() {{
- entity.moveTo(withInstanceOf(File.class));
- times = 1;
- }};
-
- // Make sure that the temp file has been removed.
- final String pathname = response.readEntity(String.class);
- // Wait a second to make sure the file doesn't exist.
- Thread.sleep(1000);
-
- assertThat("Temporary file, " + pathname + ", on the server has not been removed",
- new File(pathname).exists(), is(false));
- }
/**
* JERSEY-2846 reproducer. Make sure that temporary file created by MIMEPull deleted after a successful request.
@@ -772,59 +739,6 @@ public class FormDataMultiPartReaderWriterTest extends MultiPartJerseyTest {
}
}
- /**
- * Mocked JERSEY-2794 reproducer. Real test is under integration tests.
- */
- @Test
- public void mimeTempFileRemovedAfterAbortedUpload(@Mocked final MIMEMessage message) throws Exception {
- new Expectations() {{
- message.getAttachments();
- result = new MIMEParsingException();
- }};
-
- final URL url = new URL(getBaseUri().toString() + "MediaTypeWithBoundaryResource");
- final HttpURLConnection connection = (HttpURLConnection) url.openConnection();
-
- connection.setRequestMethod("PUT");
- connection.setRequestProperty("Accept", "text/plain");
- connection.setRequestProperty("Content-Type", "multipart/form-data; boundary=XXXX_YYYY");
-
- connection.setDoOutput(true);
- connection.connect();
-
- final OutputStream outputStream = connection.getOutputStream();
- outputStream.write("--XXXX_YYYY".getBytes());
- outputStream.write('\n');
- outputStream.write("Content-Type: text/plain".getBytes());
- outputStream.write('\n');
- outputStream.write("Content-Disposition: form-data; name=\"big-part\"".getBytes());
- outputStream.write('\n');
- outputStream.write('\n');
-
- // Send big chunk of data.
- for (int i = 0; i < 16 * 4096; i++) {
- outputStream.write('E');
- if (i % 1024 == 0) {
- outputStream.flush();
- }
- }
-
- // Do NOT send end of the MultiPart message to simulate the issue.
-
- // Get Response ...
- final int response = connection.getResponseCode();
- // ... Disconnect.
- connection.disconnect();
-
- assertThat("Bad Request expected", response, is(400));
-
- // Make sure that the Mimepull message and it's parts have been closed and temporary files deleted.
- new Verifications() {{
- message.close();
- times = 1;
- }};
- }
-
private void checkEntity(final String expected, final BodyPartEntity entity) throws IOException {
// Convert the raw bytes into a String
final InputStreamReader sr = new InputStreamReader(entity.getInputStream());
--
2.20.1

View File

@ -0,0 +1,38 @@
From 45c9f9249a863f46a85888679730c49f1b7f7bda Mon Sep 17 00:00:00 2001
From: Mat Booth <mat.booth@redhat.com>
Date: Mon, 11 Mar 2019 13:50:10 +0000
Subject: [PATCH 2/3] Port to glassfish/jsonp 1.0
---
.../org/glassfish/jersey/jsonp/JsonProcessingFeature.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/media/json-processing/src/main/java/org/glassfish/jersey/jsonp/JsonProcessingFeature.java b/media/json-processing/src/main/java/org/glassfish/jersey/jsonp/JsonProcessingFeature.java
index c065770..226dc59 100644
--- a/media/json-processing/src/main/java/org/glassfish/jersey/jsonp/JsonProcessingFeature.java
+++ b/media/json-processing/src/main/java/org/glassfish/jersey/jsonp/JsonProcessingFeature.java
@@ -22,8 +22,8 @@ import javax.ws.rs.core.FeatureContext;
import org.glassfish.jersey.CommonProperties;
-import org.glassfish.json.jaxrs.JsonValueBodyReader;
-import org.glassfish.json.jaxrs.JsonValueBodyWriter;
+import org.glassfish.json.jaxrs.JsonStructureBodyReader;
+import org.glassfish.json.jaxrs.JsonStructureBodyWriter;
/**
* {@link Feature} used to register JSON-P providers.
@@ -41,8 +41,8 @@ public class JsonProcessingFeature implements Feature {
// Make sure JSON-P workers have higher priority than other Json providers (in case there is a need to use JSON-P and some
// other provider in an application).
- context.register(JsonValueBodyReader.class, Priorities.USER + 1000);
- context.register(JsonValueBodyWriter.class, Priorities.USER + 1000);
+ context.register(JsonStructureBodyReader.class, Priorities.USER + 1000);
+ context.register(JsonStructureBodyWriter.class, Priorities.USER + 1000);
return true;
}
--
2.20.1

View File

@ -0,0 +1,99 @@
From 4aa4d572fc5aa6c76213940c1d1cf0792d8dc2ac Mon Sep 17 00:00:00 2001
From: Mat Booth <mat.booth@redhat.com>
Date: Mon, 11 Mar 2019 13:55:53 +0000
Subject: [PATCH 3/3] Port to hibernate validation 5.x
---
ext/bean-validation/pom.xml | 2 +-
ext/cdi/jersey-cdi1x-validation/pom.xml | 2 +-
.../cdi1x/validation/internal/CdiInterceptorWrapper.java | 4 ++--
.../validation/internal/CdiInterceptorWrapperExtension.java | 2 +-
pom.xml | 6 +++---
5 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/ext/bean-validation/pom.xml b/ext/bean-validation/pom.xml
index 7012856..ea3334b 100644
--- a/ext/bean-validation/pom.xml
+++ b/ext/bean-validation/pom.xml
@@ -87,7 +87,7 @@
<artifactId>validation-api</artifactId>
</dependency>
<dependency>
- <groupId>org.hibernate.validator</groupId>
+ <groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
diff --git a/ext/cdi/jersey-cdi1x-validation/pom.xml b/ext/cdi/jersey-cdi1x-validation/pom.xml
index 1b25a2e..6b7ac98 100644
--- a/ext/cdi/jersey-cdi1x-validation/pom.xml
+++ b/ext/cdi/jersey-cdi1x-validation/pom.xml
@@ -41,7 +41,7 @@
</dependency>
<dependency>
- <groupId>org.hibernate.validator</groupId>
+ <groupId>org.hibernate</groupId>
<artifactId>hibernate-validator-cdi</artifactId>
<scope>provided</scope>
</dependency>
diff --git a/ext/cdi/jersey-cdi1x-validation/src/main/java/org/glassfish/jersey/ext/cdi1x/validation/internal/CdiInterceptorWrapper.java b/ext/cdi/jersey-cdi1x-validation/src/main/java/org/glassfish/jersey/ext/cdi1x/validation/internal/CdiInterceptorWrapper.java
index 5b808ce..16a098d 100644
--- a/ext/cdi/jersey-cdi1x-validation/src/main/java/org/glassfish/jersey/ext/cdi1x/validation/internal/CdiInterceptorWrapper.java
+++ b/ext/cdi/jersey-cdi1x-validation/src/main/java/org/glassfish/jersey/ext/cdi1x/validation/internal/CdiInterceptorWrapper.java
@@ -27,8 +27,8 @@ import javax.interceptor.AroundInvoke;
import javax.interceptor.Interceptor;
import javax.interceptor.InvocationContext;
-import org.hibernate.validator.cdi.internal.interceptor.MethodValidated;
-import org.hibernate.validator.cdi.internal.interceptor.ValidationInterceptor;
+import org.hibernate.validator.internal.cdi.interceptor.MethodValidated;
+import org.hibernate.validator.internal.cdi.interceptor.ValidationInterceptor;
/**
* JAX-RS wrapper for Hibernate CDI bean validation interceptor.
diff --git a/ext/cdi/jersey-cdi1x-validation/src/main/java/org/glassfish/jersey/ext/cdi1x/validation/internal/CdiInterceptorWrapperExtension.java b/ext/cdi/jersey-cdi1x-validation/src/main/java/org/glassfish/jersey/ext/cdi1x/validation/internal/CdiInterceptorWrapperExtension.java
index 3b43ee7..1379866 100644
--- a/ext/cdi/jersey-cdi1x-validation/src/main/java/org/glassfish/jersey/ext/cdi1x/validation/internal/CdiInterceptorWrapperExtension.java
+++ b/ext/cdi/jersey-cdi1x-validation/src/main/java/org/glassfish/jersey/ext/cdi1x/validation/internal/CdiInterceptorWrapperExtension.java
@@ -43,7 +43,7 @@ import javax.interceptor.Interceptor;
import org.glassfish.jersey.internal.util.collection.Cache;
import org.glassfish.jersey.server.model.Resource;
-import org.hibernate.validator.cdi.internal.interceptor.ValidationInterceptor;
+import org.hibernate.validator.internal.cdi.interceptor.ValidationInterceptor;
/**
* CDI extension to register {@link CdiInterceptorWrapper}.
diff --git a/pom.xml b/pom.xml
index 7246f71..81d1a50 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1765,13 +1765,13 @@
</dependency>
<dependency>
- <groupId>org.hibernate.validator</groupId>
+ <groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>${validation.impl.version}</version>
</dependency>
<dependency>
- <groupId>org.hibernate.validator</groupId>
+ <groupId>org.hibernate</groupId>
<artifactId>hibernate-validator-cdi</artifactId>
<version>${validation.impl.version}</version>
</dependency>
@@ -2080,7 +2080,7 @@
<simple.version>6.0.1</simple.version>
<slf4j.version>1.7.21</slf4j.version>
<spring4.version>4.3.8.RELEASE</spring4.version>
- <validation.impl.version>6.0.11.Final</validation.impl.version>
+ <validation.impl.version>5.1.3.Final</validation.impl.version>
<weld.version>2.2.14.Final</weld.version> <!-- 2.4.1 doesn't work - bv tests -->
<weld3.version>3.0.0.Final</weld3.version>
<xerces.version>2.11.0</xerces.version>
--
2.20.1

202
LICENSE-2.0.txt Normal file
View File

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -0,0 +1,26 @@
--- jersey-2.17/ext/mvc-jsp/src/main/java/org/glassfish/jersey/server/mvc/jsp/JspTemplateProcessor.java 2015-03-11 13:39:18.000000000 +0100
+++ jersey-2.17/ext/mvc-jsp/src/main/java/org/glassfish/jersey/server/mvc/jsp/JspTemplateProcessor.java.servlet31 2015-05-19 16:08:00.012125072 +0200
@@ -55,6 +55,7 @@
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletOutputStream;
+import javax.servlet.WriteListener;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
@@ -129,6 +130,15 @@
// OutputStream and Writer for HttpServletResponseWrapper.
final ServletOutputStream responseStream = new ServletOutputStream() {
+
+ public void setWriteListener(WriteListener listener) {
+ throw new UnsupportedOperationException("Not implemented yet.");
+ }
+
+ public boolean isReady() {
+ return false;
+ }
+
@Override
public void write(final int b) throws IOException {
out.write(b);

BIN
jersey-2.28.tar.gz Normal file

Binary file not shown.

214
jersey.spec Normal file
View File

@ -0,0 +1,214 @@
%bcond_with jp_minimal
Name: jersey
Version: 2.28
Release: 1
Summary: JAX-RS (JSR 311) production quality Reference Implementation
License: (EPL-2.0 or GPLv2 with exceptions) and ASL 2.0
URL: https://github.com/eclipse-ee4j/jersey
Source0: https://github.com/eclipse-ee4j/jersey/archive/%{version}/%{name}-%{version}.tar.gz
Source1: http://www.apache.org/licenses/LICENSE-2.0.txt
Patch0: jersey-2.17-mvc-jsp-servlet31.patch
Patch1: 0001-Patch-out-dependency-on-JMockit.patch
Patch2: 0002-Port-to-glassfish-jsonp-1.0.patch
Patch3: 0003-Port-to-hibernate-validation-5.x.patch
BuildRequires: maven-local mvn(com.fasterxml.jackson.core:jackson-annotations)
BuildRequires: mvn(com.fasterxml.jackson.core:jackson-databind)
BuildRequires: mvn(com.fasterxml.jackson.module:jackson-module-jaxb-annotations)
BuildRequires: mvn(com.google.guava:guava:18.0)
BuildRequires: mvn(com.sun.istack:istack-commons-maven-plugin) mvn(com.sun:tools)
BuildRequires: mvn(jakarta.ws.rs:jakarta.ws.rs-api) mvn(javax.annotation:javax.annotation-api)
BuildRequires: mvn(javax.inject:javax.inject) mvn(javax.xml.bind:jaxb-api)
BuildRequires: mvn(javax.validation:validation-api) mvn(org.apache.felix:maven-bundle-plugin)
BuildRequires: mvn(org.apache.httpcomponents:httpclient)
BuildRequires: mvn(org.apache.maven.plugins:maven-enforcer-plugin)
BuildRequires: mvn(org.codehaus.mojo:build-helper-maven-plugin)
BuildRequires: mvn(org.eclipse.jetty:jetty-client) mvn(org.glassfish.hk2:hk2-bom:pom:)
BuildRequires: mvn(org.glassfish.hk2:hk2-locator) mvn(org.glassfish.hk2:osgi-resource-locator)
BuildRequires: mvn(org.osgi:org.osgi.core) mvn(org.ow2.asm:asm) mvn(xerces:xercesImpl)
%if %{without jp_minimal}
BuildRequires: mvn(com.github.spullara.mustache.java:compiler) mvn(io.reactivex:rxjava)
BuildRequires: mvn(javax.el:javax.el-api) mvn(javax.enterprise:cdi-api)
BuildRequires: mvn(javax.json:javax.json-api) mvn(javax.persistence:persistence-api)
BuildRequires: mvn(javax.servlet:javax.servlet-api) mvn(javax.servlet.jsp:jsp-api)
BuildRequires: mvn(javax.servlet:servlet-api) mvn(junit:junit)
BuildRequires: mvn(org.codehaus.jettison:jettison) mvn(org.eclipse.jetty:jetty-continuation)
BuildRequires: mvn(org.eclipse.jetty:jetty-server) mvn(org.eclipse.jetty:jetty-util)
BuildRequires: mvn(org.eclipse.jetty:jetty-webapp) mvn(org.freemarker:freemarker)
BuildRequires: mvn(org.glassfish.grizzly:grizzly-http-server)
BuildRequires: mvn(org.glassfish.grizzly:grizzly-http-servlet) mvn(org.glassfish:javax.el)
BuildRequires: mvn(org.glassfish:javax.json) mvn(org.glassfish:jsonp-jaxrs)
BuildRequires: mvn(org.hamcrest:hamcrest-library) mvn(org.hibernate:hibernate-validator)
BuildRequires: mvn(org.hibernate:hibernate-validator-cdi) mvn(org.jboss:jboss-vfs)
BuildRequires: mvn(org.jboss.spec.javax.interceptor:jboss-interceptors-api_1.2_spec)
BuildRequires: mvn(org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec)
BuildRequires: mvn(org.jboss.weld.se:weld-se-core) mvn(org.jvnet.mimepull:mimepull)
BuildRequires: mvn(org.mockito:mockito-all) mvn(org.simpleframework:simple-common)
BuildRequires: mvn(org.simpleframework:simple-http) mvn(org.simpleframework:simple-transport)
BuildRequires: mvn(org.testng:testng)
%endif
BuildArch: noarch
%description
Jersey is the open source JAX-RS (JSR 311)
production quality Reference Implementation
for building RESTful Web services.
%if %{without jp_minimal}
%package test-framework
Summary: Jersey Test Framework
%description test-framework
%{summary}.
%endif
%package javadoc
Summary: Javadoc for %{name}
%description javadoc
This package contains javadoc for %{name}.
%prep
%setup -q -n %{name}-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
find . -name "*.jar" -print -delete
find . -name "*.class" -print -delete
cp -p %{SOURCE1} .
sed -i 's/\r//' LICENSE-2.0.txt
rm -r core-server/src/main/java/jersey
find core-server -name "*.java" -exec sed -i "s|jersey.repackaged.||" {} +
rm -r core-common/src/main/java/org/glassfish/jersey/internal/guava
grep -rl --include=*.java org.glassfish.jersey.internal.guava | xargs sed -i "s|org\.glassfish\.jersey\.internal\.guava|com.google.common.base|"
find core-* containers/{grizzly2,jdk,jetty}-http media/sse ext/{entity-filtering,bean-validation,rx} -name "*.java" -exec sed -i \
-e "/base\.Cache/s/common\.base/common.cache/" \
-e "/base\.LoadingCache/s/common\.base/common.cache/" \
-e "/base\.Multimap/s/common\.base/common.collect/" \
-e "/base\.....Multimap/s/common\.base/common.collect/" \
-e "/base\.HashBasedTable/s/common\.base/common.collect/" \
-e "/base\.Table/s/common\.base/common.collect/" \
-e "/base\.ThreadFactoryBuilder/s/common\.base/common.util.concurrent/" \
-e "/base\.InetAddresses/s/common\.base/common.net/" \
-e "/base\.Primitives/s/common\.base/common.primitives/" {} +
%pom_add_dep 'com.google.guava:guava:${guava.version}' core-common inject/hk2
%pom_xpath_set "pom:dependency[pom:artifactId = 'guava']/pom:scope" provided containers/jdk-http
%pom_add_dep 'org.ow2.asm:asm:${asm.version}' core-server
%pom_remove_parent bom .
%pom_change_dep -r jakarta.servlet:jakarta.servlet-api javax.servlet:javax.servlet-api . test-framework
%pom_change_dep -r jakarta.servlet.jsp:jakarta.servlet.jsp-api javax.servlet.jsp:jsp-api
%pom_change_dep -r jakarta.xml.bind:jakarta.xml.bind-api javax.xml.bind:jaxb-api
%pom_change_dep -r jakarta.annotation:jakarta.annotation-api javax.annotation:javax.annotation-api
%pom_change_dep -r jakarta.persistence:jakarta.persistence-api javax.persistence:persistence-api
%pom_change_dep -r org.glassfish.hk2.external:jakarta.inject javax.inject:javax.inject
%pom_change_dep -r jakarta.el:jakarta.el-api javax.el:javax.el-api
%pom_change_dep -r org.glassfish:jakarta.el org.glassfish:javax.el
%pom_change_dep -r org.glassfish:jakarta.json org.glassfish:javax.json
%pom_add_dep javax.json:javax.json-api:1.0 media/json-processing
%pom_change_dep javax:javaee-api javax.enterprise:cdi-api:'${cdi.api.version}':provided ext/cdi/jersey-cdi1x-transaction
%pom_add_dep org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:1.0.0.Alpha3:provided ext/cdi/jersey-cdi1x-transaction
%pom_add_dep org.jboss.spec.javax.interceptor:jboss-interceptors-api_1.2_spec:1.0.0.Alpha3:provided ext/cdi/jersey-cdi1x-validation
%pom_xpath_remove "pom:dependencies/pom:dependency[pom:artifactId = 'tools']/pom:scope" ext/wadl-doclet
%pom_xpath_remove "pom:dependencies/pom:dependency[pom:artifactId = 'tools']/pom:systemPath" ext/wadl-doclet
%pom_remove_dep -r org.mortbay.jetty:servlet-api-2.5
%pom_remove_dep -r org.jmockit:jmockit
%pom_xpath_remove pom:build/pom:extensions
%pom_remove_plugin :buildnumber-maven-plugin
%pom_remove_plugin :buildnumber-maven-plugin core-common
%pom_remove_plugin :findbugs-maven-plugin
%pom_remove_plugin :maven-checkstyle-plugin
%pom_remove_plugin :maven-source-plugin
%pom_remove_plugin :maven-jflex-plugin media/moxy
%pom_remove_plugin :maven-jflex-plugin media/jaxb
%pom_xpath_remove "pom:plugin[pom:artifactId = 'maven-javadoc-plugin' ]/pom:executions"
%pom_disable_module archetypes
%pom_disable_module incubator
%pom_disable_module netty-http containers
%pom_remove_dep :jersey-container-netty-http bom
%pom_disable_module netty-connector connectors
%pom_remove_dep :jersey-netty-connector bom
%pom_disable_module netty test-framework/providers
%pom_remove_dep :jersey-test-framework-provider-netty test-framework/providers/bundle
%pom_disable_module servlet-portability ext
%pom_remove_dep :jersey-servlet-portability bom
%pom_disable_module json-jackson1 media
%pom_remove_dep :jersey-media-json-jackson1 bom
%pom_disable_module json-binding media
%pom_remove_dep :jersey-media-json-binding bom
%pom_disable_module moxy media
%pom_remove_dep :jersey-media-moxy bom
%pom_disable_module spring4 ext
%pom_remove_dep :jersey-spring4 bom
%pom_disable_module grizzly-connector connectors
%pom_remove_dep :jersey-grizzly-connector bom
%pom_remove_dep org.glassfish.jersey.connectors:jersey-grizzly-connector media/multipart
rm media/multipart/src/test/java/org/glassfish/jersey/media/multipart/internal/MultiPartHeaderModificationTest.java
%pom_disable_module glassfish containers
%pom_remove_dep :jersey-gf-ejb bom
%pom_disable_module cdi2-se inject
%pom_remove_dep :jersey-cdi2-se bom
%pom_disable_module rx-client-rxjava2 ext/rx
%pom_remove_dep :jersey-rx-client-rxjava2 bom
%pom_disable_module maven test-framework
%pom_remove_plugin com.sun.tools.xjc.maven2: core-server
%if %{with jp_minimal}
%pom_disable_module bom
%pom_disable_module containers
%pom_disable_module security
%pom_disable_module json-jettison media
%pom_disable_module json-processing media
%pom_disable_module multipart media
%pom_disable_module sse media
%pom_disable_module bean-validation ext
%pom_disable_module cdi ext
%pom_disable_module metainf-services ext
%pom_disable_module mvc ext
%pom_disable_module mvc-bean-validation ext
%pom_disable_module mvc-freemarker ext
%pom_disable_module mvc-jsp ext
%pom_disable_module mvc-mustache ext
%pom_disable_module proxy-client ext
%pom_disable_module rx ext
%endif
%pom_xpath_inject "pom:plugin/pom:configuration/pom:instructions" \
'<Require-Bundle>org.glassfish.jersey.inject.jersey-hk2;bundle-version="%{version}"</Require-Bundle>' core-common
cp -p inject/hk2/src/main/resources/META-INF/services/org.glassfish.jersey.internal.inject.InjectionManagerFactory \
core-common/src/main/resources/META-INF/services
sed -i -e 's/javax\.annotation\.\*;version="!"/javax.annotation.*/' $(find -name pom.xml)
sed -i -e 's/javax\.activation\.\*;/javax.activation.*;resolution:=optional;/' core-common/pom.xml
%mvn_file "org.glassfish.jersey.connectors:project" %{name}/connectors-project
%mvn_file "org.glassfish.jersey.containers:project" %{name}/containers-project
%mvn_file "org.glassfish.jersey.ext:project" %{name}/ext-project
%mvn_file "org.glassfish.jersey.ext.cdi:project" %{name}/ext-cdi-project
%mvn_file "org.glassfish.jersey.ext.rx:project" %{name}/ext-rx-project
%mvn_file "org.glassfish.jersey.inject:project" %{name}/inject-project
%mvn_file "org.glassfish.jersey.media:project" %{name}/media-project
%mvn_file "org.glassfish.jersey.security:project" %{name}/security-project
%mvn_file "org.glassfish.jersey.test-framework:project" %{name}/test-framework-project
%mvn_file "org.glassfish.jersey.test-framework.providers:project" %{name}/test-framework-providers-project
%mvn_package "org.glassfish.jersey.test-framework*:" test-framework
%build
%if %{without jp_minimal}
%mvn_build -- -PsecurityOff -Dasm.version=6.2.1 -Dmaven.test.failure.ignore=true \
-Dexamples.excluded -Dtests.excluded -Dbundles.excluded
%else
%mvn_build -f -- -PsecurityOff -Dasm.version=6.2.1 -Dmaven.test.failure.ignore=true \
-Dexamples.excluded -Dtests.excluded -Dbundles.excluded -Dtest-framework.excluded
%endif
%install
%mvn_install
%files -f .mfiles
%doc README.md CONTRIBUTING.md
%license LICENSE.md NOTICE.md LICENSE-2.0.txt
%if %{without jp_minimal}
%files test-framework -f .mfiles-test-framework
%license LICENSE.md NOTICE.md LICENSE-2.0.txt
%endif
%files javadoc -f .mfiles-javadoc
%license LICENSE.md NOTICE.md LICENSE-2.0.txt
%changelog
* Tue Aug 25 2020 Shaoqiang Kang <kangshaoqiang1@huawei.com> - 2.28-1
- Package init

4
jersey.yaml Normal file
View File

@ -0,0 +1,4 @@
version_control: github
src_repo: eclipse-ee4j/jersey
tag_prefix: "^"
seperator: "."