org.restlet
Class Application

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

public abstract class Application
extends Restlet

Restlet that can be attached to one or more VirtualHosts. 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 available as properties that can be eventually overriden:


If you need to retrieve the reference to an Application from one of its contained Restlets, you can use the KEY constant to lookup the Context.attributes property.

Author:
Jerome Louvel (contact@noelios.com)

Field Summary
static String KEY
          Name of the attribute key containing a reference to the current application.
 
Constructor Summary
Application()
          Constructor.
Application(Context parentContext)
          Constructor.
 
Method Summary
abstract  Restlet createRoot()
          Creates a root Restlet that will receive all incoming calls.
 String getAuthor()
          Returns the author(s).
 ConnectorService getConnectorService()
          Returns the connector service.
 ConverterService getConverterService()
          Returns the converter service.
 DecoderService getDecoderService()
          Returns the decoder service.
 String getDescription()
          Returns the description.
 MetadataService getMetadataService()
          Returns the metadata service.
 String getName()
          Returns the display name.
 String getOwner()
          Returns the owner(s).
 Restlet getRoot()
          Returns the root Restlet.
 StatusService getStatusService()
          Returns the status service.
 TunnelService getTunnelService()
          Returns the tunnel service.
 void handle(Request request, Response response)
          Handles a call.
 void setAuthor(String author)
          Sets the author(s).
 void setConnectorService(ConnectorService connectorService)
          Sets the connector service.
 void setConverterService(ConverterService converterService)
          Sets the converter service.
 void setDecoderService(DecoderService decoderService)
          Sets the decoder service.
 void setDescription(String description)
          Sets the description.
 void setMetadataService(MetadataService metadataService)
          Sets the metadata service.
 void setName(String name)
          Sets the display name.
 void setOwner(String owner)
          Sets the owner(s).
 void setStatusService(StatusService statusService)
          Sets the status service.
 void setTunnelService(TunnelService tunnelService)
          Sets the tunnel service.
 void start()
          Starts the Restlet.
 void stop()
          Stops the Restlet.
 
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
 

Field Detail

KEY

public static final String KEY
Name of the attribute key containing a reference to the current application.

See Also:
Constant Field Values
Constructor Detail

Application

public Application()
Constructor. Note that usage of this constructor is not recommended as your application won't have access to the parent component context. For example, no dispatching will be possible as it requires access to the component's client connectors.


Application

public Application(Context parentContext)
Constructor.

Parameters:
parentContext - The parent context. Typically the component's context.
Method Detail

createRoot

public abstract Restlet createRoot()
Creates a root Restlet that will receive all incoming calls. In general, instances of Router, Filter or Handler classes will be used as initial application Restlet. The default implementation returns null by default. This method is intended to be overriden by subclasses.

Returns:
The root Restlet.

getAuthor

public String getAuthor()
Returns the author(s).

Returns:
The author(s).

getConnectorService

public ConnectorService getConnectorService()
Returns the connector service.

Returns:
The connector service.

getConverterService

public ConverterService getConverterService()
Returns the converter service.

Returns:
The converter service.

getDecoderService

public DecoderService getDecoderService()
Returns the decoder service. This service is enabled by default.

Returns:
The decoderservice.

getDescription

public String getDescription()
Returns the description.

Returns:
The description

getMetadataService

public MetadataService getMetadataService()
Returns the metadata service.

Returns:
The metadata service.

getName

public String getName()
Returns the display name.

Returns:
The display name.

getOwner

public String getOwner()
Returns the owner(s).

Returns:
The owner(s).

getRoot

public Restlet getRoot()
Returns the root Restlet. Invokes the createRoot() method if no Restlet exists.

Returns:
The root Restlet.

getStatusService

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

Returns:
The status service.

getTunnelService

public TunnelService getTunnelService()
Returns the tunnel service. This service is enabled by default.

Returns:
The tunnel 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.

setAuthor

public void setAuthor(String author)
Sets the author(s).

Parameters:
author - The author(s).

setDescription

public void setDescription(String description)
Sets the description.

Parameters:
description - The description.

setName

public void setName(String name)
Sets the display name.

Parameters:
name - The display name.

setOwner

public void setOwner(String owner)
Sets the owner(s).

Parameters:
owner - The owner(s).

start

public void start()
           throws Exception
Description copied from class: Restlet
Starts the Restlet.

Overrides:
start in class Restlet
Throws:
Exception

stop

public void stop()
          throws Exception
Description copied from class: Restlet
Stops the Restlet.

Overrides:
stop in class Restlet
Throws:
Exception

setConnectorService

public void setConnectorService(ConnectorService connectorService)
Sets the connector service.

Parameters:
connectorService - The connector service.

setConverterService

public void setConverterService(ConverterService converterService)
Sets the converter service.

Parameters:
converterService - The converter service.

setDecoderService

public void setDecoderService(DecoderService decoderService)
Sets the decoder service.

Parameters:
decoderService - The decoder service.

setMetadataService

public void setMetadataService(MetadataService metadataService)
Sets the metadata service.

Parameters:
metadataService - The metadata service.

setStatusService

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

Parameters:
statusService - The status service.

setTunnelService

public void setTunnelService(TunnelService tunnelService)
Sets the tunnel service.

Parameters:
tunnelService - The tunnel service.


Copyright © 2005-2007 Noelios Technologies.