org.apache.cxf.jaxrs.utils
Class HttpUtils
java.lang.Object
org.apache.cxf.jaxrs.utils.HttpUtils
public final class HttpUtils
- extends Object
Method Summary |
static void |
convertHeaderValuesToString(Map<String,List<Object>> headers,
boolean delegateOnly)
|
static String |
encodePartiallyEncoded(String encoded,
boolean query)
Encodes partially encoded string. |
static String |
fromPathSegment(javax.ws.rs.core.PathSegment ps)
|
static String |
getBaseAddress(Message m)
|
static int |
getContentLength(String value)
|
static String |
getEncoding(javax.ws.rs.core.MediaType mt,
String defaultEncoding)
|
static String |
getEndpointAddress(Message m)
|
static javax.ws.rs.ext.RuntimeDelegate.HeaderDelegate<Object> |
getHeaderDelegate(Object o)
|
static javax.ws.rs.ext.RuntimeDelegate.HeaderDelegate<Object> |
getHeaderDelegate(javax.ws.rs.ext.RuntimeDelegate rd,
Object o)
|
static String |
getHeaderString(List<String> values)
|
static Date |
getHttpDate(String value)
|
static SimpleDateFormat |
getHttpDateFormat()
|
static Locale |
getLocale(String value)
|
static javax.ws.rs.core.MultivaluedMap<String,Object> |
getModifiableHeaders(Message m)
|
static
<T> javax.ws.rs.core.MultivaluedMap<String,T> |
|
getModifiableStringHeaders(Message m)
|
static String |
getOriginalAddress(Message m)
|
static javax.ws.rs.ext.RuntimeDelegate |
getOtherRuntimeDelegate()
|
static javax.ws.rs.core.Response.Status |
getParameterFailureStatus(ParameterType pType)
|
static String |
getPathToMatch(Message m,
boolean addSlash)
|
static String |
getPathToMatch(String path,
String address,
boolean addSlash)
|
static String |
getProtocolHeader(Message m,
String name,
String defaultValue)
|
static String |
getProtocolHeader(Message m,
String name,
String defaultValue,
boolean setOnMessage)
|
static String |
getSetEncoding(javax.ws.rs.core.MediaType mt,
javax.ws.rs.core.MultivaluedMap<String,Object> headers,
String defaultEncoding)
|
static boolean |
isDateRelatedHeader(String headerName)
|
static boolean |
isHttpRequest(Message message)
|
static boolean |
isPartiallyEncoded(String value)
|
static String |
pathDecode(String value)
|
static String |
pathEncode(String value)
|
static String |
queryEncode(String value)
|
static URI |
relativize(URI base,
URI uri)
|
static void |
resetRequestURI(Message m,
String requestURI)
|
static URI |
resolve(javax.ws.rs.core.UriBuilder baseBuilder,
URI uri)
|
static URI |
toAbsoluteUri(String relativePath,
Message message)
|
static URI |
toAbsoluteUri(URI u,
Message message)
|
static String |
toHttpDate(Date date)
|
static String |
toHttpLanguage(Locale locale)
|
static void |
updatePath(Message m,
String path)
|
static String |
urlDecode(String value)
|
static String |
urlDecode(String value,
String enc)
|
static String |
urlEncode(String value)
|
static String |
urlEncode(String value,
String enc)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
urlDecode
public static String urlDecode(String value,
String enc)
urlDecode
public static String urlDecode(String value)
pathDecode
public static String pathDecode(String value)
queryEncode
public static String queryEncode(String value)
urlEncode
public static String urlEncode(String value)
urlEncode
public static String urlEncode(String value,
String enc)
pathEncode
public static String pathEncode(String value)
isPartiallyEncoded
public static boolean isPartiallyEncoded(String value)
encodePartiallyEncoded
public static String encodePartiallyEncoded(String encoded,
boolean query)
- Encodes partially encoded string. Encode all values but those matching pattern
"percent char followed by two hexadecimal digits".
- Parameters:
encoded
- fully or partially encoded string.
- Returns:
- fully encoded string
getHttpDateFormat
public static SimpleDateFormat getHttpDateFormat()
toHttpDate
public static String toHttpDate(Date date)
getOtherRuntimeDelegate
public static javax.ws.rs.ext.RuntimeDelegate getOtherRuntimeDelegate()
getHeaderDelegate
public static javax.ws.rs.ext.RuntimeDelegate.HeaderDelegate<Object> getHeaderDelegate(Object o)
getHeaderDelegate
public static javax.ws.rs.ext.RuntimeDelegate.HeaderDelegate<Object> getHeaderDelegate(javax.ws.rs.ext.RuntimeDelegate rd,
Object o)
getModifiableStringHeaders
public static <T> javax.ws.rs.core.MultivaluedMap<String,T> getModifiableStringHeaders(Message m)
getModifiableHeaders
public static javax.ws.rs.core.MultivaluedMap<String,Object> getModifiableHeaders(Message m)
convertHeaderValuesToString
public static void convertHeaderValuesToString(Map<String,List<Object>> headers,
boolean delegateOnly)
getHttpDate
public static Date getHttpDate(String value)
getLocale
public static Locale getLocale(String value)
getContentLength
public static int getContentLength(String value)
getHeaderString
public static String getHeaderString(List<String> values)
isDateRelatedHeader
public static boolean isDateRelatedHeader(String headerName)
isHttpRequest
public static boolean isHttpRequest(Message message)
toAbsoluteUri
public static URI toAbsoluteUri(String relativePath,
Message message)
toAbsoluteUri
public static URI toAbsoluteUri(URI u,
Message message)
resetRequestURI
public static void resetRequestURI(Message m,
String requestURI)
getPathToMatch
public static String getPathToMatch(Message m,
boolean addSlash)
getProtocolHeader
public static String getProtocolHeader(Message m,
String name,
String defaultValue)
getProtocolHeader
public static String getProtocolHeader(Message m,
String name,
String defaultValue,
boolean setOnMessage)
getBaseAddress
public static String getBaseAddress(Message m)
getEndpointAddress
public static String getEndpointAddress(Message m)
updatePath
public static void updatePath(Message m,
String path)
getPathToMatch
public static String getPathToMatch(String path,
String address,
boolean addSlash)
getOriginalAddress
public static String getOriginalAddress(Message m)
fromPathSegment
public static String fromPathSegment(javax.ws.rs.core.PathSegment ps)
getParameterFailureStatus
public static javax.ws.rs.core.Response.Status getParameterFailureStatus(ParameterType pType)
getSetEncoding
public static String getSetEncoding(javax.ws.rs.core.MediaType mt,
javax.ws.rs.core.MultivaluedMap<String,Object> headers,
String defaultEncoding)
getEncoding
public static String getEncoding(javax.ws.rs.core.MediaType mt,
String defaultEncoding)
resolve
public static URI resolve(javax.ws.rs.core.UriBuilder baseBuilder,
URI uri)
relativize
public static URI relativize(URI base,
URI uri)
toHttpLanguage
public static String toHttpLanguage(Locale locale)
Apache CXF