org.restlet
Class Component

java.lang.Object
  extended by org.restlet.Uniform
      extended by org.restlet.Restlet
          extended by org.restlet.Component

public class Component
extends Restlet

Restlet managing a set of Connectors, VirtualHosts and Applications. Applications are expected to be directly attached to VirtualHosts. Components also expose several services: access logging and status setting.

From an architectural point of view, here is the REST definition: "A component is an abstract unit of software instructions and internal state that provides a transformation of data via its interface." Roy T. Fielding

Author:
Jerome Louvel (contact@noelios.com)
See Also:
Source dissertation

Constructor Summary
Component()
          Constructor.
 
Method Summary
 ClientList getClients()
          Returns the modifiable list of client connectors.
 VirtualHost getDefaultHost()
          Returns the default virtual host.
 List<VirtualHost> getHosts()
          Returns the modifiable list of host routers.
 LogService getLogService()
          Returns the global log service.
 ServerList getServers()
          Returns the modifiable list of server connectors.
 StatusService getStatusService()
          Returns the status service.
 void handle(Request request, Response response)
          Handles a call.
 void setLogService(LogService logService)
          Sets the global log service.
 void setStatusService(StatusService statusService)
          Sets the status service.
 void start()
          Starts the component and all its connectors.
 void stop()
          Stops the component and all its connectors.
 
Methods inherited from class org.restlet.Restlet
getContext, getLogger, init, isStarted, isStopped, setContext
 
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

Component

public Component()
Constructor.

Method Detail

getClients

public ClientList getClients()
Returns the modifiable list of client connectors.

Returns:
The modifiable list of client connectors.

getServers

public ServerList getServers()
Returns the modifiable list of server connectors.

Returns:
The modifiable list of server connectors.

start

public void start()
           throws Exception
Starts the component and all its connectors.

Overrides:
start in class Restlet
Throws:
Exception

stop

public void stop()
          throws Exception
Stops the component and all its connectors.

Overrides:
stop in class Restlet
Throws:
Exception

getDefaultHost

public VirtualHost getDefaultHost()
Returns the default virtual host.

Returns:
The default virtual host.

getHosts

public List<VirtualHost> getHosts()
Returns the modifiable list of host routers.

Returns:
The modifiable list of host routers.

getLogService

public LogService getLogService()
Returns the global log service. On the first call, if no log service was defined via the setLogService(LogService) method, then a default logger service is created. This default service is enabled by default and has a logger name composed of the canonical name of the current component's class or subclass, appended with the instance hash code between parenthesis (eg. "com.mycompany.MyComponent(1439)").

Returns:
The global log service.

getStatusService

public StatusService getStatusService()
Returns the status service. This service is enabled by default.

Returns:
The status service.

handle

public void handle(Request request,
                   Response response)
Handles a call.

Overrides:
handle in class Restlet
Parameters:
request - The request to handle.
response - The response to update.

setLogService

public void setLogService(LogService logService)
Sets the global log service.

Parameters:
logService - The global log service.

setStatusService

public void setStatusService(StatusService statusService)
Sets the status service.

Parameters:
statusService - The status service.


Copyright © 2005-2007 Noelios Technologies.