public class HttpImpl
extends Object
implements com.liferay.portal.kernel.util.Http
com.liferay.portal.kernel.util.Http.Auth, com.liferay.portal.kernel.util.Http.Body, com.liferay.portal.kernel.util.Http.FilePart, com.liferay.portal.kernel.util.Http.Method, com.liferay.portal.kernel.util.Http.Options, com.liferay.portal.kernel.util.Http.Response
Constructor and Description |
---|
HttpImpl() |
Modifier and Type | Method and Description |
---|---|
String |
addParameter(String url,
String name,
boolean value) |
String |
addParameter(String url,
String name,
double value) |
String |
addParameter(String url,
String name,
int value) |
String |
addParameter(String url,
String name,
long value) |
String |
addParameter(String url,
String name,
short value) |
String |
addParameter(String url,
String name,
String value) |
protected void |
addProxyCredentials(URI uri,
org.apache.http.client.protocol.HttpClientContext httpClientContext) |
String |
decodePath(String path) |
String |
decodeURL(String url) |
void |
destroy() |
String |
encodeParameters(String url) |
String |
encodePath(String path) |
String |
fixPath(String path) |
String |
fixPath(String path,
boolean leading,
boolean trailing) |
protected org.apache.http.impl.client.CloseableHttpClient |
getCloseableHttpClient(org.apache.http.HttpHost proxyHost) |
String |
getCompleteURL(javax.servlet.http.HttpServletRequest httpServletRequest) |
javax.servlet.http.Cookie[] |
getCookies() |
String |
getDomain(String url) |
String |
getIpAddress(String url) |
String |
getParameter(String url,
String name) |
String |
getParameter(String url,
String name,
boolean escaped) |
Map<String,String[]> |
getParameterMap(String queryString) |
String |
getPath(String url) |
String |
getProtocol(ActionRequest actionRequest) |
String |
getProtocol(boolean secure) |
String |
getProtocol(javax.servlet.http.HttpServletRequest httpServletRequest) |
String |
getProtocol(RenderRequest renderRequest) |
String |
getProtocol(String url) |
String |
getQueryString(String url) |
protected org.apache.http.client.config.RequestConfig.Builder |
getRequestConfigBuilder(URI uri,
int timeout) |
String |
getRequestURL(javax.servlet.http.HttpServletRequest httpServletRequest) |
URI |
getURI(String uriString) |
boolean |
hasDomain(String url) |
boolean |
hasProtocol(String url) |
boolean |
hasProxyConfig() |
protected boolean |
hasRequestHeader(org.apache.http.client.methods.RequestBuilder requestBuilder,
String name) |
boolean |
isNonProxyHost(String host) |
boolean |
isProxyHost(String host) |
boolean |
isSecure(String url) |
String |
normalizePath(String uri) |
Map<String,String[]> |
parameterMapFromString(String queryString) |
String |
parameterMapToString(Map<String,String[]> parameterMap) |
String |
parameterMapToString(Map<String,String[]> parameterMap,
boolean addQuestion) |
protected void |
processPostMethod(org.apache.http.client.methods.RequestBuilder requestBuilder,
Map<String,String> headers,
List<com.liferay.portal.kernel.util.Http.FilePart> fileParts,
Map<String,String> parts) |
String |
protocolize(String url,
ActionRequest actionRequest) |
String |
protocolize(String url,
boolean secure) |
String |
protocolize(String url,
javax.servlet.http.HttpServletRequest httpServletRequest) |
String |
protocolize(String url,
int port,
boolean secure) |
String |
protocolize(String url,
RenderRequest renderRequest) |
String |
removeDomain(String url) |
String |
removeParameter(String url,
String name) |
String |
removePathParameters(String uri) |
String |
removeProtocol(String url) |
String |
sanitizeHeader(String header) |
String |
setParameter(String url,
String name,
boolean value) |
String |
setParameter(String url,
String name,
double value) |
String |
setParameter(String url,
String name,
int value) |
String |
setParameter(String url,
String name,
long value) |
String |
setParameter(String url,
String name,
short value) |
String |
setParameter(String url,
String name,
String value) |
String |
shortenURL(String url) |
protected org.apache.http.cookie.Cookie |
toHttpCookie(javax.servlet.http.Cookie cookie) |
protected org.apache.http.cookie.Cookie[] |
toHttpCookies(javax.servlet.http.Cookie[] cookies) |
protected javax.servlet.http.Cookie |
toServletCookie(org.apache.http.cookie.Cookie httpCookie) |
protected javax.servlet.http.Cookie[] |
toServletCookies(List<org.apache.http.cookie.Cookie> httpCookies) |
byte[] |
URLtoByteArray(com.liferay.portal.kernel.util.Http.Options options) |
byte[] |
URLtoByteArray(String location) |
byte[] |
URLtoByteArray(String location,
boolean post) |
protected byte[] |
URLtoByteArray(String location,
com.liferay.portal.kernel.util.Http.Method method,
Map<String,String> headers,
javax.servlet.http.Cookie[] cookies,
com.liferay.portal.kernel.util.Http.Auth auth,
com.liferay.portal.kernel.util.Http.Body body,
List<com.liferay.portal.kernel.util.Http.FilePart> fileParts,
Map<String,String> parts,
com.liferay.portal.kernel.util.Http.Response response,
boolean followRedirects) |
protected byte[] |
URLtoByteArray(String location,
com.liferay.portal.kernel.util.Http.Method method,
Map<String,String> headers,
javax.servlet.http.Cookie[] cookies,
com.liferay.portal.kernel.util.Http.Auth auth,
com.liferay.portal.kernel.util.Http.Body body,
List<com.liferay.portal.kernel.util.Http.FilePart> fileParts,
Map<String,String> parts,
com.liferay.portal.kernel.util.Http.Response response,
boolean followRedirects,
int timeout) |
InputStream |
URLtoInputStream(com.liferay.portal.kernel.util.Http.Options options) |
InputStream |
URLtoInputStream(String location) |
InputStream |
URLtoInputStream(String location,
boolean post) |
protected InputStream |
URLtoInputStream(String location,
com.liferay.portal.kernel.util.Http.Method method,
Map<String,String> headers,
javax.servlet.http.Cookie[] cookies,
com.liferay.portal.kernel.util.Http.Auth auth,
com.liferay.portal.kernel.util.Http.Body body,
List<com.liferay.portal.kernel.util.Http.FilePart> fileParts,
Map<String,String> parts,
com.liferay.portal.kernel.util.Http.Response response,
boolean followRedirects) |
protected InputStream |
URLtoInputStream(String location,
com.liferay.portal.kernel.util.Http.Method method,
Map<String,String> headers,
javax.servlet.http.Cookie[] cookies,
com.liferay.portal.kernel.util.Http.Auth auth,
com.liferay.portal.kernel.util.Http.Body body,
List<com.liferay.portal.kernel.util.Http.FilePart> fileParts,
Map<String,String> parts,
com.liferay.portal.kernel.util.Http.Response response,
boolean followRedirects,
int timeout) |
String |
URLtoString(com.liferay.portal.kernel.util.Http.Options options) |
String |
URLtoString(String location) |
String |
URLtoString(String location,
boolean post) |
String |
URLtoString(URL url)
This method only uses the default Commons HttpClient implementation when
the URL object represents a HTTP resource.
|
public String addParameter(String url, String name, boolean value)
addParameter
in interface com.liferay.portal.kernel.util.Http
public String addParameter(String url, String name, double value)
addParameter
in interface com.liferay.portal.kernel.util.Http
public String addParameter(String url, String name, int value)
addParameter
in interface com.liferay.portal.kernel.util.Http
public String addParameter(String url, String name, long value)
addParameter
in interface com.liferay.portal.kernel.util.Http
public String addParameter(String url, String name, short value)
addParameter
in interface com.liferay.portal.kernel.util.Http
public String addParameter(String url, String name, String value)
addParameter
in interface com.liferay.portal.kernel.util.Http
public String decodePath(String path)
decodePath
in interface com.liferay.portal.kernel.util.Http
public String decodeURL(String url)
decodeURL
in interface com.liferay.portal.kernel.util.Http
public void destroy()
public String encodeParameters(String url)
encodeParameters
in interface com.liferay.portal.kernel.util.Http
public String encodePath(String path)
encodePath
in interface com.liferay.portal.kernel.util.Http
public String fixPath(String path)
fixPath
in interface com.liferay.portal.kernel.util.Http
public String fixPath(String path, boolean leading, boolean trailing)
fixPath
in interface com.liferay.portal.kernel.util.Http
public String getCompleteURL(javax.servlet.http.HttpServletRequest httpServletRequest)
getCompleteURL
in interface com.liferay.portal.kernel.util.Http
public javax.servlet.http.Cookie[] getCookies()
getCookies
in interface com.liferay.portal.kernel.util.Http
public String getDomain(String url)
getDomain
in interface com.liferay.portal.kernel.util.Http
public String getIpAddress(String url)
getIpAddress
in interface com.liferay.portal.kernel.util.Http
public String getParameter(String url, String name)
getParameter
in interface com.liferay.portal.kernel.util.Http
public String getParameter(String url, String name, boolean escaped)
getParameter
in interface com.liferay.portal.kernel.util.Http
public Map<String,String[]> getParameterMap(String queryString)
getParameterMap
in interface com.liferay.portal.kernel.util.Http
public String getPath(String url)
getPath
in interface com.liferay.portal.kernel.util.Http
public String getProtocol(ActionRequest actionRequest)
getProtocol
in interface com.liferay.portal.kernel.util.Http
public String getProtocol(boolean secure)
getProtocol
in interface com.liferay.portal.kernel.util.Http
public String getProtocol(javax.servlet.http.HttpServletRequest httpServletRequest)
getProtocol
in interface com.liferay.portal.kernel.util.Http
public String getProtocol(RenderRequest renderRequest)
getProtocol
in interface com.liferay.portal.kernel.util.Http
public String getProtocol(String url)
getProtocol
in interface com.liferay.portal.kernel.util.Http
public String getQueryString(String url)
getQueryString
in interface com.liferay.portal.kernel.util.Http
public String getRequestURL(javax.servlet.http.HttpServletRequest httpServletRequest)
getRequestURL
in interface com.liferay.portal.kernel.util.Http
public URI getURI(String uriString)
getURI
in interface com.liferay.portal.kernel.util.Http
public boolean hasDomain(String url)
hasDomain
in interface com.liferay.portal.kernel.util.Http
public boolean hasProtocol(String url)
hasProtocol
in interface com.liferay.portal.kernel.util.Http
public boolean hasProxyConfig()
hasProxyConfig
in interface com.liferay.portal.kernel.util.Http
public boolean isNonProxyHost(String host)
isNonProxyHost
in interface com.liferay.portal.kernel.util.Http
public boolean isProxyHost(String host)
isProxyHost
in interface com.liferay.portal.kernel.util.Http
public boolean isSecure(String url)
isSecure
in interface com.liferay.portal.kernel.util.Http
public String normalizePath(String uri)
normalizePath
in interface com.liferay.portal.kernel.util.Http
public Map<String,String[]> parameterMapFromString(String queryString)
parameterMapFromString
in interface com.liferay.portal.kernel.util.Http
public String parameterMapToString(Map<String,String[]> parameterMap)
parameterMapToString
in interface com.liferay.portal.kernel.util.Http
public String parameterMapToString(Map<String,String[]> parameterMap, boolean addQuestion)
parameterMapToString
in interface com.liferay.portal.kernel.util.Http
public String protocolize(String url, ActionRequest actionRequest)
protocolize
in interface com.liferay.portal.kernel.util.Http
public String protocolize(String url, boolean secure)
protocolize
in interface com.liferay.portal.kernel.util.Http
public String protocolize(String url, javax.servlet.http.HttpServletRequest httpServletRequest)
protocolize
in interface com.liferay.portal.kernel.util.Http
public String protocolize(String url, int port, boolean secure)
protocolize
in interface com.liferay.portal.kernel.util.Http
public String protocolize(String url, RenderRequest renderRequest)
protocolize
in interface com.liferay.portal.kernel.util.Http
public String removeDomain(String url)
removeDomain
in interface com.liferay.portal.kernel.util.Http
public String removeParameter(String url, String name)
removeParameter
in interface com.liferay.portal.kernel.util.Http
public String removePathParameters(String uri)
removePathParameters
in interface com.liferay.portal.kernel.util.Http
public String removeProtocol(String url)
removeProtocol
in interface com.liferay.portal.kernel.util.Http
public String sanitizeHeader(String header)
sanitizeHeader
in interface com.liferay.portal.kernel.util.Http
public String setParameter(String url, String name, boolean value)
setParameter
in interface com.liferay.portal.kernel.util.Http
public String setParameter(String url, String name, double value)
setParameter
in interface com.liferay.portal.kernel.util.Http
public String setParameter(String url, String name, int value)
setParameter
in interface com.liferay.portal.kernel.util.Http
public String setParameter(String url, String name, long value)
setParameter
in interface com.liferay.portal.kernel.util.Http
public String setParameter(String url, String name, short value)
setParameter
in interface com.liferay.portal.kernel.util.Http
public String setParameter(String url, String name, String value)
setParameter
in interface com.liferay.portal.kernel.util.Http
public String shortenURL(String url)
shortenURL
in interface com.liferay.portal.kernel.util.Http
public byte[] URLtoByteArray(com.liferay.portal.kernel.util.Http.Options options) throws IOException
URLtoByteArray
in interface com.liferay.portal.kernel.util.Http
IOException
public byte[] URLtoByteArray(String location) throws IOException
URLtoByteArray
in interface com.liferay.portal.kernel.util.Http
IOException
public byte[] URLtoByteArray(String location, boolean post) throws IOException
URLtoByteArray
in interface com.liferay.portal.kernel.util.Http
IOException
public InputStream URLtoInputStream(com.liferay.portal.kernel.util.Http.Options options) throws IOException
URLtoInputStream
in interface com.liferay.portal.kernel.util.Http
IOException
public InputStream URLtoInputStream(String location) throws IOException
URLtoInputStream
in interface com.liferay.portal.kernel.util.Http
IOException
public InputStream URLtoInputStream(String location, boolean post) throws IOException
URLtoInputStream
in interface com.liferay.portal.kernel.util.Http
IOException
public String URLtoString(com.liferay.portal.kernel.util.Http.Options options) throws IOException
URLtoString
in interface com.liferay.portal.kernel.util.Http
IOException
public String URLtoString(String location) throws IOException
URLtoString
in interface com.liferay.portal.kernel.util.Http
IOException
public String URLtoString(String location, boolean post) throws IOException
URLtoString
in interface com.liferay.portal.kernel.util.Http
IOException
public String URLtoString(URL url) throws IOException
URLtoString
in interface com.liferay.portal.kernel.util.Http
url
- the URLIOException
- if an IO exception occurredprotected void addProxyCredentials(URI uri, org.apache.http.client.protocol.HttpClientContext httpClientContext)
protected org.apache.http.impl.client.CloseableHttpClient getCloseableHttpClient(org.apache.http.HttpHost proxyHost)
protected org.apache.http.client.config.RequestConfig.Builder getRequestConfigBuilder(URI uri, int timeout)
protected boolean hasRequestHeader(org.apache.http.client.methods.RequestBuilder requestBuilder, String name)
protected void processPostMethod(org.apache.http.client.methods.RequestBuilder requestBuilder, Map<String,String> headers, List<com.liferay.portal.kernel.util.Http.FilePart> fileParts, Map<String,String> parts)
protected org.apache.http.cookie.Cookie toHttpCookie(javax.servlet.http.Cookie cookie)
protected org.apache.http.cookie.Cookie[] toHttpCookies(javax.servlet.http.Cookie[] cookies)
protected javax.servlet.http.Cookie toServletCookie(org.apache.http.cookie.Cookie httpCookie)
protected javax.servlet.http.Cookie[] toServletCookies(List<org.apache.http.cookie.Cookie> httpCookies)
protected byte[] URLtoByteArray(String location, com.liferay.portal.kernel.util.Http.Method method, Map<String,String> headers, javax.servlet.http.Cookie[] cookies, com.liferay.portal.kernel.util.Http.Auth auth, com.liferay.portal.kernel.util.Http.Body body, List<com.liferay.portal.kernel.util.Http.FilePart> fileParts, Map<String,String> parts, com.liferay.portal.kernel.util.Http.Response response, boolean followRedirects) throws IOException
IOException
protected byte[] URLtoByteArray(String location, com.liferay.portal.kernel.util.Http.Method method, Map<String,String> headers, javax.servlet.http.Cookie[] cookies, com.liferay.portal.kernel.util.Http.Auth auth, com.liferay.portal.kernel.util.Http.Body body, List<com.liferay.portal.kernel.util.Http.FilePart> fileParts, Map<String,String> parts, com.liferay.portal.kernel.util.Http.Response response, boolean followRedirects, int timeout) throws IOException
IOException
protected InputStream URLtoInputStream(String location, com.liferay.portal.kernel.util.Http.Method method, Map<String,String> headers, javax.servlet.http.Cookie[] cookies, com.liferay.portal.kernel.util.Http.Auth auth, com.liferay.portal.kernel.util.Http.Body body, List<com.liferay.portal.kernel.util.Http.FilePart> fileParts, Map<String,String> parts, com.liferay.portal.kernel.util.Http.Response response, boolean followRedirects) throws IOException
IOException
protected InputStream URLtoInputStream(String location, com.liferay.portal.kernel.util.Http.Method method, Map<String,String> headers, javax.servlet.http.Cookie[] cookies, com.liferay.portal.kernel.util.Http.Auth auth, com.liferay.portal.kernel.util.Http.Body body, List<com.liferay.portal.kernel.util.Http.FilePart> fileParts, Map<String,String> parts, com.liferay.portal.kernel.util.Http.Response response, boolean followRedirects, int timeout) throws IOException
IOException