|
||||||||||
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 set of Restlets. 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(Logger logger)
Constructor. |
|
Context(String loggerName)
Constructor. |
Method Summary | |
---|---|
Context |
createChildContext()
Creates a protected child context. |
ConcurrentMap<String,Object> |
getAttributes()
Returns a modifiable attributes map that can be used by developers to save information relative to the context. |
Restlet |
getClientDispatcher()
Returns a request dispatcher to available client connectors. |
static Context |
getCurrent()
Returns the context associated to the current Restlet . |
static Logger |
getCurrentLogger()
Returns the current context's logger. |
Enroler |
getDefaultEnroler()
Returns an enroler that can add the user roles based on authenticated user principals. |
Verifier |
getDefaultVerifier()
Returns a verifier that can check the validity of the credentials associated to a request. |
Logger |
getLogger()
Returns the logger. |
Series<Parameter> |
getParameters()
Returns the modifiable series of parameters. |
Restlet |
getServerDispatcher()
Returns a request dispatcher to component's virtual hosts. |
void |
setAttributes(Map<String,Object> attributes)
Sets the modifiable map of attributes. |
void |
setClientDispatcher(Restlet clientDispatcher)
Sets the client dispatcher. |
static void |
setCurrent(Context context)
Sets the context to associated with the current thread. |
void |
setDefaultEnroler(Enroler enroler)
Sets an enroler that can add the user roles based on authenticated user principals. |
void |
setDefaultVerifier(Verifier verifier)
Sets a local verifier that can check the validity of user/secret couples based on Restlet default authorization model. |
void |
setLogger(Logger logger)
Sets the logger. |
void |
setLogger(String loggerName)
Sets the logger. |
void |
setParameters(Series<Parameter> parameters)
Sets the modifiable series of parameters. |
void |
setServerDispatcher(Restlet serverDispatcher)
Sets the server dispatcher. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Context()
public Context(Logger logger)
logger
- The logger instance of use.public Context(String loggerName)
loggerName
- The name of the logger to use.Method Detail |
---|
public static Context getCurrent()
Restlet
. The
context can be the one of a Component
, an Application
, a
Filter
or any other Restlet
subclass.Restlet.getContext()
or
Resource.getContext()
.Restlet
via the
Restlet.handle(org.restlet.Request, org.restlet.Response)
method.
public static Logger getCurrentLogger()
public static void setCurrent(Context context)
context
- The thread's context.public Context createChildContext()
public ConcurrentMap<String,Object> getAttributes()
Attribute name | Class name | Description |
---|---|---|
org.restlet.application | org.restlet.Application | The parent application providing this context, if any. |
public Restlet getClientDispatcher()
public Enroler getDefaultEnroler()
public Verifier getDefaultVerifier()
public Logger getLogger()
public Series<Parameter> getParameters()
public Restlet getServerDispatcher()
getClientDispatcher()
method.
public void setAttributes(Map<String,Object> attributes)
attributes
- A map of attributes.public void setClientDispatcher(Restlet clientDispatcher)
clientDispatcher
- The new client dispatcher.public void setDefaultEnroler(Enroler enroler)
enroler
- An enroler.public void setDefaultVerifier(Verifier verifier)
verifier
- A local verifier.public void setLogger(Logger logger)
logger
- The logger.public void setLogger(String loggerName)
loggerName
- The name of the logger to use.public void setParameters(Series<Parameter> parameters)
parameters
- A series of parameters.public void setServerDispatcher(Restlet serverDispatcher)
serverDispatcher
- The new server dispatcher.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |