/** * Rewrites the URL of the request according to the rewrite rules. * * @param request a request * @return a rewritten request */ public HttpRequest rewrite(HttpRequest request) { String path = request.path(); String newPath = newPath(path); if (!Objects.equals(newPath, path)) { Url newUrl = request.url().newBuilder().path(newPath).build(); return request.newBuilder() .url(newUrl) .build(); } return request; }
/** * Sets the request URI. * * @param uri URI * @return {@code this} */ public Builder uri(String uri) { return this.url(Url.Builder.url(uri).build()); }
/** * Sets the request URI. * * @param uri URI * @return {@code this} */ public Builder uri(String uri) { return this.url(Url.Builder.url(uri).build()); }