Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,23 @@
* specific language governing permissions and limitations under the License. *
***************************************************************************************************************************

Release Notes - Juneau - Version 10.0.0 - YYYY-MM-DD

** Changes - Apache HttpComponents 5

* Port the classic HTTP APIs and Apache transport to HttpClient 5.6.4 and HttpCore 5.4.4.
* Public Apache HTTP types now use the org.apache.hc.client5 and org.apache.hc.core5 packages.
* Entity content type and encoding getters return strings. ResponseContent provides
getContentTypeHeader() and getContentEncodingHeader() for fluent header assertions.
* Header iterators use Iterator<Header>; classic responses expose getCode(), getVersion(), and getHeaders().
getHeaderList() provides the mutable Juneau header builder on classic requests and responses.
* Remove the obsolete HttpParams APIs. Connection, socket, and TLS options configure HttpClient 5 connection managers.
* Adopt HttpClient 5 request framing validation, URI encoding, default reason phrases, and rejection of URI userinfo.
* Represent a missing classic HTTP response as status 500 (Missing HTTP response).
* Close Apache transport SSE responses immediately so cancellation does not wait for an unbounded stream to finish.
* Preserve classic retry behavior and credential stripping on cross-origin redirects.
* Retain the historical juneau-rest-client-apache-httpclient-45 artifact and Java class names; this module now uses HttpClient 5.

Release Notes - Juneau - Version 9.2.1 - YYYY-MM-DD

** New Features - CBOR (Concise Binary Object Representation) Support
Expand Down
28 changes: 1 addition & 27 deletions juneau-integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,31 +39,6 @@
<excludedGroups>manual</excludedGroups>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
<version>5.6.4</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5-cache</artifactId>
<version>5.6.4</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents.core5</groupId>
<artifactId>httpcore5</artifactId>
<version>5.4.3</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents.core5</groupId>
<artifactId>httpcore5-h2</artifactId>
<version>5.4.3</version>
</dependency>
</dependencies>
</dependencyManagement>

<!--
Shibboleth repository (OpenSAML 5.x test deps). See juneau-rest-server-auth-saml/pom.xml for the
repository policy rationale. Confined to the test surface; consumers of juneau-rest-server-auth-saml
Expand Down Expand Up @@ -194,8 +169,7 @@
<artifactId>juneau-rest-client-jetty</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Force commons-codec >= 1.13 to satisfy Jena's MurmurHash3 requirement;
httpclient:4.5.14 pulls in 1.11 which pre-dates MurmurHash3. -->
<!-- Keep commons-codec compatible with Jena's MurmurHash3 requirement. -->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ public StringReader get(@Header(name=HEADER) @Schema(cf="multi") String[] h) {
c.get().header(acceptEncoding(()->PARSED)).run().assertContent(VALUE);

// Invalid usage.
c.get().header(acceptEncoding((String)null)).run().assertContent("gzip,deflate");
c.get().header(acceptEncoding((Supplier<StringRanges>)null)).run().assertContent("gzip,deflate");
c.get().header(acceptEncoding(()->null)).run().assertContent("gzip,deflate");
c.get().header(acceptEncoding((String)null)).run().assertContent().isContains("gzip", "deflate");
c.get().header(acceptEncoding((Supplier<StringRanges>)null)).run().assertContent().isContains("gzip", "deflate");
c.get().header(acceptEncoding(()->null)).run().assertContent().isContains("gzip", "deflate");
}

//------------------------------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ public StringReader get(@Header(name=HEADER) @Schema(cf="multi") String[] h) {
c.get().header(connection(()->PARSED)).run().assertContent(VALUE);

// Invalid usage.
c.get().header(connection((String)null)).run().assertContent("Keep-Alive");
c.get().header(connection((Supplier<String>)null)).run().assertContent("Keep-Alive");
c.get().header(connection(()->null)).run().assertContent("Keep-Alive");
c.get().header(connection((String)null)).run().assertContent("keep-alive");
c.get().header(connection((Supplier<String>)null)).run().assertContent("keep-alive");
c.get().header(connection(()->null)).run().assertContent("keep-alive");
}

