remove URL mutator method

This commit is contained in:
Jörg Prante 2024-01-04 22:41:48 +01:00
parent 5b46911bd8
commit c520769ddc
8 changed files with 9 additions and 14 deletions

View file

@ -1,3 +1,3 @@
group = org.xbib
name = net-http
version = 4.0.10
version = 4.1.0

View file

@ -34,7 +34,7 @@ public abstract class BaseHttpRequest implements HttpRequest {
HttpHeaders validatedHeaders = HttpHeaders.of(builder.httpHeaders);
if (builder.url != null) {
// create new URL object so we can safely add our URI parameters to the URL by mutating it
URLBuilder urlBuilder = URL.from(builder.url).mutator();
URLBuilder urlBuilder = URL.builder(builder.url);
if (builder.requestPath != null) {
urlBuilder.path(builder.requestPath);
}

View file

@ -2,7 +2,4 @@ dependencies {
api project(':net-http-server-netty-secure')
api project(':net-http-client-netty-secure')
runtimeOnly(variantOf(libs.netty.boringssl) { classifier('linux-x86_64') })
runtimeOnly(variantOf(libs.netty.boringssl) { classifier('linux-aarch_64') })
runtimeOnly(variantOf(libs.netty.boringssl) { classifier('osx-x86_64') })
runtimeOnly(variantOf(libs.netty.boringssl) { classifier('osx-aarch_64') })
}

View file

@ -229,7 +229,7 @@ public abstract class BaseHttpRequestBuilder implements HttpRequestBuilder {
.host(host)
.port(port)
.build();
URLBuilder builder = URL.from(uri).mutator();
URLBuilder builder = URL.builder(URL.from(uri));
URL url = builder.build();
if (!url.isAbsolute()) {
this.baseURL = builder

View file

@ -68,9 +68,8 @@ public abstract class AbstractResourceHandler implements HttpHandler {
} else if (resource.isDirectory()) {
logger.log(Level.FINEST, "we have a directory request");
if (!resource.getResourcePath().isEmpty() && !resource.getResourcePath().endsWith("/")) {
URL url = context.getRequestBuilder().getBaseURL();
String loc = url.resolve(resource.getName() + '/')
.mutator()
URL url = context.getRequestBuilder().getBaseURL().resolve(resource.getName() + '/');
String loc = URL.builder(url)
.query(url.getQuery())
.fragment(url.getFragment())
.build()

View file

@ -49,9 +49,8 @@ public class WebRootResourceResolver implements ResourceResolver {
if (Files.isDirectory(resource.getPath())) {
// we need to move temporarily to the directory, and the browser must know about this.
HttpRequest request = httpRouterContext.getRequest();
URL url = request.getBaseURL(); //response.server().getPublishURL(request);
String loc = url.resolve(resource.getName() + '/')
.mutator()
URL url = request.getBaseURL().resolve(resource.getName() + '/');
String loc = URL.builder(url)
.query(request.getBaseURL().getQuery())
.fragment(request.getBaseURL().getFragment())
.build()

View file

@ -135,7 +135,7 @@ public abstract class DefaultMarkupTemplate extends BaseTemplate {
}
public String encodeUrl(String rel, boolean absolute) {
URLBuilder builder = request.getServerURL().resolve(rel).mutator();
URLBuilder builder = URL.builder(request.getServerURL().resolve(rel));
if (session != null) {
if (getModel().containsKey("session.url.enabled") && getModel().containsKey("session.url.parametername")) {
String sessionIdParameterName = (String) getModel().get("session.url.parametername");

View file

@ -6,7 +6,7 @@ dependencyResolutionManagement {
version('netty', '4.1.104.Final')
version('netty-tcnative', '2.0.62.Final')
version('datastructures', '5.0.6')
version('net', '4.0.4')
version('net', '4.1.0')
library('netty-codec-http2', 'io.netty', 'netty-codec-http2').versionRef('netty')
library('netty-handler', 'io.netty', 'netty-handler').versionRef('netty')
library('netty-handler-proxy', 'io.netty', 'netty-handler-proxy').versionRef('netty')