Liferay 7.0-ce-b7 portal-impl

com.liferay.portal.util
Class HttpImpl

java.lang.Object
  extended by com.liferay.portal.util.HttpImpl
All Implemented Interfaces:
com.liferay.portal.kernel.util.Http

public class HttpImpl
extends Object
implements com.liferay.portal.kernel.util.Http


Nested Class Summary
 
Nested classes/interfaces inherited from interface 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
 
Field Summary
 
Fields inherited from interface com.liferay.portal.kernel.util.Http
HTTP, HTTP_PORT, HTTP_WITH_SLASH, HTTPS, HTTPS_PORT, HTTPS_WITH_SLASH, PROTOCOL_DELIMITER, URL_MAXIMUM_LENGTH
 
Constructor Summary
HttpImpl()
           
 
Method Summary
 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)
           
 String decodePath(String path)
           
 String decodeURL(String url)
           
 String decodeURL(String url, boolean unescapeSpaces)
          Deprecated. As of 7.0.0, replaced by decodeURL(String)
 void destroy()
           
 String encodeParameters(String url)
           
 String encodePath(String path)
           
 String encodeURL(String url)
           
 String encodeURL(String url, boolean escapeSpaces)
           
 String fixPath(String path)
           
 String fixPath(String path, boolean leading, boolean trailing)
           
 org.apache.commons.httpclient.HttpClient getClient(org.apache.commons.httpclient.HostConfiguration hostConfiguration)
           
 String getCompleteURL(javax.servlet.http.HttpServletRequest request)
           
 javax.servlet.http.Cookie[] getCookies()
           
 String getDomain(String url)
           
 org.apache.commons.httpclient.HostConfiguration getHostConfig(String location)
          Deprecated. As of 6.1.0, replaced by getHostConfiguration(String)
 org.apache.commons.httpclient.HostConfiguration getHostConfiguration(String location)
           
 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 request)
           
 String getProtocol(RenderRequest renderRequest)
           
 String getProtocol(String url)
           
 String getQueryString(String url)
           
 String getRequestURL(javax.servlet.http.HttpServletRequest request)
           
 boolean hasDomain(String url)
           
 boolean hasProtocol(String url)
           
 boolean hasProxyConfig()
           
protected  boolean hasRequestHeader(org.apache.commons.httpclient.HttpMethod httpMethod, 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.commons.httpclient.methods.PostMethod postMethod, 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 request)
           
 String protocolize(String url, int port, boolean secure)
           
 String protocolize(String url, RenderRequest renderRequest)
           
 void proxifyState(org.apache.commons.httpclient.HttpState httpState, org.apache.commons.httpclient.HostConfiguration hostConfiguration)
           
 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, int count)
           
protected  org.apache.commons.httpclient.Cookie toCommonsCookie(javax.servlet.http.Cookie cookie)
           
protected  org.apache.commons.httpclient.Cookie[] toCommonsCookies(javax.servlet.http.Cookie[] cookies)
           
protected  org.apache.commons.httpclient.methods.multipart.FilePart toCommonsFilePart(com.liferay.portal.kernel.util.Http.FilePart filePart)
           
protected  javax.servlet.http.Cookie toServletCookie(org.apache.commons.httpclient.Cookie commonsCookie)
           
protected  javax.servlet.http.Cookie[] toServletCookies(org.apache.commons.httpclient.Cookie[] commonsCookies)
           
 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)
           
 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)
           
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpImpl

public HttpImpl()
Method Detail

addParameter

public String addParameter(String url,
                           String name,
                           boolean value)
Specified by:
addParameter in interface com.liferay.portal.kernel.util.Http

addParameter

public String addParameter(String url,
                           String name,
                           double value)
Specified by:
addParameter in interface com.liferay.portal.kernel.util.Http

addParameter

public String addParameter(String url,
                           String name,
                           int value)
Specified by:
addParameter in interface com.liferay.portal.kernel.util.Http

addParameter

public String addParameter(String url,
                           String name,
                           long value)
Specified by:
addParameter in interface com.liferay.portal.kernel.util.Http

