Package org.aktin.broker.util
Class RequestTypeManager
java.lang.Object
org.aktin.broker.util.RequestTypeManager
public class RequestTypeManager extends Object
A request type manager allows verification of request
resources against a specified media type as well as
conversion to other types.
The type conversion is done on demand per request. The result is transferred to the client and not stored in the database.
- Author:
- R.W.Majeed
-
Constructor Summary
Constructors Constructor Description RequestTypeManager() -
Method Summary
Modifier and Type Method Description RequestConverterbuildConverterChain(List<javax.ws.rs.core.MediaType> accept, List<javax.ws.rs.core.MediaType> resources)Build a converter chain which produces an acceptable (in order of preference) request and consumes one of the available resource types.RequestConverterconverterForType(String out, String in)If a GET request with a specified Accept media type can not be satisfied from the database, a converter is searched (which is expected to produce that type).javax.ws.rs.core.MediaType[]createMediaTypes(List<String> types)
-
Constructor Details
-
RequestTypeManager
public RequestTypeManager()
-
-
Method Details
-
converterForType
If a GET request with a specified Accept media type can not be satisfied from the database, a converter is searched (which is expected to produce that type).If a converter is available for the specified media type, the converter's input type is retrieved and checked that the input type can be satisfied from the database or if additional converters need to be chained.
- Parameters:
out- produced typein- consumed type- Returns:
- converter converting between the given types, or
nullif not found.
-
buildConverterChain
public RequestConverter buildConverterChain(List<javax.ws.rs.core.MediaType> accept, List<javax.ws.rs.core.MediaType> resources)Build a converter chain which produces an acceptable (in order of preference) request and consumes one of the available resource types.The returned RequestConverter may be a virtual converter which invokes multiple chained converters to produce the desired result. The chained converter path may be cached to speed up successive requests.
- Parameters:
accept- list of accepted typesresources- list of available resource types- Returns:
- converter or
nullif not possible.
-
createMediaTypes
-