Moved fromServerRequest to ServerRequest itself
This commit moves WebFluxUriComponentsBuilder.fromServerRequest to the ServerRequest interface itself. Consequently, the WebFluxUriComponentsBuilder is removes itself, as it contained no other methods. Issue: SPR-15953
This commit is contained in:
@@ -38,6 +38,7 @@ import org.springframework.http.HttpCookie;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.HttpRange;
|
||||
import org.springframework.http.HttpRequest;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.server.PathContainer;
|
||||
import org.springframework.http.server.RequestPath;
|
||||
@@ -50,6 +51,8 @@ import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.reactive.function.BodyExtractor;
|
||||
import org.springframework.web.reactive.function.server.ServerRequest;
|
||||
import org.springframework.web.server.WebSession;
|
||||
import org.springframework.web.util.UriBuilder;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
|
||||
/**
|
||||
* Mock implementation of {@link ServerRequest}.
|
||||
@@ -119,6 +122,11 @@ public class MockServerRequest implements ServerRequest {
|
||||
return this.uri;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UriBuilder uriBuilder() {
|
||||
return UriComponentsBuilder.fromHttpRequest(new ServerRequestAdapter());
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathContainer pathContainer() {
|
||||
return this.pathContainer;
|
||||
@@ -467,4 +475,23 @@ public class MockServerRequest implements ServerRequest {
|
||||
|
||||
}
|
||||
|
||||
private final class ServerRequestAdapter implements HttpRequest {
|
||||
|
||||
@Override
|
||||
public String getMethodValue() {
|
||||
return methodName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public URI getURI() {
|
||||
return MockServerRequest.this.uri;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpHeaders getHeaders() {
|
||||
return MockServerRequest.this.headers.headers;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user