Initialize RequestPath on demand
Closes gh-33227
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
@@ -50,7 +50,11 @@ public abstract class AbstractServerHttpRequest implements ServerHttpRequest {
|
||||
|
||||
private final URI uri;
|
||||
|
||||
private final RequestPath path;
|
||||
@Nullable
|
||||
private final String contextPath;
|
||||
|
||||
@Nullable
|
||||
private RequestPath path;
|
||||
|
||||
private final HttpHeaders headers;
|
||||
|
||||
@@ -92,7 +96,7 @@ public abstract class AbstractServerHttpRequest implements ServerHttpRequest {
|
||||
|
||||
this.method = method;
|
||||
this.uri = uri;
|
||||
this.path = RequestPath.parse(uri, contextPath);
|
||||
this.contextPath = contextPath;
|
||||
this.headers = HttpHeaders.readOnlyHttpHeaders(headers);
|
||||
}
|
||||
|
||||
@@ -140,6 +144,9 @@ public abstract class AbstractServerHttpRequest implements ServerHttpRequest {
|
||||
|
||||
@Override
|
||||
public RequestPath getPath() {
|
||||
if (this.path == null) {
|
||||
this.path = RequestPath.parse(this.uri, this.contextPath);
|
||||
}
|
||||
return this.path;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user