Polishing
This commit is contained in:
parent
a80fd9994a
commit
780993ce75
|
|
@ -27,7 +27,6 @@ import io.netty.bootstrap.Bootstrap;
|
|||
import io.netty.buffer.ByteBufOutputStream;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelFuture;
|
||||
import io.netty.channel.ChannelFutureListener;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.SimpleChannelInboundHandler;
|
||||
|
|
@ -115,18 +114,15 @@ class Netty4ClientHttpRequest extends AbstractAsyncClientHttpRequest implements
|
|||
protected ListenableFuture<ClientHttpResponse> executeInternal(final HttpHeaders headers) throws IOException {
|
||||
final SettableListenableFuture<ClientHttpResponse> responseFuture = new SettableListenableFuture<>();
|
||||
|
||||
ChannelFutureListener connectionListener = new ChannelFutureListener() {
|
||||
@Override
|
||||
public void operationComplete(ChannelFuture future) throws Exception {
|
||||
if (future.isSuccess()) {
|
||||
Channel channel = future.channel();
|
||||
channel.pipeline().addLast(new RequestExecuteHandler(responseFuture));
|
||||
FullHttpRequest nettyRequest = createFullHttpRequest(headers);
|
||||
channel.writeAndFlush(nettyRequest);
|
||||
}
|
||||
else {
|
||||
responseFuture.setException(future.cause());
|
||||
}
|
||||
ChannelFutureListener connectionListener = future -> {
|
||||
if (future.isSuccess()) {
|
||||
Channel channel = future.channel();
|
||||
channel.pipeline().addLast(new RequestExecuteHandler(responseFuture));
|
||||
FullHttpRequest nettyRequest = createFullHttpRequest(headers);
|
||||
channel.writeAndFlush(nettyRequest);
|
||||
}
|
||||
else {
|
||||
responseFuture.setException(future.cause());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -93,7 +93,6 @@ public class PathResourceResolver extends AbstractResourceResolver {
|
|||
* <p><strong>Note:</strong> the charset is used only if the
|
||||
* {@link #setUrlPathHelper urlPathHelper} property is also configured and
|
||||
* its {@code urlDecode} property is set to true.
|
||||
* @param locationCharsets charsets by location
|
||||
* @since 4.3.13
|
||||
*/
|
||||
public void setLocationCharsets(Map<Resource, Charset> locationCharsets) {
|
||||
|
|
@ -106,14 +105,13 @@ public class PathResourceResolver extends AbstractResourceResolver {
|
|||
* @since 4.3.13
|
||||
*/
|
||||
public Map<Resource, Charset> getLocationCharsets() {
|
||||
return Collections.unmodifiableMap(locationCharsets);
|
||||
return Collections.unmodifiableMap(this.locationCharsets);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide a reference to the {@link UrlPathHelper} used to map requests to
|
||||
* static resources. This helps to derive information about the lookup path
|
||||
* such as whether it is decoded or not.
|
||||
* @param urlPathHelper a reference to the path helper
|
||||
* @since 4.3.13
|
||||
*/
|
||||
public void setUrlPathHelper(@Nullable UrlPathHelper urlPathHelper) {
|
||||
|
|
@ -129,6 +127,7 @@ public class PathResourceResolver extends AbstractResourceResolver {
|
|||
return this.urlPathHelper;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Resource resolveResourceInternal(@Nullable HttpServletRequest request, String requestPath,
|
||||
List<? extends Resource> locations, ResourceResolverChain chain) {
|
||||
|
|
|
|||
|
|
@ -153,13 +153,12 @@ public class ResourceHttpRequestHandler extends WebContentGenerator
|
|||
* {@link org.springframework.core.io.UrlResource URL resources} such as a
|
||||
* file or an HTTP URL location and is used in {@link PathResourceResolver}
|
||||
* to correctly encode paths relative to the location.
|
||||
* <p><strong>Note:</strong> the charset is used only if the
|
||||
* <p><strong>Note:</strong> The charset is used only if the
|
||||
* {@link #setUrlPathHelper urlPathHelper} property is also configured and
|
||||
* its {@code urlDecode} property is set to true.
|
||||
* @param locationCharsets charsets by location
|
||||
* its {@code urlDecode} property is set to {@code true}.
|
||||
* @since 4.3.13
|
||||
*/
|
||||
public void setLocationCharsets(Map<Resource,Charset> locationCharsets) {
|
||||
public void setLocationCharsets(Map<Resource, Charset> locationCharsets) {
|
||||
this.locationCharsets.clear();
|
||||
this.locationCharsets.putAll(locationCharsets);
|
||||
}
|
||||
|
|
@ -169,7 +168,7 @@ public class ResourceHttpRequestHandler extends WebContentGenerator
|
|||
* @since 4.3.13
|
||||
*/
|
||||
public Map<Resource, Charset> getLocationCharsets() {
|
||||
return Collections.unmodifiableMap(locationCharsets);
|
||||
return Collections.unmodifiableMap(this.locationCharsets);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -286,7 +285,6 @@ public class ResourceHttpRequestHandler extends WebContentGenerator
|
|||
* Provide a reference to the {@link UrlPathHelper} used to map requests to
|
||||
* static resources. This helps to derive information about the lookup path
|
||||
* such as whether it is decoded or not.
|
||||
* @param urlPathHelper a reference to the path helper
|
||||
* @since 4.3.13
|
||||
*/
|
||||
public void setUrlPathHelper(@Nullable UrlPathHelper urlPathHelper) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue