TypeHandlerSpace provides a JAX-RS Root Resource Class that delegates requests in its URI space (i.e. URIs starting with the prefix the bundle is installed with) to a TypeHandler for the RDF-Type(s) of the resource named by the requested URI. TypeHandlerSpace works on the clerezza.org platform it interacts with Triaxrs and with SCB and expects content and system graph to be located as per the platform conventions.
While JAX-RS allows to bind Root Resources Classes to a specific
URI-Path TypeHandlerSpace allows to bind such resources to an rdf:type
.
Root Resources are POJO providing methods handling different types of
requests, with TypeHandlerSpace such POJOs can be bound to an RDF type
in this function the class is called TypeHandler
. When a
request is processed by TypeHandlerSpace the rdf:type
s of
the requested resource are determined from the content graph.
TypeHandlerSpace provides a root resource org.apache.clerezza.platform.typehandlerspace.TypeHandlerSpace
which determines the type(s) of requested resource and calls a service
of org.apache.clerezza.platform.typehandlerspace.TypeHandlerDiscovery
to get a Typehandler
, the request is the forwarded to this
TypeHandler
The provided implementation of TypeHandlerDiscovery
returns the available TypeHandler
for the rdf:type
with the highest priority. The Priority of rdf:type
s is
determined by an rdf:List
named
<urn:x-localinstance:/typePriorityList> in the system graph. The
actual TypeHandler
s are OSGi services exposing java.lang.Object
as service interface and with the property org.apache.clerezza.platform.typehandler=true
.
TypeHandler
s are annotated with the org.apache.clerezza.platform.typehandlerspace.SupportedTypes
annotation defining the rdf:type
s supported by the class.
The following defines a class that is both a regular JAX-RS Root
Resource Class as well as a TypeHandler
for
<http://example.org/ontology#MyType>.
Sub-resource methods in TypeHandler
s are never invoked by TypeHandlerSpace, so they are only
useful if a typeHandler is also used as regular JAX-RS Root Resource.