public class Component extends Restlet
Connectors, VirtualHosts,
Services and Applications. 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. | Constructor and Description |
|---|
Component()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
ClientList |
getClients()
Returns a modifiable list of client connectors.
|
VirtualHost |
getDefaultHost()
Returns the default virtual host.
|
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(String name)
Finds the realm with the given name.
|
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.
|
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(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(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, setOwnerpublic ClientList getClients()
public VirtualHost getDefaultHost()
public 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(String name)
name - The name.public 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)
RestletContext.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)
RestletsetContext in class Restletcontext - The context.public void setDefaultHost(VirtualHost defaultHost)
defaultHost - The default virtual host.public void setHosts(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(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 Exception
start in class RestletExceptionstartClients(),
startServers(),
startRouters(),
startServices(),
startRealms(),
startHelper()protected void startClients()
throws Exception
Exceptionprotected void startHelper()
throws Exception
Exceptionprotected void startRouters()
throws Exception
Exceptionprotected void startServers()
throws Exception
Exceptionprotected void startServices()
throws Exception
Exceptionpublic void stop()
throws Exception
stop in class RestletExceptionstopHelper(),
stopRealms(),
stopServices(),
stopRouters(),
stopServers(),
stopClients()protected void stopClients()
throws Exception
Exceptionprotected void stopHelper()
throws Exception
Exceptionprotected void stopRouters()
throws Exception
Exceptionprotected void stopServers()
throws Exception
Exceptionprotected void stopServices()
throws Exception
Exceptionpublic void updateHosts()
throws Exception
ExceptionCopyright © 2005–2025. All rights reserved.