public class URLCoder
extends java.lang.Object
Here is an example of full URL: https://jodd:ddoj@www.jodd.org:8080/file;p=1?q=2#third. It consist of:
builder
.
It provides fluent interface for defining query parameters.Modifier and Type | Class and Description |
---|---|
static class |
URLCoder.Builder |
Constructor and Description |
---|
URLCoder() |
Modifier and Type | Method and Description |
---|---|
static URLCoder.Builder |
build(java.lang.String path)
Creates URL builder for user-friendly way of building URLs.
|
static URLCoder.Builder |
build(java.lang.String path,
boolean encodePath)
Creates URL builder with given path that can be optionally encoded.
|
static java.lang.String |
encode(java.lang.String string) |
static java.lang.String |
encode(java.lang.String string,
java.lang.String encoding)
Encodes string using default RFCP rules.
|
static java.lang.String |
encodeFragment(java.lang.String fragment) |
static java.lang.String |
encodeFragment(java.lang.String fragment,
java.lang.String encoding)
Encodes the given URI fragment with the given encoding.
|
static java.lang.String |
encodeHost(java.lang.String host) |
static java.lang.String |
encodeHost(java.lang.String host,
java.lang.String encoding)
Encodes the given URI host with the given encoding.
|
static java.lang.String |
encodeHttpUrl(java.lang.String httpUrl) |
static java.lang.String |
encodeHttpUrl(java.lang.String httpUrl,
java.lang.String encoding)
Encodes the given HTTP URI into an encoded String.
|
static java.lang.String |
encodePath(java.lang.String path) |
static java.lang.String |
encodePath(java.lang.String path,
java.lang.String encoding)
Encodes the given URI path with the given encoding.
|
static java.lang.String |
encodePathSegment(java.lang.String segment) |
static java.lang.String |
encodePathSegment(java.lang.String segment,
java.lang.String encoding)
Encodes the given URI path segment with the given encoding.
|
static java.lang.String |
encodePort(java.lang.String port) |
static java.lang.String |
encodePort(java.lang.String port,
java.lang.String encoding)
Encodes the given URI port with the given encoding.
|
static java.lang.String |
encodeQuery(java.lang.String query) |
static java.lang.String |
encodeQuery(java.lang.String query,
java.lang.String encoding)
Encodes the given URI query with the given encoding.
|
static java.lang.String |
encodeQueryParam(java.lang.String queryParam) |
static java.lang.String |
encodeQueryParam(java.lang.String queryParam,
java.lang.String encoding)
Encodes the given URI query parameter with the given encoding.
|
static java.lang.String |
encodeScheme(java.lang.String scheme) |
static java.lang.String |
encodeScheme(java.lang.String scheme,
java.lang.String encoding)
Encodes the given URI scheme with the given encoding.
|
static java.lang.String |
encodeUri(java.lang.String uri) |
static java.lang.String |
encodeUri(java.lang.String uri,
java.lang.String encoding)
Encodes the given source URI into an encoded String.
|
static java.lang.String |
encodeUserInfo(java.lang.String userInfo) |
static java.lang.String |
encodeUserInfo(java.lang.String userInfo,
java.lang.String encoding)
Encodes the given URI user info with the given encoding.
|
public static java.lang.String encode(java.lang.String string, java.lang.String encoding)
public static java.lang.String encode(java.lang.String string)
public static java.lang.String encodeScheme(java.lang.String scheme, java.lang.String encoding)
public static java.lang.String encodeScheme(java.lang.String scheme)
public static java.lang.String encodeUserInfo(java.lang.String userInfo, java.lang.String encoding)
public static java.lang.String encodeUserInfo(java.lang.String userInfo)
public static java.lang.String encodeHost(java.lang.String host, java.lang.String encoding)
public static java.lang.String encodeHost(java.lang.String host)
public static java.lang.String encodePort(java.lang.String port, java.lang.String encoding)
public static java.lang.String encodePort(java.lang.String port)
public static java.lang.String encodePath(java.lang.String path, java.lang.String encoding)
public static java.lang.String encodePath(java.lang.String path)
public static java.lang.String encodePathSegment(java.lang.String segment, java.lang.String encoding)
public static java.lang.String encodePathSegment(java.lang.String segment)
public static java.lang.String encodeQuery(java.lang.String query, java.lang.String encoding)
public static java.lang.String encodeQuery(java.lang.String query)
public static java.lang.String encodeQueryParam(java.lang.String queryParam, java.lang.String encoding)
public static java.lang.String encodeQueryParam(java.lang.String queryParam)
public static java.lang.String encodeFragment(java.lang.String fragment, java.lang.String encoding)
public static java.lang.String encodeFragment(java.lang.String fragment)
public static java.lang.String encodeUri(java.lang.String uri)
encodeUri(String, String)
public static java.lang.String encodeUri(java.lang.String uri, java.lang.String encoding)
This method does not attempt to encode "=" and "&" characters in query parameter names and query parameter values because they cannot be parsed in a reliable way.
public static java.lang.String encodeHttpUrl(java.lang.String httpUrl)
encodeHttpUrl(String, String)
public static java.lang.String encodeHttpUrl(java.lang.String httpUrl, java.lang.String encoding)
This method does not support fragments (#
),
as these are not supposed to be sent to the server, but retained by the client.
This method does not attempt to encode "=" and "&" characters in query parameter names and query parameter values because they cannot be parsed in a reliable way.
public static URLCoder.Builder build(java.lang.String path)
encoded
.build(String, boolean)
public static URLCoder.Builder build(java.lang.String path, boolean encodePath)
The purpose of builder is to help with query parameters. All other URI parts should be set previously or after the URL is built.
Copyright © 2003-present Jodd Team