org.apache.wink.common.utils
Class ProviderUtils
java.lang.Object
org.apache.wink.common.utils.ProviderUtils
public class ProviderUtils
- extends java.lang.Object
Method Summary |
static void |
copyStream(java.io.InputStream src,
java.io.OutputStream dst)
|
static java.io.Reader |
createReader(java.io.InputStream stream,
javax.ws.rs.core.MediaType mediaType)
|
static java.io.Writer |
createWriter(java.io.OutputStream stream,
javax.ws.rs.core.MediaType mediaType)
|
static java.lang.String |
getCharset(javax.ws.rs.core.MediaType m)
|
static java.lang.String |
getCharset(javax.ws.rs.core.MediaType m,
javax.ws.rs.core.HttpHeaders requestHeaders)
Returns the charset on the chosen media type or, if no charset parameter
exists on the chosen media type, the most acceptable charset based on the
request headers. |
static java.lang.String |
getCharsetOrNull(javax.ws.rs.core.MediaType m)
|
static void |
logUserProviderException(java.lang.RuntimeException e,
java.lang.Object obj,
ProviderUtils.PROVIDER_EXCEPTION_ORIGINATOR originator,
java.lang.Object[] methodParams,
RuntimeContext context)
|
static byte[] |
readFromStreamAsBytes(java.io.InputStream stream)
|
static java.lang.String |
readFromStreamAsString(java.io.InputStream stream,
javax.ws.rs.core.MediaType mt)
|
static
|
readFromString(javax.ws.rs.ext.Providers providers,
java.lang.String input,
java.lang.Class<T> type,
javax.ws.rs.core.MediaType mediaType)
|
static
|
readFromString(javax.ws.rs.ext.Providers providers,
java.lang.String input,
java.lang.Class<T> type,
java.lang.reflect.Type genericType,
javax.ws.rs.core.MediaType mediaType)
|
static
|
readFromString(javax.ws.rs.ext.Providers providers,
java.lang.String input,
java.lang.Class<T> type,
java.lang.reflect.Type genericType,
javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> httpHeaders,
javax.ws.rs.core.MediaType mediaType)
|
static void |
writeToStream(java.lang.String string,
java.io.OutputStream os,
javax.ws.rs.core.MediaType mt)
|
static java.lang.String |
writeToString(javax.ws.rs.ext.Providers providers,
java.lang.Object object,
java.lang.Class<?> type,
javax.ws.rs.core.MediaType mediaType)
|
static java.lang.String |
writeToString(javax.ws.rs.ext.Providers providers,
java.lang.Object object,
java.lang.Class<?> type,
java.lang.reflect.Type genericType,
javax.ws.rs.core.MediaType mediaType)
|
static java.lang.String |
writeToString(javax.ws.rs.ext.Providers providers,
java.lang.Object object,
java.lang.Class<?> type,
java.lang.reflect.Type genericType,
javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.Object> httpHeaders,
javax.ws.rs.core.MediaType mediaType)
|
static java.lang.String |
writeToString(javax.ws.rs.ext.Providers providers,
java.lang.Object object,
javax.ws.rs.core.MediaType mediaType)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ProviderUtils
public ProviderUtils()
getCharsetOrNull
public static java.lang.String getCharsetOrNull(javax.ws.rs.core.MediaType m)
getCharset
public static java.lang.String getCharset(javax.ws.rs.core.MediaType m)
getCharset
public static java.lang.String getCharset(javax.ws.rs.core.MediaType m,
javax.ws.rs.core.HttpHeaders requestHeaders)
- Returns the charset on the chosen media type or, if no charset parameter
exists on the chosen media type, the most acceptable charset based on the
request headers.
- Parameters:
m
- the chosen media typerequestHeaders
- the request headers to inspect
- Returns:
- the charset
createReader
public static java.io.Reader createReader(java.io.InputStream stream,
javax.ws.rs.core.MediaType mediaType)
createWriter
public static java.io.Writer createWriter(java.io.OutputStream stream,
javax.ws.rs.core.MediaType mediaType)
readFromStreamAsBytes
public static byte[] readFromStreamAsBytes(java.io.InputStream stream)
throws java.io.IOException
- Throws:
java.io.IOException
readFromStreamAsString
public static java.lang.String readFromStreamAsString(java.io.InputStream stream,
javax.ws.rs.core.MediaType mt)
throws java.io.IOException
- Throws:
java.io.IOException
writeToStream
public static void writeToStream(java.lang.String string,
java.io.OutputStream os,
javax.ws.rs.core.MediaType mt)
throws java.io.IOException
- Throws:
java.io.IOException
copyStream
public static void copyStream(java.io.InputStream src,
java.io.OutputStream dst)
throws java.io.IOException
- Throws:
java.io.IOException
writeToString
public static java.lang.String writeToString(javax.ws.rs.ext.Providers providers,
java.lang.Object object,
javax.ws.rs.core.MediaType mediaType)
throws java.io.IOException
- Throws:
java.io.IOException
writeToString
public static java.lang.String writeToString(javax.ws.rs.ext.Providers providers,
java.lang.Object object,
java.lang.Class<?> type,
javax.ws.rs.core.MediaType mediaType)
throws java.io.IOException
- Throws:
java.io.IOException
writeToString
public static java.lang.String writeToString(javax.ws.rs.ext.Providers providers,
java.lang.Object object,
java.lang.Class<?> type,
java.lang.reflect.Type genericType,
javax.ws.rs.core.MediaType mediaType)
throws java.io.IOException
- Throws:
java.io.IOException
writeToString
public static java.lang.String writeToString(javax.ws.rs.ext.Providers providers,
java.lang.Object object,
java.lang.Class<?> type,
java.lang.reflect.Type genericType,
javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.Object> httpHeaders,
javax.ws.rs.core.MediaType mediaType)
throws java.io.IOException
- Throws:
java.io.IOException
readFromString
public static <T> T readFromString(javax.ws.rs.ext.Providers providers,
java.lang.String input,
java.lang.Class<T> type,
javax.ws.rs.core.MediaType mediaType)
throws java.io.IOException
- Throws:
java.io.IOException
readFromString
public static <T> T readFromString(javax.ws.rs.ext.Providers providers,
java.lang.String input,
java.lang.Class<T> type,
java.lang.reflect.Type genericType,
javax.ws.rs.core.MediaType mediaType)
throws java.io.IOException
- Throws:
java.io.IOException
readFromString
public static <T> T readFromString(javax.ws.rs.ext.Providers providers,
java.lang.String input,
java.lang.Class<T> type,
java.lang.reflect.Type genericType,
javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> httpHeaders,
javax.ws.rs.core.MediaType mediaType)
throws java.io.IOException
- Throws:
java.io.IOException
logUserProviderException
public static void logUserProviderException(java.lang.RuntimeException e,
java.lang.Object obj,
ProviderUtils.PROVIDER_EXCEPTION_ORIGINATOR originator,
java.lang.Object[] methodParams,
RuntimeContext context)
Copyright © 2009-2013 The Apache Software Foundation. All Rights Reserved.