|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.restlet.Restlet
org.restlet.Application
public class Application
Restlet managing a coherent set of Resources and Services. Applications are
guaranteed to receive calls with their base reference set relatively to the
VirtualHost that served them. This class is both a descriptor able to create
the root Restlet and the actual Restlet that can be attached to one or more
VirtualHost instances.
Applications also have many useful services associated. They are all enabled
by default and are available as properties that can be eventually overridden:
Constructor Summary | |
---|---|
Application()
Constructor. |
|
Application(Context context)
Constructor. |
Method Summary | |
---|---|
Restlet |
createInboundRoot()
Creates a inbound root Restlet that will receive all incoming calls. |
Restlet |
createOutboundRoot()
Creates a outbound root Restlet that will receive all outgoing calls from ClientResource. |
Restlet |
createRoot()
Deprecated. Override the createInboundRoot() method instead. |
ConnectorService |
getConnectorService()
Returns the connector service. |
ConverterService |
getConverterService()
Returns the converter service. |
static Application |
getCurrent()
This variable is stored internally as a thread local variable and updated each time a call enters an application. |
DecoderService |
getDecoderService()
Returns the decoder service. |
Class<? extends Finder> |
getFinderClass()
Returns the finder class used to instantiate resource classes. |
Restlet |
getInboundRoot()
Returns the inbound root Restlet. |
MetadataService |
getMetadataService()
Returns the metadata service. |
Restlet |
getOutboundRoot()
Returns the outbound root Restlet. |
RangeService |
getRangeService()
Returns the range service. |
Role |
getRole(String name)
Returns the role associated to the given name. |
List<Role> |
getRoles()
Returns the modifiable list of roles. |
Restlet |
getRoot()
Deprecated. Use the getInboundRoot() method instead. |
ServiceList |
getServices()
Returns the modifiable list of services. |
StatusService |
getStatusService()
Returns the status service. |
TaskService |
getTaskService()
Returns a task service to run concurrent tasks. |
TunnelService |
getTunnelService()
Returns the tunnel service. |
void |
handle(Request request,
Response response)
Handles a call. |
void |
setClientRoot(Class<?> clientRootClass)
Sets the client root Resource class. |
void |
setConnectorService(ConnectorService connectorService)
Sets the connector service. |
void |
setContext(Context context)
Sets the context. |
void |
setConverterService(ConverterService converterService)
Sets the converter service. |
static void |
setCurrent(Application application)
Sets the context to associated with the current thread. |
void |
setDecoderService(DecoderService decoderService)
Sets the decoder service. |
void |
setFinderClass(Class<? extends Finder> finderClass)
Sets the finder class to instantiate. |
void |
setInboundRoot(Class<?> inboundRootClass)
Sets the inbound root Resource class. |
void |
setInboundRoot(Restlet inboundRoot)
Sets the inbound root Restlet. |
void |
setMetadataService(MetadataService metadataService)
Sets the metadata service. |
void |
setOutboundRoot(Restlet outboundRoot)
Sets the outbound root Restlet. |
void |
setRangeService(RangeService rangeService)
Sets the range service. |
void |
setRoles(List<Role> roles)
Sets the modifiable list of roles. |
void |
setRoot(Class<?> inboundRootClass)
Deprecated. Use the setInboundRoot(Class) method instead. |
void |
setRoot(Restlet inboundRoot)
Deprecated. Use the setInboundRoot(Restlet) method instead. |
void |
setStatusService(StatusService statusService)
Sets the status service. |
void |
setTaskService(TaskService taskService)
Sets the task service. |
void |
setTunnelService(TunnelService tunnelService)
Sets the tunnel service. |
void |
start()
Starts the application, all the enabled associated services then the inbound and outbound roots. |
void |
stop()
Stops the application, the inbound and outbound roots then all the enabled associated services. |
Methods inherited from class org.restlet.Restlet |
---|
finalize, getApplication, getAuthor, getContext, getDescription, getLogger, getName, getOwner, isStarted, isStopped, setAuthor, setDescription, setName, setOwner |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Application()
Application(Context)
. Therefore
the context will initially be null. It's only when you attach the
application to a virtual host via one of its attach*() methods that a
proper context will be set.
public Application(Context context)
context
- The context to use based on parent component context. This
context should be created using the
Context.createChildContext()
method to ensure a proper
isolation with the other applications.Method Detail |
---|
public static Application getCurrent()
Handler.getApplication()
public static void setCurrent(Application application)
application
- The thread's context.public Restlet createInboundRoot()
public Restlet createOutboundRoot()
Context.getClientDispatcher()
by default. This method
is intended to be overridden by subclasses.
@Deprecated public Restlet createRoot()
createInboundRoot()
method instead.
public ConnectorService getConnectorService()
public ConverterService getConverterService()
public DecoderService getDecoderService()
public Class<? extends Finder> getFinderClass()
Finder
class. This property is leveraged
by setClientRoot(Class)
and setInboundRoot(Class)
methods.
public Restlet getInboundRoot()
public MetadataService getMetadataService()
public Restlet getOutboundRoot()
public RangeService getRangeService()
public Role getRole(String name)
name
- The name of the role to find.
public List<Role> getRoles()
@Deprecated public Restlet getRoot()
getInboundRoot()
method instead.
public ServiceList getServices()
public StatusService getStatusService()
public TaskService getTaskService()
public TunnelService getTunnelService()
public void handle(Request request, Response response)
Restlet
Context.setCurrent(Context)
method and by attempting to start it, unless it was already started. If
an exception is thrown during the start action, then the response status
is set to Status.SERVER_ERROR_INTERNAL
.
Subclasses overriding this method should make sure that they call super.handle(request, response) before adding their own logic.
handle
in interface Uniform
handle
in class Restlet
request
- The request to handle.response
- The response to update.public void setClientRoot(Class<?> clientRootClass)
clientRootClass
- The client root Resource class.public void setConnectorService(ConnectorService connectorService)
connectorService
- The connector service.public void setContext(Context context)
Restlet
setContext
in class Restlet
context
- The context.public void setConverterService(ConverterService converterService)
converterService
- The converter service.public void setDecoderService(DecoderService decoderService)
decoderService
- The decoder service.public void setFinderClass(Class<? extends Finder> finderClass)
setClientRoot(Class)
and setInboundRoot(Class)
methods.
finderClass
- The finder class to instantiate.public void setInboundRoot(Class<?> inboundRootClass)
inboundRootClass
- The inbound root Resource class.public void setInboundRoot(Restlet inboundRoot)
inboundRoot
- The inbound root Restlet.public void setMetadataService(MetadataService metadataService)
metadataService
- The metadata service.public void setOutboundRoot(Restlet outboundRoot)
outboundRoot
- The outbound root Restlet.public void setRangeService(RangeService rangeService)
rangeService
- The range service.public void setRoles(List<Role> roles)
roles
- A list of roles.@Deprecated public void setRoot(Class<?> inboundRootClass)
setInboundRoot(Class)
method instead.
inboundRootClass
- The inbound root Resource class.@Deprecated public void setRoot(Restlet inboundRoot)
setInboundRoot(Restlet)
method instead.
inboundRoot
- The inbound root Restlet.public void setStatusService(StatusService statusService)
statusService
- The status service.public void setTaskService(TaskService taskService)
taskService
- The task service.public void setTunnelService(TunnelService tunnelService)
tunnelService
- The tunnel service.public void start() throws Exception
start
in class Restlet
Exception
public void stop() throws Exception
stop
in class Restlet
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |