public final class OAuthUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
AUTH_SCHEME |
static String |
MULTIPART |
Constructor and Description |
---|
OAuthUtils() |
Modifier and Type | Method and Description |
---|---|
static Map<String,Object> |
decodeForm(String form)
Parse a form-urlencoded document.
|
static Map<String,String> |
decodeOAuthHeader(String header) |
static String |
decodePercent(String s) |
static Set<String> |
decodeScopes(String s) |
static String |
encodeOAuthHeader(Map<String,Object> entries)
Construct a WWW-Authenticate or Authorization header with the OAuth challenge/credentials
|
static String |
encodeScopes(Set<String> s) |
static String |
format(Collection<? extends Map.Entry<String,Object>> parameters,
String encoding)
Translates parameters into
application/x-www-form-urlencoded String |
static String |
getAuthHeaderField(String authHeader) |
static String |
getAuthzMethod(String header) |
static boolean |
hasContentType(String requestContentType,
String requiredContentType) |
static boolean |
hasEmptyValues(String[] array) |
static boolean |
isEmpty(String value) |
static boolean |
isFormEncoded(String contentType)
Return true if the given Content-Type header means FORM_ENCODED.
|
static boolean |
isMultipart(HttpServletRequest request) |
static String |
percentEncode(Iterable values)
Construct a &-separated list of the given values, percentEncoded.
|
static String |
percentEncode(String s) |
static String |
saveStreamAsString(InputStream is)
Read data from Input Stream and save it as a String.
|
static String |
toString(InputStream is,
String defaultCharset)
Get the entity content as a String, using the provided default character set if none is found in the entity.
|
public static final String AUTH_SCHEME
public static final String MULTIPART
public static String format(Collection<? extends Map.Entry<String,Object>> parameters, String encoding)
application/x-www-form-urlencoded
Stringparameters
- parameters to signencoding
- The name of a supported character encoding.public static String saveStreamAsString(InputStream is) throws IOException
is
- InputStream to be readIOException
public static String toString(InputStream is, String defaultCharset) throws IOException
is
- input stream to be saved as stringdefaultCharset
- character set to be applied if none found in the entityIllegalArgumentException
- if entity is null or if content length > Integer.MAX_VALUEIOException
- if an error occurs reading the input streampublic static Map<String,Object> decodeForm(String form)
public static boolean isFormEncoded(String contentType)
public static String percentEncode(Iterable values)
public static String encodeOAuthHeader(Map<String,Object> entries)
public static boolean isEmpty(String value)
public static boolean hasEmptyValues(String[] array)
public static boolean isMultipart(HttpServletRequest request)
Copyright © 2015. All rights reserved.