Skip to content

Commit

Permalink
Merge pull request eclipse-ee4j#5646 from senivam/31_merge
Browse files Browse the repository at this point in the history
merge of the actual 3.0 into the 3.1
  • Loading branch information
jansupol authored May 22, 2024
2 parents da238a8 + ce2ff35 commit 95f2ec9
Show file tree
Hide file tree
Showing 109 changed files with 3,278 additions and 2,828 deletions.
22 changes: 19 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[//]: # " Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved. "
[//]: # " Copyright (c) 2018, 2024 Oracle and/or its affiliates. All rights reserved. "
[//]: # " "
[//]: # " This program and the accompanying materials are made available under the "
[//]: # " terms of the Eclipse Public License v. 2.0, which is available at "
Expand All @@ -18,13 +18,14 @@ Thanks for your interest in this project.

## Project description

Eclipse Jersey is a REST framework that provides a JAX-RS (JSR-370) implementation and more.
Eclipse Jersey is a REST framework that provides a <a href="https://jcp.org/en/jsr/detail?id=370">JAX-RS (JSR-370)</a>,
now mainly <a href="https://projects.eclipse.org/projects/ee4j.rest">Jakarta REST</a>, implementation and more.
Jersey provides its own APIs that extend the JAX-RS toolkit with additional features and utilities
to further simplify RESTful service and client development. Jersey also exposes numerous extension
SPIs so that developers may extend Jersey to best suit their needs.

Goals of Jersey project can be summarized in the following points:
* Track the JAX-RS API and provide regular releases of production quality implementations that ships with GlassFish;
* Track the JAX-RS/Jakarta REST API and provide regular releases of production quality implementations that ships with GlassFish;

* Provide APIs to extend Jersey & Build a community of users and developers; and finally

Expand All @@ -41,6 +42,21 @@ The project maintains the following source code repositories

* https://github.com/eclipse-ee4j/jersey

## Eclipse Development Process

This Eclipse Foundation open project is governed by the Eclipse Foundation
Development Process and operates under the terms of the Eclipse IP Policy.

## Specifications

This specification project operates under the terms of the Eclipse Foundation
Specification process.

* https://eclipse.org/projects/dev_process
* https://www.eclipse.org/org/documents/Eclipse_IP_Policy.pdf
* https://www.eclipse.org/projects/efsp/
* https://www.eclipse.org/legal/efsp_non_assert.php

## Eclipse Contributor Agreement

Before your contribution can be accepted by the project team contributors must
Expand Down
12 changes: 6 additions & 6 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>org.eclipse.ee4j</groupId>
<artifactId>project</artifactId>
<version>1.0.8</version>
<version>1.0.9</version>
<relativePath/>
</parent>

Expand Down Expand Up @@ -419,6 +419,11 @@
<artifactId>jersey-test-framework-provider-jetty-http2</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.test-framework.providers</groupId>
<artifactId>jersey-test-framework-provider-netty</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.test-framework</groupId>
<artifactId>jersey-test-framework-util</artifactId>
Expand All @@ -435,11 +440,6 @@
<version>2.4</version>
<inherited>true</inherited>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.9.1</version>
</plugin>
</plugins>
</build>

Expand Down
6 changes: 1 addition & 5 deletions bundles/apidocs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,6 @@
<artifactId>javax.servlet</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>jakarta.persistence</groupId>
<artifactId>jakarta.persistence-api</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-simple-http</artifactId>
Expand Down Expand Up @@ -300,7 +296,7 @@
<dependencySourceIncludes>
<dependencySourceInclude>org.glassfish.jersey.*:*</dependencySourceInclude>
</dependencySourceIncludes>
<excludePackageNames>*.internal:*.internal.*:*.innate:*.innate.*</excludePackageNames>
<excludePackageNames>*.innate:*.innate.*</excludePackageNames>
</configuration>
</execution>
</executions>
Expand Down
5 changes: 4 additions & 1 deletion bundles/jaxrs-ri/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,9 @@
<showWarnings>false</showWarnings>
<fork>false</fork>
<excludes>
<exclude>module-info.java</exclude><exclude>META-INF/versions/11/**</exclude>
<exclude>module-info.java</exclude>
<exclude>META-INF/versions/11/**</exclude>
<exclude>META-INF/versions/21/**</exclude>
</excludes>
</configuration>
</plugin>
Expand Down Expand Up @@ -314,6 +316,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>${shade.mvn.plugin.version}</version>
<executions>
<execution>
<phase>package</phase>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2023 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -883,7 +883,8 @@ protected void prepareSocket(SSLSocket socket) throws IOException {
Object objectRequest = context.getAttribute(JERSEY_REQUEST_ATTR_NAME);
if (objectRequest != null) {
ClientRequest clientRequest = (ClientRequest) objectRequest;
SSLParamConfigurator sniConfig = SSLParamConfigurator.builder().request(clientRequest).build();
SSLParamConfigurator sniConfig = SSLParamConfigurator.builder().request(clientRequest)
.setSNIHostName(clientRequest.getConfiguration()).build();
sniConfig.setSNIServerName(socket);
}
}
Expand Down Expand Up @@ -937,12 +938,12 @@ public void close() throws IOException {
}

@Override
public synchronized void mark(int readlimit) {
public void mark(int readlimit) {
in.mark(readlimit);
}

@Override
public synchronized void reset() throws IOException {
public void reset() throws IOException {
checkAborted();
in.reset();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, 2023 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -882,7 +882,8 @@ protected void prepareSocket(SSLSocket socket) throws IOException {
Object objectRequest = context.getAttribute(JERSEY_REQUEST_ATTR_NAME);
if (objectRequest != null) {
ClientRequest clientRequest = (ClientRequest) objectRequest;
SSLParamConfigurator sniConfig = SSLParamConfigurator.builder().request(clientRequest).build();
SSLParamConfigurator sniConfig = SSLParamConfigurator.builder().request(clientRequest)
.setSNIHostName(clientRequest.getConfiguration()).build();
sniConfig.setSNIServerName(socket);

final int socketTimeout = ((ClientRequest) objectRequest).resolveProperty(ClientProperties.READ_TIMEOUT, -1);
Expand Down Expand Up @@ -941,12 +942,12 @@ public void close() throws IOException {
}

@Override
public synchronized void mark(int readlimit) {
public void mark(int readlimit) {
in.mark(readlimit);
}

@Override
public synchronized void reset() throws IOException {
public void reset() throws IOException {
checkAborted();
in.reset();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2023 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -60,8 +60,10 @@ class ConnectorConfiguration {
private final int connectTimeout;
private final ProxyConfiguration proxyConfiguration;
private final AtomicReference<SSLParamConfigurator> sniConfigs = new AtomicReference<>(null);
private final Configuration configuration;

ConnectorConfiguration(Client client, Configuration config) {
configuration = config;
final Map<String, Object> properties = config.getProperties();

int proposedChunkSize = JdkConnectorProperties.getValue(properties, ClientProperties.CHUNKED_ENCODING_SIZE,
Expand Down Expand Up @@ -181,6 +183,10 @@ SSLParamConfigurator getSniConfig() {
return sniConfigs.get();
}

Configuration getConfiguration() {
return configuration;
}

@Override
public String toString() {
return "ConnectorConfiguration{"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2023 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -51,7 +51,8 @@ class HttpConnectionPool {
void send(HttpRequest httpRequest, CompletionHandler<HttpResponse> completionHandler) {
final Map<String, List<Object>> headers = new HashMap<>();
httpRequest.getHeaders().forEach((k, v) -> headers.put(k, (List) v));
final SSLParamConfigurator sniConfig = SSLParamConfigurator.builder().uri(httpRequest.getUri()).headers(headers).build();
final SSLParamConfigurator sniConfig = SSLParamConfigurator.builder().uri(httpRequest.getUri())
.headers(headers).setSNIHostName(connectorConfiguration.getConfiguration()).build();
connectorConfiguration.setSniConfig(sniConfig);

final DestinationConnectionPool.DestinationKey destinationKey = new DestinationConnectionPool.DestinationKey(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -496,7 +496,7 @@ private void decideTransferEncoding() throws ParseException {

if (contentLengths != null) {
try {
int bodyLength = Integer.parseInt(contentLengths.get(0));
long bodyLength = Long.parseLong(contentLengths.get(0));
if (bodyLength == 0) {
expectContent = false;
return;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -31,7 +31,7 @@ abstract class TransferEncodingParser {

abstract boolean parse(ByteBuffer input) throws ParseException;

static TransferEncodingParser createFixedLengthParser(AsynchronousBodyInputStream responseBody, int expectedLength) {
static TransferEncodingParser createFixedLengthParser(AsynchronousBodyInputStream responseBody, long expectedLength) {
return new FixedLengthEncodingParser(responseBody, expectedLength);
}

Expand All @@ -42,11 +42,11 @@ static TransferEncodingParser createChunkParser(AsynchronousBodyInputStream resp

private static class FixedLengthEncodingParser extends TransferEncodingParser {

private final int expectedLength;
private final long expectedLength;
private final AsynchronousBodyInputStream responseBody;
private volatile int consumedLength = 0;
private volatile long consumedLength = 0;

FixedLengthEncodingParser(AsynchronousBodyInputStream responseBody, int expectedLength) {
FixedLengthEncodingParser(AsynchronousBodyInputStream responseBody, long expectedLength) {
this.expectedLength = expectedLength;
this.responseBody = responseBody;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2023 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -208,7 +208,7 @@ protected void execute(final ClientRequest jerseyRequest, final Set<URI> redirec

try {
final SSLParamConfigurator sslConfig = SSLParamConfigurator.builder()
.request(jerseyRequest).setSNIAlways(true).build();
.request(jerseyRequest).setSNIAlways(true).setSNIHostName(jerseyRequest.getConfiguration()).build();

String key = requestUri.getScheme() + "://" + sslConfig.getSNIHostName() + ":" + port;
ArrayList<Channel> conns;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2023 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2023 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -94,7 +94,7 @@ public class HttpUrlConnectorProvider implements ConnectorProvider {
/**
* A value of {@code true} declares that the client will try to set
* unsupported HTTP method to {@link java.net.HttpURLConnection} via
* reflection.
* reflection as a workaround for a missing HTTP method.
* <p>
* NOTE: Enabling this property may cause security related warnings/errors
* and it may break when other JDK implementation is used. <b>Use only
Expand All @@ -103,6 +103,10 @@ public class HttpUrlConnectorProvider implements ConnectorProvider {
* <p>The value MUST be an instance of {@link java.lang.Boolean}.</p>
* <p>The default value is {@code false}.</p>
* <p>The name of the configuration property is <tt>{@value}</tt>.</p>
* <p>Since JDK 16 the JDK internal classes are not opened for reflection and the workaround method does not work,
* unless {@code --add-opens java.base/java.net=ALL-UNNAMED} for HTTP requests and additional
* {@code --add-opens java.base/sun.net.www.protocol.https=ALL-UNNAMED} for HTTPS (HttpsUrlConnection) options are set.
* </p>
*/
public static final String SET_METHOD_WORKAROUND =
"jersey.config.client.httpUrlConnection.setMethodWorkaround";
Expand Down
Loading

0 comments on commit 95f2ec9

Please sign in to comment.