Skip to content

Commit

Permalink
Merge pull request #5667 from jansupol/m317a
Browse files Browse the repository at this point in the history
Merge 3.1 into 4.0
  • Loading branch information
jansupol authored May 30, 2024
2 parents d377a30 + 56d6c1a commit 4ad4690
Show file tree
Hide file tree
Showing 166 changed files with 4,634 additions and 3,129 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 @@ -384,6 +384,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 @@ -400,11 +405,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 @@ -121,10 +121,6 @@
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>jakarta.persistence</groupId>
<artifactId>jakarta.persistence-api</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-jdk-http</artifactId>
Expand Down Expand Up @@ -298,7 +294,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
Expand Up @@ -754,7 +754,8 @@ private static InputStream getInputStream(final CloseableHttpResponse response,
if (i.markSupported()) {
inputStream = i;
} else {
inputStream = new BufferedInputStream(i, ReaderWriter.BUFFER_SIZE);
inputStream = ReaderWriter.AUTOSIZE_BUFFER ? new BufferedInputStream(i)
: new BufferedInputStream(i, ReaderWriter.BUFFER_SIZE);
}
}

Expand Down Expand Up @@ -881,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).build();
sniConfig.setSNIServerName(socket);

final int socketTimeout = ((ClientRequest) objectRequest).resolveProperty(ClientProperties.READ_TIMEOUT, -1);
Expand Down Expand Up @@ -940,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
28 changes: 28 additions & 0 deletions connectors/netty-connector/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.test-framework.providers</groupId>
<artifactId>jersey-test-framework-provider-jetty</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand All @@ -75,4 +81,26 @@
</plugins>
</build>

<profiles>
<profile>
<id>JettyExclude</id>
<activation>
<jdk>(1.8,17)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<testExcludes>
<testExclude>org/glassfish/jersey/netty/connector/HugeHeaderTest.java</testExclude>
</testExcludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2023 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 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 @@ -129,4 +129,56 @@ public class NettyClientProperties {
public static final Integer
DEFAULT_EXPECT_100_CONTINUE_TIMEOUT_VALUE = 500;


/**
* Parameter which allows extending of the header size for the Netty connector
*
* @since 2.44
*/
public static final String
MAX_HEADER_SIZE = "jersey.config.client.netty.maxHeaderSize";

/**
* Default header size for Netty Connector.
* Taken from {@link io.netty.handler.codec.http.HttpClientCodec#HttpClientCodec(int, int, int)}
*
* @since 2.44
*/
public static final Integer
DEFAULT_HEADER_SIZE = 8192;

/**
* Parameter which allows extending of the initial line length for the Netty connector
*
* @since 2.44
*/
public static final String
MAX_INITIAL_LINE_LENGTH = "jersey.config.client.netty.maxInitialLineLength";

/**
* Default initial line length for Netty Connector.
* Taken from {@link io.netty.handler.codec.http.HttpClientCodec#HttpClientCodec(int, int, int)}
*
* @since 2.44
*/
public static final Integer
DEFAULT_INITIAL_LINE_LENGTH = 4096;

/**
* Parameter which allows extending of the chunk size for the Netty connector
*
* @since 2.44
*/
public static final String
MAX_CHUNK_SIZE = "jersey.config.client.netty.maxChunkSize";

/**
* Default chunk size for Netty Connector.
* Taken from {@link io.netty.handler.codec.http.HttpClientCodec#HttpClientCodec(int, int, int)}
*
* @since 2.44
*/
public static final Integer
DEFAULT_CHUNK_SIZE = 8192;

}
Loading

0 comments on commit 4ad4690

Please sign in to comment.