|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.restlet.Context
public class Context
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 (Application is the
most common case).
Concurrency note: attributes and parameters of a context are stored in
concurrent collections that guarantee thread safe access and modification. If
several threads concurrently access objects and modify these collections,
they should synchronize on the lock of the Context instance.
Constructor Summary | |
---|---|
Context()
Constructor. |
|
Context(java.util.logging.Logger logger)
Constructor. |
|
Context(java.lang.String loggerName)
Constructor. |
Method Summary | |
---|---|
Context |
createChildContext()
Creates a protected child context. |
java.util.concurrent.ConcurrentMap<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. |
static Context |
getCurrent()
Returns the context associated to the current Restlet. |
static java.util.logging.Logger |
getCurrentLogger()
Returns the current context's logger. |
Uniform |
getDispatcher()
Deprecated. Use getClientDispatcher() instead. |
java.util.logging.Logger |
getLogger()
Returns the logger. |
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. |
static void |
setCurrent(Context context)
Sets the context to associated with the current thread. |
void |
setLogger(java.util.logging.Logger logger)
Sets the logger. |
void |
setLogger(java.lang.String loggerName)
Sets the logger. |
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 |
---|
public Context()
public Context(java.util.logging.Logger logger)
logger
- The logger instance of use.public Context(java.lang.String loggerName)
loggerName
- The name of the logger to use.Method Detail |
---|
public static Context getCurrent()
Restlet.getContext()
or
Handler.getContext()
.
This variable is stored internally as a thread local variable and updated
each time a request is handled by a Restlet via the
Restlet.handle(org.restlet.data.Request, org.restlet.data.Response)
method.
public static java.util.logging.Logger getCurrentLogger()
public static void setCurrent(Context context)
context
- The thread's context.public Context createChildContext()
public java.util.concurrent.ConcurrentMap<java.lang.String,java.lang.Object> getAttributes()
Attribute name | Class name | Description |
---|---|---|
org.restlet.application | org.restlet.Application | The parent application providing this context, if any. |
public Uniform getClientDispatcher()
@Deprecated public Uniform getDispatcher()
public java.util.logging.Logger getLogger()
public Series<Parameter> getParameters()
public Uniform getServerDispatcher()
public void setAttributes(java.util.Map<java.lang.String,java.lang.Object> attributes)
attributes
- The modifiable map of attributes.public void setLogger(java.util.logging.Logger logger)
logger
- The logger.public void setLogger(java.lang.String loggerName)
loggerName
- The name of the logger to use.public void setParameters(Series<Parameter> parameters)
parameters
- The modifiable series of parameters.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |