Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache ServerHttpRequest::getMethod in AbstractServerHttpRequest #30139

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
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ class ReactorNetty2ServerHttpRequest extends AbstractServerHttpRequest {

private final Netty5DataBufferFactory bufferFactory;

private final HttpMethod method;


public ReactorNetty2ServerHttpRequest(HttpServerRequest request, Netty5DataBufferFactory bufferFactory)
throws URISyntaxException {
Expand All @@ -71,6 +73,7 @@ public ReactorNetty2ServerHttpRequest(HttpServerRequest request, Netty5DataBuffe
Assert.notNull(bufferFactory, "DataBufferFactory must not be null");
this.request = request;
this.bufferFactory = bufferFactory;
this.method = HttpMethod.valueOf(request.method().name());
}

private static URI initUri(HttpServerRequest request) throws URISyntaxException {
Expand Down Expand Up @@ -141,7 +144,7 @@ private static String resolveRequestUri(HttpServerRequest request) {

@Override
public HttpMethod getMethod() {
return HttpMethod.valueOf(this.request.method().name());
return this.method;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ class ReactorServerHttpRequest extends AbstractServerHttpRequest {

private final NettyDataBufferFactory bufferFactory;

private final HttpMethod method;


public ReactorServerHttpRequest(HttpServerRequest request, NettyDataBufferFactory bufferFactory)
throws URISyntaxException {
Expand All @@ -69,6 +71,7 @@ public ReactorServerHttpRequest(HttpServerRequest request, NettyDataBufferFactor
Assert.notNull(bufferFactory, "DataBufferFactory must not be null");
this.request = request;
this.bufferFactory = bufferFactory;
this.method = HttpMethod.valueOf(request.method().name());
}

private static URI initUri(HttpServerRequest request) throws URISyntaxException {
Expand Down Expand Up @@ -111,7 +114,7 @@ private static String resolveRequestUri(HttpServerRequest request) {

@Override
public HttpMethod getMethod() {
return HttpMethod.valueOf(this.request.method().name());
return this.method;
}

@Override
Expand Down