org.restlet.gwt
Class Context

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

public class Context
extends java.lang.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

Constructor Summary
Context()
          Constructor.
 
Method Summary
 java.util.Map<java.lang.String,java.lang.Object> getAttributes()
          Returns a modifiable attributes map that can be used by developers to save information relative to the context.
 Uniform getClientDispatcher()
          Returns a request dispatcher to available client connectors.
 Series<Parameter> getParameters()
          Returns the modifiable series of parameters.
 Uniform getServerDispatcher()
          Returns a request dispatcher to component's virtual hosts.
 void setAttributes(java.util.Map<java.lang.String,java.lang.Object> attributes)
          Sets the modifiable map of attributes.
 void setParameters(Series<Parameter> parameters)
          Sets the modifiable series of parameters.
 
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".

Method Detail

getAttributes

public java.util.Map<java.lang.String,java.lang.Object> getAttributes()
Returns a modifiable attributes map that can be used by developers to save information relative to the context. Creates a new instance if no one has been set. 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.

getClientDispatcher

public Uniform getClientDispatcher()
Returns a request dispatcher to available client connectors. When you ask the dispatcher to handle a request, it will automatically select the appropriate 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.

getParameters

public Series<Parameter> getParameters()
Returns the modifiable series of parameters. Creates a new instance if no one has been set. 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.

getServerDispatcher

public Uniform getServerDispatcher()
Returns a request dispatcher to component's virtual hosts. This is mostly useful for application that want to optimize calls to other applications hosted in the same component or to the application itself.

The processing is the same as what would have been done if the request came from one of the component's server connectors. It first must match one of the registered virtual hosts. Then it can be routed to one of the attaced Restlets, typically an Application.

Returns:
A request dispatcher to the server connectors' router.

setAttributes

public void setAttributes(java.util.Map<java.lang.String,java.lang.Object> attributes)
Sets the modifiable map of attributes.

Parameters:
attributes - The modifiable map of attributes.

setParameters

public void setParameters(Series<Parameter> parameters)
Sets the modifiable series of parameters.

Parameters:
parameters - The modifiable series of parameters.


Copyright © 2005-2008 Noelios Technologies.