org.restlet
Class Context

java.lang.Object
  extended by org.restlet.Context

public class Context
extends Object

Contextual data and services provided to a Restlet. The context is the means by which a Restlet may access the software environment within the framework. It is typically provided by the immediate parent Restlet (Component and Application are the most common cases).

Author:
Jerome Louvel (contact@noelios.com)

Constructor Summary
Context()
          Constructor.
Context(Logger logger)
          Constructor.
Context(String loggerName)
          Constructor.
 
Method Summary
 Map<String,Object> getAttributes()
          Returns a modifiable attributes map that can be used by developers to save information relative to the context.
 Uniform getDispatcher()
          Returns a request dispatcher to available client connectors.
 Logger getLogger()
          Returns the logger.
 Series<Parameter> getParameters()
          Returns the modifiable series of parameters.
 void setLogger(Logger logger)
          Sets the logger.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Context

public Context()
Constructor. Writes log messages to "org.restlet".


Context

public Context(Logger logger)
Constructor.

Parameters:
logger - The logger instance of use.

Context

public Context(String loggerName)
Constructor.

Parameters:
loggerName - The name of the logger to use.
Method Detail

getAttributes

public Map<String,Object> getAttributes()
Returns a modifiable attributes map that can be used by developers to save information relative to the context. This is a convenient mean to provide common objects to all the Restlets and Resources composing an Application.

In addition, this map is a shared space between the developer and the Restlet implementation. For this purpose, all attribute names starting with "org.restlet" are reserved. Currently the following attributes are used:
Attribute name Class name Description
org.restlet.application org.restlet.Application The parent application providing this context, if any.

Returns:
The modifiable attributes map.

getDispatcher

public Uniform getDispatcher()
Returns a request dispatcher to available client connectors. When you ask the dispatcher to handle a request, it will automatically select the best client connector for your request, based on the request.protocol property or on the resource URI's scheme. This call is blocking and will return an updated response object.

Returns:
A request dispatcher to available client connectors.

getLogger

public Logger getLogger()
Returns the logger.

Returns:
The logger.

getParameters

public Series<Parameter> getParameters()
Returns the modifiable series of parameters. A parameter is a pair composed of a name and a value and is typically used for configuration purpose, like Java properties. Note that multiple parameters with the same name can be declared and accessed.

Returns:
The modifiable series of parameters.

setLogger

public void setLogger(Logger logger)
Sets the logger.

Parameters:
logger - The logger.


Copyright © 2005-2007 Noelios Technologies.