|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.restlet.Uniform
org.restlet.Restlet
org.restlet.Application
org.restlet.ext.jaxrs.JaxRsApplication
public class JaxRsApplication
This is the main class to be used for the instantiation of a JAX-RS runtime environment.
To set up a JAX-RS runtime environment you should instantiate a
JaxRsApplication(Context)
.
Application
(s) by calling add(Application)
.Guard
and perhaps an
RoleChecker
, see setGuard(Guard)
or
setAuthentication(Guard, RoleChecker)
.Component
.
Concurrency note: instances of this class or its subclasses can be invoked by
several threads at the same time and therefore must be thread-safe. You
should be especially careful when storing state in member variables.
Constructor Summary | |
---|---|
JaxRsApplication()
Creates an new JaxRsApplication. |
|
JaxRsApplication(Context context)
Creates an new JaxRsApplication, without any access control. |
Method Summary | |
---|---|
boolean |
add(javax.ws.rs.core.Application appConfig)
Attaches a JAX-RS Application to this JaxRsApplication.The providers are available for all root resource classes provided to this JaxRsApplication. |
boolean |
add(javax.ws.rs.core.Application appConfig,
boolean clearMetadataIfFirst)
Attaches a JAX-RS Application to this Application.The providers are available for all root resource classes provided to this JaxRsApplication. |
Restlet |
createRoot()
|
Guard |
getGuard()
Returns the Guard |
ObjectFactory |
getObjectFactory()
Returns the ObjectFactory for root resource class and provider instantiation, if given. |
RoleChecker |
getRoleChecker()
Returns the current RoleChecker |
java.util.Collection<java.lang.Class<?>> |
getRootResources()
Returns an unmodifiable set with the attached root resource classes. |
java.util.Collection<java.lang.String> |
getRootUris()
Returns an unmodifiable set of supported URIs (relative to this Application). |
void |
setAuthentication(Guard guard,
RoleChecker roleChecker)
Sets the objects to check the authentication. |
void |
setContext(Context context)
|
void |
setGuard(Guard guard)
Sets the Guard to use. |
void |
setObjectFactory(ObjectFactory objectFactory)
Sets the ObjectFactory for root resource class and provider instantiation. |
void |
setRoleChecker(RoleChecker roleChecker)
Sets the RoleChecker to use.If you give an RoleChecker, you should also give a Guard. |
Methods inherited from class org.restlet.Application |
---|
getAuthor, getConnectorService, getConverterService, getCurrent, getDecoderService, getDescription, getMetadataService, getName, getOwner, getRangeService, getRoot, getStatusService, getTaskService, getTunnelService, handle, setAuthor, setConnectorService, setConverterService, setCurrent, setDecoderService, setDescription, setMetadataService, setName, setOwner, setRangeService, setRoot, setStatusService, setTaskService, setTunnelService, start, stop |
Methods inherited from class org.restlet.Restlet |
---|
getApplication, getContext, getLogger, init, isStarted, isStopped |
Methods inherited from class org.restlet.Uniform |
---|
delete, delete, get, get, handle, head, head, options, options, post, post, put, put |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JaxRsApplication()
JaxRsApplication(Context)
public JaxRsApplication(Context context)
Application
s by using add(Application)
.SecurityContext.isUserInRole(String)
, status
500 is returned to the client, see RoleChecker.REJECT_WITH_ERROR
.
Use setGuard(Guard)
and setRoleChecker(RoleChecker)
or
setAuthentication(Guard, RoleChecker)
, to set access control.
context
- The application's dedicated context based on the protected
parent component's context.Method Detail |
---|
public boolean add(javax.ws.rs.core.Application appConfig) throws java.lang.IllegalArgumentException
Attaches a JAX-RS Application
to this JaxRsApplication.
The providers are available for all root resource classes provided to
this JaxRsApplication. If you won't mix them, instantiate another
JaxRsApplication.
If the given JAX-RS Application is the first attached Application, the
default extension mappings are remove and replaced by the given, see
TunnelService
.
appConfig
- Contains the classes to load as root resource classes and
as providers. Invalid root resource classes and provider
classes are ignored, according to JAX-RS specification.javax.ws.rs.ApplicationConfig
will be renamed to javax.ws.rs.Application
in the
next JAX-RS release.
java.lang.IllegalArgumentException
- if the appConfig is null.add(Application, boolean)
public boolean add(javax.ws.rs.core.Application appConfig, boolean clearMetadataIfFirst) throws java.lang.IllegalArgumentException
Application
to this Application.
appConfig
- Contains the classes to load as root resource classes and
as providers. Invalid root resource classes and provider
classes are ignored, according to JAX-RS specification.javax.ws.rs.ApplicationConfig
will be renamed to javax.ws.rs.Application
in the
next JAX-RS release.clearMetadataIfFirst
- If this flag is true and the given ApplicationConfig is
the first attached ApplicationConfig, the default
extension mappings are remove an replaced by the given,
see TunnelService
java.lang.IllegalArgumentException
- if the appConfig is null.add(Application)
public Restlet createRoot()
createRoot
in class Application
public Guard getGuard()
public ObjectFactory getObjectFactory()
public RoleChecker getRoleChecker()
public java.util.Collection<java.lang.Class<?>> getRootResources()
public java.util.Collection<java.lang.String> getRootUris()
public void setAuthentication(Guard guard, RoleChecker roleChecker)
Guard
checks
the username and password (e.g.), the RoleChecker
manages the
role management for the JAX-RS extension.
guard
- the Guard to use.roleChecker
- the RoleChecker to usesetGuard(Guard)
,
setRoleChecker(RoleChecker)
public void setContext(Context context)
setContext
in class Restlet
public void setGuard(Guard guard)
Guard
to use. It should typically use the
Context
of this application.createRoot()
.
guard
- the Guard to use.setAuthentication(Guard, RoleChecker)
public void setObjectFactory(ObjectFactory objectFactory)
objectFactory
- the ObjectFactory for root resource class and provider
instantiation.public void setRoleChecker(RoleChecker roleChecker)
RoleChecker
to use.
roleChecker
- setAuthentication(Guard, RoleChecker)
,
setGuard(Guard)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |