public class Component extends Restlet
Connector
s, VirtualHost
s,
Service
s and Application
s. Applications are expected to be
directly attached to virtual hosts or to the internal router (see RIAP
pseudo-protocol for usage). Components also expose several services: access
logging and status setting. <?xml version="1.0"?> <component xmlns="http://restlet.org/schemas/2.0/Component"> <client protocol="CLAP" /> <client protocol="FILE" /> <client protocols="HTTP HTTPS" /> <server protocols="HTTP HTTPS" /> <defaultHost> <attach uriPattern="/abcd/{xyz}" targetClass="org.restlet.test.MyApplication" /> <attach uriPattern="/efgh/{xyz}" targetDescriptor="clap://class/org/restlet/test/MyApplication.wadl" /> </defaultHost> </component>
Constructor and Description |
---|
Component()
Constructor.
|
Component(Reference xmlConfigRef)
Deprecated.
Use XML support in the Spring extension instead.
|
Component(Representation xmlConfigRepresentation)
Deprecated.
Use XML support in the Spring extension instead.
|
Component(java.lang.String xmlConfigurationRef)
Deprecated.
Use XML support in the Spring extension instead.
|
Modifier and Type | Method and Description |
---|---|
ClientList |
getClients()
Returns a modifiable list of client connectors.
|
VirtualHost |
getDefaultHost()
Returns the default virtual host.
|
java.util.List<VirtualHost> |
getHosts()
Returns the modifiable list of virtual hosts.
|
Router |
getInternalRouter()
Returns the private internal router where Restlets like Applications can
be attached.
|
LogService |
getLogService()
Returns the global log service.
|
Realm |
getRealm(java.lang.String name)
Finds the realm with the given name.
|
java.util.List<Realm> |
getRealms()
Returns the modifiable list of security realms.
|
ServerList |
getServers()
Returns the modifiable list of server connectors.
|
ServiceList |
getServices()
Returns the modifiable list of services.
|
StatusService |
getStatusService()
Deprecated.
Use
Application.getStatusService() instead. |
TaskService |
getTaskService()
Returns a task service to run concurrent tasks.
|
void |
handle(Request request,
Response response)
Handles a call.
|
static void |
main(java.lang.String[] args)
Deprecated.
Use XML support in the Spring extension instead.
|
void |
setClients(ClientList clients)
Sets the modifiable list of client connectors.
|
void |
setContext(Context context)
Sets the context.
|
void |
setDefaultHost(VirtualHost defaultHost)
Sets the default virtual host.
|
void |
setHosts(java.util.List<VirtualHost> hosts)
Sets the modifiable list of virtual hosts.
|
void |
setInternalRouter(Router internalRouter)
Sets the private internal router were Restlets like Applications can be
attached.
|
void |
setLogService(LogService logService)
Sets the global log service.
|
void |
setRealms(java.util.List<Realm> realms)
Sets the list of realms.
|
void |
setServers(ServerList servers)
Sets the modifiable list of server connectors.
|
void |
setStatusService(StatusService statusService)
Deprecated.
Use
Application.setStatusService(StatusService)
instead. |
void |
setTaskService(TaskService taskService)
Sets the task service.
|
void |
start()
Starts the component.
|
protected void |
startClients()
Starts the client connectors.
|
protected void |
startHelper()
Starts the internal helper allowing incoming requests to be served.
|
protected void |
startRealms()
Starts the realms.
|
protected void |
startRouters()
Starts the virtual hosts and the internal router.
|
protected void |
startServers()
Starts the server connectors.
|
protected void |
startServices()
Starts the associated services.
|
void |
stop()
Stops the component.
|
protected void |
stopClients()
Stops the client connectors.
|
protected void |
stopHelper()
Stops the internal helper allowing incoming requests to be served.
|
protected void |
stopRealms()
Stops the realms.
|
protected void |
stopRouters()
Stops the virtual hosts and the internal router.
|
protected void |
stopServers()
Stops the server connectors.
|
protected void |
stopServices()
Stops the associated services.
|
void |
updateHosts()
Updates the component to take into account changes to the virtual hosts.
|
createFinder, finalize, getApplication, getAuthor, getContext, getDescription, getFinderClass, getLogger, getName, getOwner, handle, handle, handle, isStarted, isStopped, setAuthor, setDescription, setFinderClass, setName, setOwner
public Component()
@Deprecated public Component(Reference xmlConfigRef)
xmlConfigRef
- The URI reference to the XML configuration file.@Deprecated public Component(Representation xmlConfigRepresentation)
xmlConfigRepresentation
- The representation of the XML configuration file.@Deprecated public Component(java.lang.String xmlConfigurationRef)
xmlConfigurationRef
- The URI reference to the XML configuration file.@Deprecated public static void main(java.lang.String[] args) throws java.lang.Exception
args
- The list of in-line parameters.java.lang.Exception
public ClientList getClients()
public VirtualHost getDefaultHost()
public java.util.List<VirtualHost> getHosts()
public Router getInternalRouter()
Protocol.RIAP
(Restlet Internal Access Protocol)
client connector. This is used to manage private, internal and optimized
access to local applications.Context.getServerDispatcher()
method, but the internal router is
easily addressable via an URI scheme and can be fully private to the
current Component.public LogService getLogService()
setLogService(LogService)
method, then a default
logger service is created. This service will be enabled by default and
has a logger name composed the "org.restlet." prefix followed by the
simple component class name (without packages), followed by the
".LogService" suffix.public Realm getRealm(java.lang.String name)
name
- The name.public java.util.List<Realm> getRealms()
public ServerList getServers()
public ServiceList getServices()
@Deprecated public StatusService getStatusService()
Application.getStatusService()
instead.public TaskService getTaskService()
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 void setClients(ClientList clients)
clients
- A list of client connectors.public void setContext(Context context)
Restlet
setContext
in class Restlet
context
- The context.public void setDefaultHost(VirtualHost defaultHost)
defaultHost
- The default virtual host.public void setHosts(java.util.List<VirtualHost> hosts)
hosts
- A list of virtual hosts.public void setInternalRouter(Router internalRouter)
internalRouter
- The private internal router.getInternalRouter()
public void setLogService(LogService logService)
logService
- The global log service.public void setRealms(java.util.List<Realm> realms)
realms
- A list of realms.public void setServers(ServerList servers)
servers
- A list of server connectors.@Deprecated public void setStatusService(StatusService statusService)
Application.setStatusService(StatusService)
instead.statusService
- The status service.public void setTaskService(TaskService taskService)
taskService
- The task service.public void start() throws java.lang.Exception
start
in class Restlet
java.lang.Exception
startClients()
,
startServers()
,
startRouters()
,
startServices()
,
startRealms()
,
startHelper()
protected void startClients() throws java.lang.Exception
java.lang.Exception
protected void startHelper() throws java.lang.Exception
java.lang.Exception
protected void startRealms() throws java.lang.Exception
java.lang.Exception
protected void startRouters() throws java.lang.Exception
java.lang.Exception
protected void startServers() throws java.lang.Exception
java.lang.Exception
protected void startServices() throws java.lang.Exception
java.lang.Exception
public void stop() throws java.lang.Exception
stop
in class Restlet
java.lang.Exception
stopHelper()
,
stopRealms()
,
stopServices()
,
stopRouters()
,
stopServers()
,
stopClients()
protected void stopClients() throws java.lang.Exception
java.lang.Exception
protected void stopHelper() throws java.lang.Exception
java.lang.Exception
protected void stopRealms() throws java.lang.Exception
java.lang.Exception
protected void stopRouters() throws java.lang.Exception
java.lang.Exception
protected void stopServers() throws java.lang.Exception
java.lang.Exception
protected void stopServices() throws java.lang.Exception
java.lang.Exception
public void updateHosts() throws java.lang.Exception
java.lang.Exception
Copyright © 2005-2024 Restlet.