Merge branch '5.3.x' into main

This commit is contained in:
rstoyanchev
2022-01-12 09:02:07 +00:00
8 changed files with 68 additions and 29 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -211,9 +211,18 @@ public abstract class AbstractServerHttpRequest implements ServerHttpRequest {
*/
String getLogPrefix() {
if (this.logPrefix == null) {
this.logPrefix = "[" + getId() + "] ";
this.logPrefix = "[" + initLogPrefix() + "] ";
}
return this.logPrefix;
}
/**
* Subclasses can override this to provide the prefix to use for log messages.
* <p>By default, this is {@link #getId()}.
* @since 5.3.15
*/
protected String initLogPrefix() {
return getId();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -78,7 +78,7 @@ class ReactorServerHttpRequest extends AbstractServerHttpRequest {
private static URI initUri(HttpServerRequest request) throws URISyntaxException {
Assert.notNull(request, "HttpServerRequest must not be null");
return new URI(resolveBaseUrl(request).toString() + resolveRequestUri(request));
return new URI(resolveBaseUrl(request) + resolveRequestUri(request));
}
private static URI resolveBaseUrl(HttpServerRequest request) throws URISyntaxException {
@@ -203,9 +203,6 @@ class ReactorServerHttpRequest extends AbstractServerHttpRequest {
@Override
@Nullable
protected String initId() {
if (reactorNettyRequestChannelOperationsIdPresent) {
return (ChannelOperationsIdHelper.getId(this.request));
}
if (this.request instanceof Connection) {
return ((Connection) this.request).channel().id().asShortText() +
"-" + logPrefixIndex.incrementAndGet();
@@ -213,6 +210,21 @@ class ReactorServerHttpRequest extends AbstractServerHttpRequest {
return null;
}
@Override
protected String initLogPrefix() {
if (reactorNettyRequestChannelOperationsIdPresent) {
String id = (ChannelOperationsIdHelper.getId(this.request));
if (id != null) {
return id;
}
}
if (this.request instanceof Connection) {
return ((Connection) this.request).channel().id().asShortText() +
"-" + logPrefixIndex.incrementAndGet();
}
return getId();
}
private static class ChannelOperationsIdHelper {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -65,6 +65,16 @@ public class ServerHttpResponseDecorator implements ServerHttpResponse {
return getDelegate().getStatusCode();
}
@Override
public boolean setRawStatusCode(@Nullable Integer value) {
return getDelegate().setRawStatusCode(value);
}
@Override
public Integer getRawStatusCode() {
return getDelegate().getRawStatusCode();
}
@Override
public HttpHeaders getHeaders() {
return getDelegate().getHeaders();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -85,11 +85,12 @@ public class HandlerMethodArgumentResolverComposite implements HandlerMethodArgu
}
/**
* Clear the list of configured resolvers.
* Clear the list of configured resolvers and the resolver cache.
* @since 4.3
*/
public void clear() {
this.argumentResolvers.clear();
this.argumentResolverCache.clear();
}