class UrlDecoder {

    static Url decodeUrl(UnwiseCharsEncoder unwiseCharEncoder, HttpRequest request) {
        String host = request.headers().get(HOST);

        if (request.uri().startsWith("/") && host != null) {
            URI uri = URI.create("http://" + host + unwiseCharEncoder.encode(request.uri()));
            return new Url.Builder()
                    .path(uri.getRawPath())
                    .rawQuery(uri.getRawQuery())
                    .fragment(uri.getFragment())
                    .build();
        } else {
            return url(unwiseCharEncoder.encode(request.uri())).build();
        }
    }

    private  UrlDecoder();

}