org.restlet
Class Restlet

java.lang.Object
  extended by org.restlet.Uniform
      extended by org.restlet.Restlet
Direct Known Subclasses:
Application, Component, Connector, Filter, Finder, Redirector, Router

public class Restlet
extends Uniform

Uniform class that provides a context and life cycle support. It has many subclasses that focus on specific ways to process calls. The context property is typically provided by a parent Component as a way to encapsulate access to shared features such as logging and client connectors.

Author:
Jerome Louvel (contact@noelios.com)

Constructor Summary
Restlet()
          Constructor.
Restlet(Context context)
          Constructor.
 
Method Summary
 Context getContext()
          Returns the context.
 Logger getLogger()
          Returns the context's logger.
 void handle(Request request, Response response)
          Handles a call.
protected  void init(Request request, Response response)
          Initialize the Restlet by attempting to start it, unless it was already started.
 boolean isStarted()
          Indicates if the Restlet is started.
 boolean isStopped()
          Indicates if the Restlet is stopped.
 void setContext(Context context)
          Sets the context.
 void start()
          Starts the Restlet.
 void stop()
          Stops the Restlet.
 
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

Restlet

public Restlet()
Constructor. Note that usage of this constructor is not recommended as the Restlet won't have a proper context set. In general you will prefer to use the other constructor and pass it the parent application's context or eventually the parent component's context if you don't use applications.


Restlet

public Restlet(Context context)
Constructor.

Parameters:
context - The context.
Method Detail

getContext

public Context getContext()
Returns the context.

Returns:
The context.

getLogger

public Logger getLogger()
Returns the context's logger.

Returns:
The context's logger.

handle

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

Specified by:
handle in class Uniform
Parameters:
request - The request to handle.
response - The response to update.

init

protected void init(Request request,
                    Response response)
Initialize the Restlet 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.

Parameters:
request - The request to handle.
response - The response to update.

isStarted

public boolean isStarted()
Indicates if the Restlet is started.

Returns:
True if the Restlet is started.

isStopped

public boolean isStopped()
Indicates if the Restlet is stopped.

Returns:
True if the Restlet is stopped.

setContext

public void setContext(Context context)
Sets the context.

Parameters:
context - The context.

start

public void start()
           throws Exception
Starts the Restlet.

Throws:
Exception

stop

public void stop()
          throws Exception
Stops the Restlet.

Throws:
Exception


Copyright © 2005-2007 Noelios Technologies.