Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5b0e807

Browse files
committed
Fix deprecation warnings
1 parenta691620 commit5b0e807

File tree

39 files changed

+181
-165
lines changed

39 files changed

+181
-165
lines changed

‎client/src/main/java/org/asynchttpclient/RequestBuilderBase.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
*/
1616
packageorg.asynchttpclient;
1717

18+
importstaticio.netty.handler.codec.http.HttpHeaderNames.CONTENT_TYPE;
1819
importstaticorg.asynchttpclient.util.HttpUtils.*;
1920
importstaticorg.asynchttpclient.util.MiscUtils.isNonEmpty;
2021
importio.netty.handler.codec.http.DefaultHttpHeaders;
21-
importio.netty.handler.codec.http.HttpHeaderNames;
2222
importio.netty.handler.codec.http.HttpHeaders;
2323
importio.netty.resolver.DefaultNameResolver;
2424
importio.netty.resolver.NameResolver;
@@ -560,7 +560,7 @@ private RequestBuilderBase<?> executeSignatureCalculator() {
560560
privateCharsetcomputeCharset() {
561561
if (this.charset ==null) {
562562
try {
563-
finalStringcontentType =this.headers.get(HttpHeaderNames.CONTENT_TYPE);
563+
finalStringcontentType =this.headers.get(CONTENT_TYPE);
564564
if (contentType !=null) {
565565
finalCharsetcharset =parseCharset(contentType);
566566
if (charset !=null) {

‎client/src/main/java/org/asynchttpclient/channel/DefaultKeepAliveStrategy.java‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
packageorg.asynchttpclient.channel;
22

3-
importio.netty.handler.codec.http.HttpHeaders;
3+
importstaticio.netty.handler.codec.http.HttpHeaderValues.CLOSE;
44
importio.netty.handler.codec.http.HttpRequest;
55
importio.netty.handler.codec.http.HttpResponse;
6+
importio.netty.handler.codec.http.HttpUtil;
67

78
importorg.asynchttpclient.Request;
89

@@ -16,9 +17,9 @@ public class DefaultKeepAliveStrategy implements KeepAliveStrategy {
1617
*/
1718
@Override
1819
publicbooleankeepAlive(RequestahcRequest,HttpRequestrequest,HttpResponseresponse) {
19-
returnHttpHeaders.isKeepAlive(response)//
20-
&&HttpHeaders.isKeepAlive(request)
20+
returnHttpUtil.isKeepAlive(response)//
21+
&&HttpUtil.isKeepAlive(request)
2122
// support non standard Proxy-Connection
22-
&& !response.headers().contains("Proxy-Connection",HttpHeaders.Values.CLOSE,true);
23+
&& !response.headers().contains("Proxy-Connection",CLOSE,true);
2324
}
2425
}

‎client/src/main/java/org/asynchttpclient/handler/resumable/ResumableAsyncHandler.java‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@
1212
*/
1313
packageorg.asynchttpclient.handler.resumable;
1414

15+
importstaticio.netty.handler.codec.http.HttpHeaderNames.*;
16+
17+
importjava.io.IOException;
18+
importjava.nio.ByteBuffer;
19+
importjava.util.HashMap;
20+
importjava.util.Map;
21+
importjava.util.concurrent.ConcurrentLinkedQueue;
22+
importjava.util.concurrent.atomic.AtomicLong;
23+
1524
importorg.asynchttpclient.AsyncHandler;
1625
importorg.asynchttpclient.HttpResponseBodyPart;
1726
importorg.asynchttpclient.HttpResponseHeaders;
@@ -24,15 +33,6 @@
2433
importorg.slf4j.Logger;
2534
importorg.slf4j.LoggerFactory;
2635

27-
importio.netty.handler.codec.http.HttpHeaders;
28-
29-
importjava.io.IOException;
30-
importjava.nio.ByteBuffer;
31-
importjava.util.HashMap;
32-
importjava.util.Map;
33-
importjava.util.concurrent.ConcurrentLinkedQueue;
34-
importjava.util.concurrent.atomic.AtomicLong;
35-
3636
/**
3737
* An {@link AsyncHandler} which support resumable download, e.g when used with an {@link ResumableIOExceptionFilter},
3838
* this handler can resume the download operation at the point it was before the interruption occurred. This prevent having to
@@ -179,7 +179,7 @@ public Response onCompleted() throws Exception {
179179
@Override
180180
publicAsyncHandler.StateonHeadersReceived(HttpResponseHeadersheaders)throwsException {
181181
responseBuilder.accumulate(headers);
182-
StringcontentLengthHeader =headers.getHeaders().get(HttpHeaders.Names.CONTENT_LENGTH);
182+
StringcontentLengthHeader =headers.getHeaders().get(CONTENT_LENGTH);
183183
if (contentLengthHeader !=null) {
184184
if (Long.parseLong(contentLengthHeader) == -1L) {
185185
returnAsyncHandler.State.ABORT;
@@ -212,8 +212,8 @@ public Request adjustRequestRange(Request request) {
212212
}
213213

214214
RequestBuilderbuilder =newRequestBuilder(request);
215-
if (request.getHeaders().get(HttpHeaders.Names.RANGE) ==null &&byteTransferred.get() !=0) {
216-
builder.setHeader(HttpHeaders.Names.RANGE,"bytes=" +byteTransferred.get() +"-");
215+
if (request.getHeaders().get(RANGE) ==null &&byteTransferred.get() !=0) {
216+
builder.setHeader(RANGE,"bytes=" +byteTransferred.get() +"-");
217217
}
218218
returnbuilder.build();
219219
}

‎client/src/main/java/org/asynchttpclient/netty/NettyResponseStatus.java‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public NettyResponseStatus(Uri uri, AsyncHttpClientConfig config, HttpResponse r
4949
* @return the response status code
5050
*/
5151
publicintgetStatusCode() {
52-
returnresponse.getStatus().code();
52+
returnresponse.status().code();
5353
}
5454

5555
/**
@@ -58,27 +58,27 @@ public int getStatusCode() {
5858
* @return the response status text
5959
*/
6060
publicStringgetStatusText() {
61-
returnresponse.getStatus().reasonPhrase();
61+
returnresponse.status().reasonPhrase();
6262
}
6363

6464
@Override
6565
publicStringgetProtocolName() {
66-
returnresponse.getProtocolVersion().protocolName();
66+
returnresponse.protocolVersion().protocolName();
6767
}
6868

6969
@Override
7070
publicintgetProtocolMajorVersion() {
71-
returnresponse.getProtocolVersion().majorVersion();
71+
returnresponse.protocolVersion().majorVersion();
7272
}
7373

7474
@Override
7575
publicintgetProtocolMinorVersion() {
76-
returnresponse.getProtocolVersion().minorVersion();
76+
returnresponse.protocolVersion().minorVersion();
7777
}
7878

7979
@Override
8080
publicStringgetProtocolText() {
81-
returnresponse.getProtocolVersion().text();
81+
returnresponse.protocolVersion().text();
8282
}
8383

8484
@Override

‎client/src/main/java/org/asynchttpclient/netty/channel/ChannelManager.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515

1616
importstaticorg.asynchttpclient.util.MiscUtils.trimStackTrace;
1717
importio.netty.bootstrap.Bootstrap;
18-
importio.netty.bootstrap.ChannelFactory;
1918
importio.netty.buffer.ByteBufAllocator;
2019
importio.netty.channel.Channel;
20+
importio.netty.channel.ChannelFactory;
2121
importio.netty.channel.ChannelInitializer;
2222
importio.netty.channel.ChannelOption;
2323
importio.netty.channel.ChannelPipeline;

‎client/src/main/java/org/asynchttpclient/netty/channel/EpollSocketChannelFactory.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414
packageorg.asynchttpclient.netty.channel;
1515

16-
importio.netty.bootstrap.ChannelFactory;
16+
importio.netty.channel.ChannelFactory;
1717
importio.netty.channel.epoll.EpollSocketChannel;
1818

1919
classEpollSocketChannelFactoryimplementsChannelFactory<EpollSocketChannel> {

‎client/src/main/java/org/asynchttpclient/netty/channel/NettyConnectListener.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ private void writeRequest(Channel channel) {
8383

8484
if (LOGGER.isDebugEnabled()) {
8585
HttpRequesthttpRequest =future.getNettyRequest().getHttpRequest();
86-
LOGGER.debug("Using new Channel '{}' for '{}' to '{}'",channel,httpRequest.getMethod(),httpRequest.getUri());
86+
LOGGER.debug("Using new Channel '{}' for '{}' to '{}'",channel,httpRequest.method(),httpRequest.uri());
8787
}
8888

8989
Channels.setAttribute(channel,future);

‎client/src/main/java/org/asynchttpclient/netty/channel/NioSocketChannelFactory.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414
packageorg.asynchttpclient.netty.channel;
1515

16-
importio.netty.bootstrap.ChannelFactory;
16+
importio.netty.channel.ChannelFactory;
1717
importio.netty.channel.socket.nio.NioSocketChannel;
1818

1919
enumNioSocketChannelFactoryimplementsChannelFactory<NioSocketChannel> {

‎client/src/main/java/org/asynchttpclient/netty/handler/HttpHandler.java‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
importio.netty.handler.codec.http.HttpObject;
2222
importio.netty.handler.codec.http.HttpRequest;
2323
importio.netty.handler.codec.http.HttpResponse;
24+
importio.netty.handler.codec.http.HttpUtil;
2425
importio.netty.handler.codec.http.LastHttpContent;
2526

2627
importjava.io.IOException;
@@ -77,7 +78,7 @@ private void notifyHandler(Channel channel, NettyResponseFuture<?> future, HttpR
7778
exitAfterHandlingReactiveStreams(channel,future,response,handler,httpRequest);
7879

7980
if (exit)
80-
finishUpdate(future,channel,HttpHeaders.isTransferEncodingChunked(httpRequest) ||HttpHeaders.isTransferEncodingChunked(response));
81+
finishUpdate(future,channel,HttpUtil.isTransferEncodingChunked(httpRequest) ||HttpUtil.isTransferEncodingChunked(response));
8182
}
8283

8384
privatebooleanexitAfterHandlingStatus(//
@@ -173,7 +174,7 @@ public void handleRead(final Channel channel, final NettyResponseFuture<?> futur
173174
try {
174175
if (einstanceofHttpObject) {
175176
HttpObjectobject = (HttpObject)e;
176-
Throwablet =object.getDecoderResult().cause();
177+
Throwablet =object.decoderResult().cause();
177178
if (t !=null) {
178179
readFailed(channel,future,t);
179180
return;

‎client/src/main/java/org/asynchttpclient/netty/handler/WebSocketHandler.java‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313
*/
1414
packageorg.asynchttpclient.netty.handler;
1515

16+
importstaticio.netty.handler.codec.http.HttpHeaderNames.*;
1617
importstaticio.netty.handler.codec.http.HttpResponseStatus.SWITCHING_PROTOCOLS;
1718
importstaticorg.asynchttpclient.ws.WebSocketUtils.getAcceptKey;
1819
importio.netty.channel.Channel;
1920
importio.netty.channel.ChannelHandler.Sharable;
20-
importio.netty.handler.codec.http.HttpHeaders;
21+
importio.netty.handler.codec.http.HttpHeaderValues;
2122
importio.netty.handler.codec.http.HttpRequest;
2223
importio.netty.handler.codec.http.HttpResponse;
2324
importio.netty.handler.codec.http.websocketx.BinaryWebSocketFrame;
@@ -28,15 +29,14 @@
2829
importio.netty.handler.codec.http.websocketx.WebSocketFrame;
2930

3031
importjava.io.IOException;
31-
importjava.util.Locale;
3232

3333
importorg.asynchttpclient.AsyncHandler.State;
3434
importorg.asynchttpclient.AsyncHttpClientConfig;
3535
importorg.asynchttpclient.HttpResponseHeaders;
3636
importorg.asynchttpclient.HttpResponseStatus;
37-
importorg.asynchttpclient.netty.OnLastHttpContentCallback;
3837
importorg.asynchttpclient.netty.NettyResponseFuture;
3938
importorg.asynchttpclient.netty.NettyResponseStatus;
39+
importorg.asynchttpclient.netty.OnLastHttpContentCallback;
4040
importorg.asynchttpclient.netty.channel.ChannelManager;
4141
importorg.asynchttpclient.netty.channel.Channels;
4242
importorg.asynchttpclient.netty.request.NettyRequestSender;
@@ -85,12 +85,12 @@ private void invokeOnSucces(Channel channel, WebSocketUpgradeHandler h) {
8585
@Override
8686
publicvoidcall()throwsException {
8787

88-
booleanvalidStatus =response.getStatus().equals(SWITCHING_PROTOCOLS);
89-
booleanvalidUpgrade =response.headers().get(HttpHeaders.Names.UPGRADE) !=null;
90-
Stringconnection =response.headers().get(HttpHeaders.Names.CONNECTION);
88+
booleanvalidStatus =response.status().equals(SWITCHING_PROTOCOLS);
89+
booleanvalidUpgrade =response.headers().get(UPGRADE) !=null;
90+
Stringconnection =response.headers().get(CONNECTION);
9191
if (connection ==null)
92-
connection =response.headers().get(HttpHeaders.Names.CONNECTION.toLowerCase(Locale.ENGLISH));
93-
booleanvalidConnection =HttpHeaders.Values.UPGRADE.equalsIgnoreCase(connection);
92+
connection =response.headers().get(CONNECTION);
93+
booleanvalidConnection =HttpHeaderValues.UPGRADE.contentEqualsIgnoreCase(connection);
9494
booleanstatusReceived =handler.onStatusReceived(status) ==State.UPGRADE;
9595

9696
if (!statusReceived) {
@@ -108,8 +108,8 @@ public void call() throws Exception {
108108
return;
109109
}
110110

111-
Stringaccept =response.headers().get(HttpHeaders.Names.SEC_WEBSOCKET_ACCEPT);
112-
Stringkey =getAcceptKey(future.getNettyRequest().getHttpRequest().headers().get(HttpHeaders.Names.SEC_WEBSOCKET_KEY));
111+
Stringaccept =response.headers().get(SEC_WEBSOCKET_ACCEPT);
112+
Stringkey =getAcceptKey(future.getNettyRequest().getHttpRequest().headers().get(SEC_WEBSOCKET_KEY));
113113
if (accept ==null || !accept.equals(key)) {
114114
requestSender.abort(channel,future,newIOException(String.format("Invalid challenge. Actual: %s. Expected: %s",accept,key)));
115115
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp