Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a1c4db6

Browse files
committedJun 18, 2024
Update to Apache Http Components 5
1 parent e2d1cc0 commit a1c4db6

File tree

14 files changed

+186
-168
lines changed

14 files changed

+186
-168
lines changed
 

‎http-client-java/pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@
6060
<artifactId>tools-java</artifactId>
6161
</dependency>
6262
<dependency>
63-
<groupId>org.apache.httpcomponents</groupId>
64-
<artifactId>httpcore</artifactId>
63+
<groupId>org.apache.httpcomponents.core5</groupId>
64+
<artifactId>httpcore5</artifactId>
6565
</dependency>
6666
<dependency>
67-
<groupId>org.apache.httpcomponents</groupId>
68-
<artifactId>httpclient</artifactId>
67+
<groupId>org.apache.httpcomponents.client5</groupId>
68+
<artifactId>httpclient5</artifactId>
6969
</dependency>
7070
<dependency>
7171
<groupId>org.ccil.cowan.tagsoup</groupId>
@@ -75,7 +75,7 @@
7575
<dependency>
7676
<groupId>org.apache.james</groupId>
7777
<artifactId>apache-mime4j-core</artifactId>
78-
<version>0.8.4</version>
78+
<version>0.8.11</version>
7979
</dependency>
8080
<dependency>
8181
<groupId>org.slf4j</groupId>

‎http-client-java/src/main/java/org/expath/httpclient/ContentType.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99

1010
package org.expath.httpclient;
1111

12-
import org.apache.http.Header;
13-
import org.apache.http.HeaderElement;
14-
import org.apache.http.NameValuePair;
12+
import org.apache.hc.core5.http.Header;
13+
import org.apache.hc.core5.http.HeaderElement;
14+
import org.apache.hc.core5.http.NameValuePair;
15+
import org.apache.hc.core5.http.message.MessageSupport;
1516

1617
import javax.annotation.Nullable;
1718

@@ -50,7 +51,7 @@ public ContentType(final String type, final String charset, final String boundar
5051
if (header == null || !"Content-Type".equalsIgnoreCase(header.getName())) {
5152
throw new HttpClientException("Header is not content type");
5253
}
53-
final HeaderElement[] headerElements = header.getElements();
54+
final HeaderElement[] headerElements = MessageSupport.parse(header);
5455
if (headerElements.length > 1) {
5556
throw new HttpClientException("Multiple Content-Type headers");
5657
}
@@ -71,7 +72,7 @@ public ContentType(final String type, final String charset, final String boundar
7172
if (header == null || !"Content-Type".equalsIgnoreCase(header.getName())) {
7273
throw new HttpClientException("Header is not content type");
7374
}
74-
final HeaderElement[] headerElements = header.getElements();
75+
final HeaderElement[] headerElements = MessageSupport.parse(header);
7576
if (headerElements.length > 1) {
7677
throw new HttpClientException("Multiple Content-Type headers");
7778
}
@@ -90,7 +91,7 @@ public ContentType(final String type, final String charset, final String boundar
9091
throw new HttpClientException("Header is not Content-Type");
9192
}
9293

93-
final HeaderElement[] headerElements = header.getElements();
94+
final HeaderElement[] headerElements = MessageSupport.parse(header);
9495
if (headerElements.length > 1) {
9596
throw new HttpClientException("Multiple Content-Type headers");
9697
}

‎http-client-java/src/main/java/org/expath/httpclient/HeaderSet.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
import java.util.Collection;
1515
import java.util.Iterator;
1616
import java.util.List;
17-
import org.apache.http.Header;
18-
import org.apache.http.HeaderElement;
19-
import org.apache.http.message.BasicHeader;
17+
import org.apache.hc.core5.http.Header;
18+
import org.apache.hc.core5.http.HeaderElement;
19+
import org.apache.hc.core5.http.message.BasicHeader;
2020

2121
/**
2222
* TODO: Doc...

‎http-client-java/src/main/java/org/expath/httpclient/impl/AnyEmptyMethod.java

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
package org.expath.httpclient.impl;
1111

1212
import java.net.URI;
13-
import org.apache.http.client.methods.HttpRequestBase;
13+
import org.apache.hc.core5.http.message.BasicClassicHttpRequest;
1414

1515
/**
1616
* Implements any HTTP extension method, without any entity content.
@@ -23,35 +23,22 @@
2323
* @author Florent Georges
2424
*/
2525
public class AnyEmptyMethod
26-
extends HttpRequestBase
26+
extends BasicClassicHttpRequest
2727
{
2828
public AnyEmptyMethod(String method)
2929
{
30-
super();
31-
METHOD_NAME = method;
30+
super(method, (String) null);
3231
}
3332

3433
public AnyEmptyMethod(String method, URI uri)
3534
{
36-
super();
37-
METHOD_NAME = method;
38-
setURI(uri);
35+
super(method, uri);
3936
}
4037

4138
public AnyEmptyMethod(String method, String uri)
4239
{
43-
super();
44-
METHOD_NAME = method;
45-
setURI(URI.create(uri));
40+
super(method, URI.create(uri));
4641
}
47-
48-
@Override
49-
public String getMethod()
50-
{
51-
return METHOD_NAME;
52-
}
53-
54-
public String METHOD_NAME;
5542
}
5643

5744

‎http-client-java/src/main/java/org/expath/httpclient/impl/AnyEntityMethod.java

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
package org.expath.httpclient.impl;
1111

1212
import java.net.URI;
13-
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
13+
import org.apache.hc.core5.http.message.BasicClassicHttpRequest;
1414

1515
/**
1616
* Implements any HTTP extension method, without any entity content.
@@ -23,35 +23,22 @@
2323
* @author Florent Georges
2424
*/
2525
public class AnyEntityMethod
26-
extends HttpEntityEnclosingRequestBase
26+
extends BasicClassicHttpRequest
2727
{
2828
public AnyEntityMethod(String method)
2929
{
30-
super();
31-
METHOD_NAME = method;
30+
super(method, (String) null);
3231
}
3332

3433
public AnyEntityMethod(String method, URI uri)
3534
{
36-
super();
37-
METHOD_NAME = method;
38-
setURI(uri);
35+
super(method, uri);
3936
}
4037

4138
public AnyEntityMethod(String method, String uri)
4239
{
43-
super();
44-
METHOD_NAME = method;
45-
setURI(URI.create(uri));
40+
super(method, URI.create(uri));
4641
}
47-
48-
@Override
49-
public String getMethod()
50-
{
51-
return METHOD_NAME;
52-
}
53-
54-
public String METHOD_NAME;
5542
}
5643

5744

There was a problem loading the remainder of the diff.

0 commit comments

Comments
 (0)
Please sign in to comment.