|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.stanbol.entityhub.jersey.utils.JerseyUtils
public final class JerseyUtils
Utility methods used by several of the RESTful service endpoints of the Entityhub.
| Field Summary | |
|---|---|
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 |
| Method Summary | |
|---|---|
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 <?>, <? extends {required}> or <? super {required}>) is compatible with the required one. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Set<String> REPRESENTATION_SUPPORTED_MEDIA_TYPES
Representation
public static final Set<String> ENTITY_SUPPORTED_MEDIA_TYPES
Entity
public static final Set<String> QUERY_RESULT_SUPPORTED_MEDIA_TYPES
QueryResultList
| Method Detail |
|---|
public 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 parameter
javax.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 class
public 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 test
public 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 stream
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||