addParameter

public String addParameter(String url,
                           String name,
                           short value)
Specified by:
addParameter in interface com.liferay.portal.kernel.util.Http

addParameter

public String addParameter(String url,
                           String name,
                           String value)
Specified by:
addParameter in interface com.liferay.portal.kernel.util.Http

decodePath

public String decodePath(String path)
Specified by:
decodePath in interface com.liferay.portal.kernel.util.Http

decodeURL

public String decodeURL(String url)
Specified by:
decodeURL in interface com.liferay.portal.kernel.util.Http

decodeURL

@Deprecated
public String decodeURL(String url,
                                   boolean unescapeSpaces)
Deprecated. As of 7.0.0, replaced by decodeURL(String)

Specified by:
decodeURL in interface com.liferay.portal.kernel.util.Http

destroy

public void destroy()

encodeParameters

public String encodeParameters(String url)
Specified by:
encodeParameters in interface com.liferay.portal.kernel.util.Http

encodePath

public String encodePath(String path)
Specified by:
encodePath in interface com.liferay.portal.kernel.util.Http

encodeURL

public String encodeURL(String url)
Specified by:
encodeURL in interface com.liferay.portal.kernel.util.Http

encodeURL

public String encodeURL(String url,
                        boolean escapeSpaces)
Specified by:
encodeURL in interface com.liferay.portal.kernel.util.Http

fixPath

public String fixPath(String path)
Specified by:
fixPath in interface com.liferay.portal.kernel.util.Http

fixPath

public String fixPath(String path,
                      boolean leading,
                      boolean trailing)
Specified by:
fixPath in interface com.liferay.portal.kernel.util.Http

getClient

public org.apache.commons.httpclient.HttpClient getClient(org.apache.commons.httpclient.HostConfiguration hostConfiguration)

getCompleteURL

public String getCompleteURL(javax.servlet.http.HttpServletRequest request)
Specified by:
getCompleteURL in interface com.liferay.portal.kernel.util.Http

getCookies

public javax.servlet.http.Cookie[] getCookies()
Specified by:
getCookies in interface com.liferay.portal.kernel.util.Http

getDomain

public String getDomain(String url)
Specified by:
getDomain in interface com.liferay.portal.kernel.util.Http

getHostConfig

@Deprecated
public org.apache.commons.httpclient.HostConfiguration getHostConfig(String location)
                                                              throws IOException
Deprecated. As of 6.1.0, replaced by getHostConfiguration(String)

Throws:
IOException

getHostConfiguration

public org.apache.commons.httpclient.HostConfiguration getHostConfiguration(String location)
                                                                     throws IOException
Throws:
IOException

getIpAddress

public String getIpAddress(String url)
Specified by:
getIpAddress in interface com.liferay.portal.kernel.util.Http

getParameter

public String getParameter(String url,
                           String name)
Specified by:
getParameter in interface com.liferay.portal.kernel.util.Http

getParameter

public String getParameter(String url,
                           String name,
                           boolean escaped)
Specified by:
getParameter in interface com.liferay.portal.kernel.util.Http

getParameterMap

public Map<String,String[]> getParameterMap(String queryString)
Specified by:
getParameterMap in interface com.liferay.portal.kernel.util.Http

getPath

public String getPath(String url)
Specified by:
getPath in interface com.liferay.portal.kernel.util.Http

getProtocol

public String getProtocol(ActionRequest actionRequest)
Specified by:
getProtocol in interface com.liferay.portal.kernel.util.Http

getProtocol

public String getProtocol(boolean secure)
Specified by:
getProtocol in interface com.liferay.portal.kernel.util.Http

getProtocol

public String getProtocol(javax.servlet.http.HttpServletRequest request)
Specified by:
getProtocol in interface com.liferay.portal.kernel.util.Http

getProtocol

public String getProtocol(RenderRequest renderRequest)
Specified by:
getProtocol in interface com.liferay.portal.kernel.util.Http

getProtocol

public String getProtocol(String url)
Specified by:
getProtocol in interface com.liferay.portal.kernel.util.Http

