public class Application extends Restlet
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.Constructor and Description |
---|
Application()
Constructor.
|
Application(Context context)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
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.
|
ConnectorService |
getConnectorService()
Returns the connector service.
|
ConnegService |
getConnegService()
Returns the content negotiation 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.
|
EncoderService |
getEncoderService()
Returns the encoder service.
|
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(java.lang.String name)
Returns the role associated to the given name.
|
java.util.List<Role> |
getRoles()
Returns the modifiable list of roles.
|
ServiceList |
getServices()
Returns the modifiable list of services.
|
StatusService |
getStatusService()
Returns the status service.
|
TaskService |
getTaskService()
Deprecated.
|
TunnelService |
getTunnelService()
Returns the tunnel service.
|
void |
handle(Request request,
Response response)
Handles a call.
|
boolean |
isDebugging()
Indicates if the debugging mode is enabled.
|
void |
setConnectorService(ConnectorService connectorService)
Sets the connector service.
|
void |
setConnegService(ConnegService connegService)
Sets the content negotiation 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 |
setDebugging(boolean debugging)
Indicates if the debugging mode is enabled.
|
void |
setDecoderService(DecoderService decoderService)
Sets the decoder service.
|
void |
setEncoderService(EncoderService encoderService)
Sets the encoder service.
|
void |
setInboundRoot(java.lang.Class<? extends ServerResource> 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(java.lang.Class<? extends ServerResource> outboundRootClass)
Sets the outbound root Resource class.
|
void |
setOutboundRoot(Restlet outboundRoot)
Sets the outbound root Restlet.
|
void |
setRangeService(RangeService rangeService)
Sets the range service.
|
void |
setRoles(java.util.List<Role> roles)
Sets the modifiable list of roles.
|
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.
|
createFinder, finalize, getApplication, getAuthor, getContext, getDescription, getFinderClass, getLogger, getName, getOwner, handle, handle, handle, isStarted, isStopped, setAuthor, setDescription, setFinderClass, setName, setOwner
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.public static Application getCurrent()
Resource.getApplication()
public static void setCurrent(Application application)
application
- The thread's context.public Restlet createInboundRoot()
public Restlet createOutboundRoot()
Router
and
Filter
classes will be used. The default implementation returns a
Restlet giving access to the the outbound service layer and finally to
the Context.getClientDispatcher()
.
This method is intended to be overridden by subclasses but in order to benefit from the outbound service filtering layer, the original outbound root must be careful attached again at the end of the user filtering layer.
public ConnectorService getConnectorService()
public ConnegService getConnegService()
public ConverterService getConverterService()
public DecoderService getDecoderService()
public EncoderService getEncoderService()
public Restlet getInboundRoot()
public MetadataService getMetadataService()
public Restlet getOutboundRoot()
public RangeService getRangeService()
public Role getRole(java.lang.String name)
name
- The name of the role to find.public java.util.List<Role> getRoles()
public ServiceList getServices()
public StatusService getStatusService()
@Deprecated 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.
public boolean isDebugging()
public void setConnectorService(ConnectorService connectorService)
connectorService
- The connector service.public void setConnegService(ConnegService connegService)
connegService
- The content negotiation 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 setDebugging(boolean debugging)
debugging
- True if the debugging mode is enabled.public void setDecoderService(DecoderService decoderService)
decoderService
- The decoder service.public void setEncoderService(EncoderService encoderService)
encoderService
- The encoder service.public void setInboundRoot(java.lang.Class<? extends ServerResource> 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(java.lang.Class<? extends ServerResource> outboundRootClass)
outboundRootClass
- The client root ServerResource
subclass.public void setOutboundRoot(Restlet outboundRoot)
outboundRoot
- The outbound root Restlet.public void setRangeService(RangeService rangeService)
rangeService
- The range service.public void setRoles(java.util.List<Role> roles)
roles
- A list of roles.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 java.lang.Exception
Copyright © 2005-2024 Restlet.