@Test void a02_other() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ public StringReader get(@Header(name=HEADER) @Schema(cf="multi") String[] h) {
@Test void a01_basic() throws Exception {
var c = client().build();

// Normal usage.
c.get().header(contentLength(VALUE)).run().assertContent(VALUE);
c.get().header(contentLength(VALUE)).run().assertContent(VALUE);
c.get().header(contentLength(PARSED)).run().assertContent(VALUE);
c.get().header(contentLength(()->PARSED)).run().assertContent(VALUE);
// HttpClient 5 owns request framing and rejects caller-supplied framing headers.
assertThrowsWithMessage(RestCallException.class, "Call failed.", () -> c.get().header(contentLength(VALUE)).run());
assertThrowsWithMessage(RestCallException.class, "Call failed.", () -> c.get().header(contentLength(VALUE)).run());
assertThrowsWithMessage(RestCallException.class, "Call failed.", () -> c.get().header(contentLength(PARSED)).run());
assertThrowsWithMessage(RestCallException.class, "Call failed.", () -> c.get().header(contentLength(()->PARSED)).run());

// Invalid usage.
c.get().header(contentLength((String)null)).run().assertContent().isEmpty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ public StringReader get(@Header(name=HEADER) @Schema(cf="multi") String[] h) {
@Test void a01_basic() throws Exception {
var c = client().build();

// Normal usage.
c.get().header(transferEncoding(VALUE)).run().assertContent(VALUE);
c.get().header(transferEncoding(VALUE)).run().assertContent(VALUE);
c.get().header(transferEncoding(PARSED)).run().assertContent(VALUE);
c.get().header(transferEncoding(()->PARSED)).run().assertContent(VALUE);
// HttpClient 5 owns request framing and rejects caller-supplied framing headers.
assertThrowsWithMessage(RestCallException.class, "Call failed.", () -> c.get().header(transferEncoding(VALUE)).run());
assertThrowsWithMessage(RestCallException.class, "Call failed.", () -> c.get().header(transferEncoding(VALUE)).run());
assertThrowsWithMessage(RestCallException.class, "Call failed.", () -> c.get().header(transferEncoding(PARSED)).run());
assertThrowsWithMessage(RestCallException.class, "Call failed.", () -> c.get().header(transferEncoding(()->PARSED)).run());

// Invalid usage.
c.get().header(transferEncoding((String)null)).run().assertContent().isEmpty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
import static org.apache.juneau.http.classic.response.BadRequest.*;
import static org.junit.jupiter.api.Assertions.*;

import org.apache.http.*;
import org.apache.hc.core5.http.*;
import org.apache.juneau.*;
import org.apache.juneau.http.classic.header.*;
import org.apache.juneau.http.classic.header.ContentType;
import org.apache.juneau.rest.mock.classic.*;
import org.apache.juneau.rest.server.*;
import org.junit.jupiter.api.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@

import java.lang.reflect.*;

import org.apache.http.*;
import org.apache.hc.core5.http.*;
import org.apache.juneau.*;
import org.apache.juneau.http.classic.header.*;
import org.apache.juneau.http.classic.header.ContentType;
import org.apache.juneau.rest.mock.classic.*;
import org.apache.juneau.rest.server.*;
import org.junit.jupiter.api.*;
Expand Down Expand Up @@ -193,7 +194,7 @@ public void f7() throws BasicHttpException {

@Test void a09_fluentStatusLine_setters() {
var x = httpException().setStatusCode2(500);
var pv = new org.apache.http.ProtocolVersion("HTTP", 2, 0);
var pv = new org.apache.hc.core5.http.ProtocolVersion("HTTP", 2, 0);
assertSame(x, x.setProtocolVersion(pv));
assertSame(x, x.setLocale2(java.util.Locale.FRENCH));
assertSame(x, x.setMessage("new message"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public BasicResource<?> httpResource() throws IOException {
assertEquals("foo",read(sr.getContent()));
assertEquals("foo",sr.getHeaders().getLast("Foo").orElseThrow(RuntimeException::new).getValue());
assertEquals("\"bar\"",sr.getHeaders().getLast("ETag").orElseThrow(RuntimeException::new).getValue());
assertEquals("text/foo",sr.getContentType().getValue());
assertEquals("text/foo",sr.getContentType());
}

//-----------------------------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import java.io.*;
import java.util.*;

import org.apache.http.*;
import org.apache.http.entity.*;
import org.apache.hc.core5.http.*;
import org.apache.hc.core5.http.io.entity.*;
import org.apache.juneau.*;
import org.apache.juneau.http.*;
import org.apache.juneau.http.Header;
Expand Down Expand Up @@ -128,7 +128,7 @@ public String x9(@Content Reader b, @Header("Content-Type") String ct) throws Ex

@RestPost
public String x10(@Content Reader b, @Header("Content-Type") String ct) throws IOException {
assertEquals("application/x-www-form-urlencoded",ct);
assertEquals("application/x-www-form-urlencoded",ct.split(";", 2)[0]);
return read(b);
}
}
Expand Down Expand Up @@ -223,7 +223,7 @@ public Object x9(@Content Reader b, @Header("Content-Type") String ct) {

@RestPost
public Object x10(@Content Reader b, @Header("Content-Type") String ct) {
assertEquals("application/x-www-form-urlencoded",ct);
assertEquals("application/x-www-form-urlencoded",ct.split(";", 2)[0]);
return b;
}
}
Expand Down Expand Up @@ -251,7 +251,7 @@ public interface B1 {
assertEquals("{k1:{f:1}}",x.postX6(map("k1",Bean.create())));
assertEquals("xxx",x.postX7(reader("xxx")));
assertEquals("xxx",x.postX8(inputStream("xxx")));
assertEquals("xxx",x.postX9(new StringEntity("xxx",org.apache.http.entity.ContentType.create("text/plain"))));
assertEquals("xxx",x.postX9(new StringEntity("xxx",org.apache.hc.core5.http.ContentType.create("text/plain"))));
assertEquals("foo=bar",x.postX10(partList("foo","bar")));
}

Expand Down Expand Up @@ -330,7 +330,7 @@ public interface C1 {
assertEquals("{k1={f:1}}",x.postX6(map("k1",Bean.create())));
assertEquals("xxx",x.postX7(reader("xxx")));
assertEquals("xxx",x.postX8(inputStream("xxx")));
assertEquals("xxx",x.postX9(new StringEntity("xxx",org.apache.http.entity.ContentType.create("text/plain"))));
assertEquals("xxx",x.postX9(new StringEntity("xxx",org.apache.hc.core5.http.ContentType.create("text/plain"))));
assertEquals("foo=bar",x.postX10(partList("foo","bar")));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import java.util.*;
import java.util.concurrent.atomic.*;

import org.apache.http.*;
import org.apache.hc.core5.http.*;
import org.apache.juneau.TestBase;
import org.apache.juneau.commons.*;
import org.apache.juneau.http.*;
Expand Down Expand Up @@ -76,7 +76,7 @@ public String toString() {
public static class A {
@RestPost
public String a(@FormData("*") Json5Map m, @Header("Content-Type") String ct) {
assertEquals("application/x-www-form-urlencoded", ct);
assertEquals("application/x-www-form-urlencoded", ct.split(";", 2)[0]);
return m.toString();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ public interface A1 {
@RemoteOp(path="a") String getX14(@Header() @Schema(format="uon") Map<String,Bean> b);
@RemoteOp(path="a") String getX15(@Header("*") HeaderList b);
@RemoteOp(path="a") String getX16(@Header HeaderList b);
@RemoteOp(path="a") String getX17(@Header org.apache.http.Header b);
@RemoteOp(path="a") String getX18(@Header org.apache.http.Header[] b);
@RemoteOp(path="a") String getX17(@Header org.apache.hc.core5.http.Header b);
@RemoteOp(path="a") String getX18(@Header org.apache.hc.core5.http.Header[] b);
@RemoteOp(path="a") String getX19(@Header String b);
@RemoteOp(path="a") String getX20(@Header List<org.apache.http.Header> b);
@RemoteOp(path="a") String getX20(@Header List<org.apache.hc.core5.http.Header> b);
}

@Test void a01_objectTypes() {
Expand Down Expand Up @@ -747,7 +747,7 @@ public static class K3a {
@Header(value="*") @Schema(aev=true) public HeaderList getB() { return headers("b1","true","b2","123","b3","null"); }
@Header("*") @Schema(aev=true) public HeaderList getC() { return headerList(stringHeader("c1","v1"),integerHeader("c2",123),basicHeader("c3",null),stringHeader("c4","")); }
@Header(value="*") @Schema(aev=true) public HeaderList getD() { return null; }
@Header() @Schema(aev=true) public org.apache.http.Header[] getE() { return headerList(stringHeader("e1","v1"),integerHeader("e2",123),basicHeader("e3",null),stringHeader("e4","")).getAll(); }
@Header() @Schema(aev=true) public org.apache.hc.core5.http.Header[] getE() { return headerList(stringHeader("e1","v1"),integerHeader("e2",123),basicHeader("e3",null),stringHeader("e4","")).getAll(); }
@Header() @Schema(aev=true) public BasicHeader[] getF() { return headerList(stringHeader("f1","v1"),integerHeader("f2",123),basicHeader("f3",null),stringHeader("f4","")).stream().toArray(BasicHeader[]::new); }
}

Expand Down Expand Up @@ -797,7 +797,7 @@ private static HeaderList headers(String...pairs) {
return headerList(pairs);
}

private static org.apache.http.Header header(String key,Object val) {
private static org.apache.hc.core5.http.Header header(String key,Object val) {
return basicHeader(key,val);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import java.util.*;
import java.util.concurrent.atomic.*;

import org.apache.http.*;
import org.apache.http.client.config.*;
import org.apache.hc.core5.http.*;
import org.apache.hc.client5.http.config.*;
import org.apache.juneau.TestBase;
import org.apache.juneau.commons.*;
import org.apache.juneau.http.*;
Expand Down Expand Up @@ -711,10 +711,10 @@ private static NameValuePair part(String key, Object val) {
}

private static RestClient.Builder<?> client(Class<?> c) {
return MockRestClient.create(c).defaultRequestConfig(RequestConfig.custom().setNormalizeUri(false).build()).allowPrivateUrls(true);
return MockRestClient.create(c).defaultRequestConfig(RequestConfig.custom().build()).allowPrivateUrls(true);
}

private static <T> T remote(Class<?> rest, Class<T> t) {
return MockRestClient.create(rest).defaultRequestConfig(RequestConfig.custom().setNormalizeUri(false).build()).allowPrivateUrls(true).build().getRemote(t);
return MockRestClient.create(rest).defaultRequestConfig(RequestConfig.custom().build()).allowPrivateUrls(true).build().getRemote(t);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import java.util.*;
import java.util.concurrent.atomic.*;

import org.apache.http.*;
import org.apache.hc.core5.http.*;
import org.apache.juneau.TestBase;
import org.apache.juneau.commons.*;
import org.apache.juneau.http.*;
Expand Down Expand Up @@ -196,7 +196,7 @@ public interface C1 {
assertEquals("{x:'foo,bar'}",x.getX3("foo","bar"));
assertEquals("x=foo%2Cbar",x.getX4("foo","bar"));
assertEquals("{x:'foo bar'}",x.getX5("foo","bar"));
assertEquals("x=foo+bar",x.getX6("foo","bar"));
assertEquals("x=foo%20bar",x.getX6("foo","bar"));
assertEquals("{x:'foo\\tbar'}",x.getX7("foo","bar"));
assertEquals("x=foo%09bar",x.getX8("foo","bar"));
assertEquals("{x:'foo|bar'}",x.getX9("foo","bar"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.io.*;
import java.util.concurrent.*;

import org.apache.http.*;
import org.apache.hc.core5.http.*;
import org.apache.juneau.*;
import org.apache.juneau.http.*;
import org.apache.juneau.rest.mock.classic.*;
Expand Down Expand Up @@ -126,17 +126,17 @@ public String get() {
public interface B1 {
void x1();
String x2();
HttpResponse x3();
ClassicHttpResponse x3();
Reader x4();
InputStream x5();
Future<Void> x6();
Future<String> x7();
Future<HttpResponse> x8();
Future<ClassicHttpResponse> x8();
Future<Reader> x9();
Future<InputStream> x10();
CompletableFuture<Void> x11();
CompletableFuture<String> x12();
CompletableFuture<HttpResponse> x13();
CompletableFuture<ClassicHttpResponse> x13();
CompletableFuture<Reader> x14();
CompletableFuture<InputStream> x15();
}
Expand Down Expand Up @@ -175,15 +175,15 @@ public String post(@Content String body) {
@Remote
public interface C1 {
String postX1(@Content String foo);
HttpResponse postX2(@Content String foo);
ClassicHttpResponse postX2(@Content String foo);
Reader postX3(@Content String foo);
InputStream postX4(@Content String foo);
Future<String> postX5(@Content String foo);
Future<HttpResponse> postX6(@Content String foo);
Future<ClassicHttpResponse> postX6(@Content String foo);
Future<Reader> postX7(@Content String foo);
Future<InputStream> postX8(@Content String foo);
CompletableFuture<String> postX9(@Content String foo);
CompletableFuture<HttpResponse> postX10(@Content String foo);
CompletableFuture<ClassicHttpResponse> postX10(@Content String foo);
CompletableFuture<Reader> postX11(@Content String foo);
CompletableFuture<InputStream> postX12(@Content String foo);
}
Expand Down Expand Up @@ -219,15 +219,15 @@ public String x1(@Content String body) {
@Remote
public interface D1 {
String postX1(@Content String foo);
HttpResponse postX2(@Content String foo);
ClassicHttpResponse postX2(@Content String foo);
Reader postX3(@Content String foo);
InputStream postX4(@Content String foo);
Future<String> postX5(@Content String foo);
Future<HttpResponse> postX6(@Content String foo);
Future<ClassicHttpResponse> postX6(@Content String foo);
Future<Reader> postX7(@Content String foo);
Future<InputStream> postX8(@Content String foo);
CompletableFuture<String> postX9(@Content String foo);
CompletableFuture<HttpResponse> postX10(@Content String foo);
CompletableFuture<ClassicHttpResponse> postX10(@Content String foo);
CompletableFuture<Reader> postX11(@Content String foo);
CompletableFuture<InputStream> postX12(@Content String foo);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
import java.io.*;
import java.net.*;

import org.apache.http.*;
import org.apache.http.protocol.*;
import org.apache.hc.core5.http.*;
import org.apache.hc.core5.http.impl.io.HttpRequestExecutor;
import org.apache.hc.core5.http.io.HttpClientConnection;
import org.apache.hc.core5.http.protocol.*;
import org.apache.juneau.*;
import org.apache.juneau.http.classic.response.*;
import org.apache.juneau.rest.mock.classic.*;
Expand All @@ -43,7 +45,7 @@ public Ok get() {

public static class A1 extends HttpRequestExecutor {
@Override
public HttpResponse execute(HttpRequest request, HttpClientConnection conn, HttpContext context) throws IOException, BasicHttpException {
public ClassicHttpResponse execute(ClassicHttpRequest request, HttpClientConnection conn, org.apache.hc.core5.http.io.HttpResponseInformationCallback informationCallback, HttpContext context) throws IOException, HttpException {
throw new UnknownHostException("foo");
}
}
Expand Down
Loading