public final class JerseyUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static Set<String> |
ENTITY_SUPPORTED_MEDIA_TYPES
Unmodifiable Set with the Media Types supported for
Entity |
static Set<String> |
QUERY_RESULT_SUPPORTED_MEDIA_TYPES
Unmodifiable Set with the Media Types supported for
QueryResultList |
static Set<String> |
REPRESENTATION_SUPPORTED_MEDIA_TYPES
Unmodifiable Set with the Media Types supported for
Representation |
| Modifier and Type | Method and Description |
|---|---|
static org.apache.stanbol.entityhub.servicesapi.query.FieldQuery |
createFieldQueryForFindRequest(String name,
String field,
String language,
Integer limit,
Integer offset,
String ldpath)
Creates an
FieldQuery for parameters parsed by the /find requests
supported by the /symbol, /sites and {siteId} RESTful endpoints. |
static Map<String,String> |
parseForm(InputStream entityStream,
String charset)
This Method is intended to parse form data from
MediaType.APPLICATION_FORM_URLENCODED requests. |
static boolean |
testParameterizedType(Class<?> rawType,
Class<?>[] parameterTypes,
Type type)
Tests the parsed type against the raw type and parsed Type parameters.
|
static boolean |
testType(Class<?> required,
Type type)
Tests if a generic type (may be <?
|
public static final Set<String> REPRESENTATION_SUPPORTED_MEDIA_TYPES
Representationpublic static final Set<String> ENTITY_SUPPORTED_MEDIA_TYPES
Entitypublic static org.apache.stanbol.entityhub.servicesapi.query.FieldQuery createFieldQueryForFindRequest(String name, String field, String language, Integer limit, Integer offset, String ldpath) throws javax.ws.rs.WebApplicationException, IllegalArgumentException
FieldQuery for parameters parsed by the /find requests
supported by the /symbol, /sites and {siteId} RESTful endpoints.
TODO: This has to be refactored to use "EntityQuery" as soon as Multiple
query types are implemented for the Entityhub.name - the name pattern to search entities for (required)field - the field used to search for entities (required)language - the language of the parsed name pattern (optional)limit - the maximum number of result (optional)offset - the offset of the first result (optional)FieldQuery representing the parsed parameterjavax.ws.rs.WebApplicationException - in case the parsed name pattern is invalid.
The validation of this required parameter provided by the Request is done
by this method.IllegalArgumentException - in case the parsed field is invalid. Callers
of this method need to ensure that this parameter is set to an valid value.public static boolean testType(Class<?> required, Type type)
required - the required class the generic type MUST BE compatible withgenericType - the required classpublic static boolean testParameterizedType(Class<?> rawType, Class<?>[] parameterTypes, Type type)
Map<String,Number> but
also works with classes that extend generic types such as
Dummy extends HashMap<String,String>.rawType - the raw type to test againstparameterTypes - the types of the parameterstype - the type to testpublic static Map<String,String> parseForm(InputStream entityStream, String charset) throws IOException
MediaType.APPLICATION_FORM_URLENCODED requests. This functionality
us usually needed when writing a MessageBodyReader to get the
data from the "InputStream entityStream" parameter of the
MessageBodyReader.readFrom(Class, Type, java.lang.annotation.Annotation[], MediaType, javax.ws.rs.core.MultivaluedMap, InputStream)
method.entityStream - the stream with the form datacharset - The charset used for the request (if null or
empty UTF-8 is used as default.IOException - on any exception while reading the data form the streamCopyright © 2010-2014 The Apache Software Foundation. All Rights Reserved.