getQueryString

public String getQueryString(String url)
Specified by:
getQueryString in interface com.liferay.portal.kernel.util.Http

getRequestURL

public String getRequestURL(javax.servlet.http.HttpServletRequest request)
Specified by:
getRequestURL in interface com.liferay.portal.kernel.util.Http

hasDomain

public boolean hasDomain(String url)
Specified by:
hasDomain in interface com.liferay.portal.kernel.util.Http

hasProtocol

public boolean hasProtocol(String url)
Specified by:
hasProtocol in interface com.liferay.portal.kernel.util.Http

hasProxyConfig

public boolean hasProxyConfig()
Specified by:
hasProxyConfig in interface com.liferay.portal.kernel.util.Http

isNonProxyHost

public boolean isNonProxyHost(String host)
Specified by:
isNonProxyHost in interface com.liferay.portal.kernel.util.Http

isProxyHost

public boolean isProxyHost(String host)
Specified by:
isProxyHost in interface com.liferay.portal.kernel.util.Http

isSecure

public boolean isSecure(String url)
Specified by:
isSecure in interface com.liferay.portal.kernel.util.Http

normalizePath

public String normalizePath(String uri)
Specified by:
normalizePath in interface com.liferay.portal.kernel.util.Http

parameterMapFromString

public Map<String,String[]> parameterMapFromString(String queryString)
Specified by:
parameterMapFromString in interface com.liferay.portal.kernel.util.Http

parameterMapToString

public String parameterMapToString(Map<String,String[]> parameterMap)
Specified by:
parameterMapToString in interface com.liferay.portal.kernel.util.Http

parameterMapToString

public String parameterMapToString(Map<String,String[]> parameterMap,
                                   boolean addQuestion)
Specified by:
parameterMapToString in interface com.liferay.portal.kernel.util.Http

protocolize

public String protocolize(String url,
                          ActionRequest actionRequest)
Specified by:
protocolize in interface com.liferay.portal.kernel.util.Http

protocolize

public String protocolize(String url,
                          boolean secure)
Specified by:
protocolize in interface com.liferay.portal.kernel.util.Http

protocolize

public String protocolize(String url,
                          javax.servlet.http.HttpServletRequest request)
Specified by:
protocolize in interface com.liferay.portal.kernel.util.Http

protocolize

public String protocolize(String url,
                          int port,
                          boolean secure)
Specified by:
protocolize in interface com.liferay.portal.kernel.util.Http

protocolize

public String protocolize(String url,
                          RenderRequest renderRequest)
Specified by:
protocolize in interface com.liferay.portal.kernel.util.Http

proxifyState

public void proxifyState(org.apache.commons.httpclient.HttpState httpState,
                         org.apache.commons.httpclient.HostConfiguration hostConfiguration)

removeDomain

public String removeDomain(String url)
Specified by:
removeDomain in interface com.liferay.portal.kernel.util.Http

removeParameter

public String removeParameter(String url,
                              String name)
Specified by:
removeParameter in interface com.liferay.portal.kernel.util.Http

removePathParameters

public String removePathParameters(String uri)
Specified by:
removePathParameters in interface com.liferay.portal.kernel.util.Http

removeProtocol

public String removeProtocol(String url)
Specified by:
removeProtocol in interface com.liferay.portal.kernel.util.Http

sanitizeHeader

public String sanitizeHeader(String header)
Specified by:
sanitizeHeader in interface com.liferay.portal.kernel.util.Http

setParameter

public String setParameter(String url,
                           String name,
                           boolean value)
Specified by:
setParameter in interface com.liferay.portal.kernel.util.Http

setParameter

public String setParameter(String url,
                           String name,
                           double value)
Specified by:
setParameter in interface com.liferay.portal.kernel.util.Http

setParameter

public String setParameter(String url,
                           String name,
                           int value)
Specified by:
setParameter in interface com.liferay.portal.kernel.util.Http

setParameter

public String setParameter(String url,
                           String name,
                           long value)
Specified by:
setParameter in interface com.liferay.portal.kernel.util.Http

setParameter

public String setParameter(String url,
                           String name,
                           short value)
Specified by:
setParameter in interface com.liferay.portal.kernel.util.Http

setParameter

public String setParameter(String url,
                           String name,
                           String value)
Specified by:
setParameter in interface com.liferay.portal.kernel.util.Http

shortenURL

public String shortenURL(String url,
                         int count)
Specified by:
shortenURL in interface com.liferay.portal.kernel.util.Http

URLtoByteArray

public byte[] URLtoByteArray(com.liferay.portal.kernel.util.Http.Options options)
                      throws IOException
Specified by:
URLtoByteArray in interface com.liferay.portal.kernel.util.Http
Throws:
IOException

URLtoByteArray

public byte[] URLtoByteArray(String location)
                      throws IOException
Specified by:
URLtoByteArray in interface com.liferay.portal.kernel.util.Http
Throws:
IOException

URLtoByteArray

public byte[] URLtoByteArray(String location,
                             boolean post)
                      throws IOException
Specified by:
URLtoByteArray in interface com.liferay.portal.kernel.util.Http
Throws:
IOException

URLtoInputStream

public InputStream URLtoInputStream(com.liferay.portal.kernel.util.Http.Options options)
                             throws IOException
Specified by:
URLtoInputStream in interface com.liferay.portal.kernel.util.Http
Throws:
IOException

URLtoInputStream

public InputStream URLtoInputStream(String location)
                             throws IOException
Specified by:
URLtoInputStream in interface com.liferay.portal.kernel.util.Http
Throws:
IOException

URLtoInputStream

public InputStream URLtoInputStream(String location,
                                    boolean post)
                             throws IOException
Specified by:
URLtoInputStream in interface com.liferay.portal.kernel.util.Http
Throws:
IOException

URLtoString

public String URLtoString(com.liferay.portal.kernel.util.Http.Options options)
                   throws IOException
Specified by:
URLtoString in interface com.liferay.portal.kernel.util.Http
Throws:
IOException

URLtoString

public String URLtoString(String location)
                   throws IOException
Specified by:
URLtoString in interface com.liferay.portal.kernel.util.Http
Throws:
IOException

URLtoString

public String URLtoString(String location,
                          boolean post)
                   throws IOException
Specified by:
URLtoString in interface com.liferay.portal.kernel.util.Http
Throws:
IOException

URLtoString

public String URLtoString(URL url)
                   throws IOException
This method only uses the default Commons HttpClient implementation when the URL object represents a HTTP resource. The URL object could also represent a file or some JNDI resource. In that case, the default Java implementation is used.

Specified by:
URLtoString in interface com.liferay.portal.kernel.util.Http
Parameters:
url - the URL
Returns:
A string representation of the resource referenced by the URL object
Throws:
IOException - if an IO exception occurred

hasRequestHeader

protected boolean hasRequestHeader(org.apache.commons.httpclient.HttpMethod httpMethod,
                                   String name)

processPostMethod

protected void processPostMethod(org.apache.commons.httpclient.methods.PostMethod postMethod,
                                 List<com.liferay.portal.kernel.util.Http.FilePart> fileParts,
                                 Map<String,String> parts)

toCommonsCookie

protected org.apache.commons.httpclient.Cookie toCommonsCookie(javax.servlet.http.Cookie cookie)

toCommonsCookies

protected org.apache.commons.httpclient.Cookie[] toCommonsCookies(javax.servlet.http.Cookie[] cookies)

toCommonsFilePart

protected org.apache.commons.httpclient.methods.multipart.FilePart toCommonsFilePart(com.liferay.portal.kernel.util.Http.FilePart filePart)

toServletCookie

protected javax.servlet.http.Cookie toServletCookie(org.apache.commons.httpclient.Cookie commonsCookie)

toServletCookies

protected javax.servlet.http.Cookie[] toServletCookies(org.apache.commons.httpclient.Cookie[] commonsCookies)

URLtoByteArray

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
Throws:
IOException

URLtoInputStream

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
Throws:
IOException

Liferay 7.0-ce-b7 portal-impl