public final class ThreadSafeRenderingContext extends Object implements RenderingContext
RenderingContext.CtxBuilder, RenderingContext.SessionWrapper
DEFAULT_LOCALE, DEFAULT_URL
Constructor and Description |
---|
ThreadSafeRenderingContext() |
Modifier and Type | Method and Description |
---|---|
void |
addParameterListValues(String name,
List<Object> values)
Add values in the context with a given name.
|
void |
addParameterValues(String name,
Object... values) |
void |
configureThread(RenderingContext delegates)
Configure this
RenderingContext to use the given RenderingContext in the current thread. |
Map<String,List<Object>> |
getAllParameters()
Get all parameter in this context except wrapped parameters.
|
String |
getBaseUrl()
Gets the current base url.
|
boolean |
getBooleanParameter(String name)
|
RenderingContext |
getDelegate()
Get the underlying
RenderingContext . |
Set<String> |
getEnrichers(String entity)
Get all enrichers to activate on the given entity type.
|
Set<String> |
getFetched(String entity)
Get all properties to fetch for a given entity type.
|
Locale |
getLocale()
Gets the requested
Locale . |
<T> T |
getParameter(String name)
Get the casted parameter value for a given name.
|
<T> List<T> |
getParameters(String name)
Get the casted parameter values for a given name.
|
Set<String> |
getProperties()
Get all document properties.
|
RenderingContext.SessionWrapper |
getSession(DocumentModel document)
Gets the current
CoreSession or try to create one. |
Set<String> |
getTranslated(String entity)
Get all properties to translate for a given entity type.
|
void |
setExistingSession(CoreSession session)
Provides a
CoreSession to marshallers. |
void |
setParameterListValues(String name,
List<Object> values)
Push values in the context with a given name.
|
void |
setParameterValues(String name,
Object... values) |
WrappedContext |
wrap()
see
WrappedContext |
public void configureThread(RenderingContext delegates)
RenderingContext
to use the given RenderingContext
in the current thread.delegates
- The underlying RenderingContext
.public RenderingContext getDelegate()
RenderingContext
.RenderingContext
.public Locale getLocale()
RenderingContext
Locale
.getLocale
in interface RenderingContext
public String getBaseUrl()
RenderingContext
getBaseUrl
in interface RenderingContext
public RenderingContext.SessionWrapper getSession(DocumentModel document)
RenderingContext
CoreSession
or try to create one.getSession
in interface RenderingContext
document
- may be null, if present, this method search for a session in the document.CoreSession
if it exists. null otherwise.public void setExistingSession(CoreSession session)
RenderingContext
CoreSession
to marshallers.
For example: a CoreSession
from the request context.
setExistingSession
in interface RenderingContext
session
- The existing CoreSession
which lifecycle is managed outside the marshalling context.public Set<String> getProperties()
RenderingContext
getProperties
in interface RenderingContext
public Set<String> getFetched(String entity)
RenderingContext
getFetched
in interface RenderingContext
entity
- The type of the entity on which you want to fetch properties.public Set<String> getTranslated(String entity)
RenderingContext
getTranslated
in interface RenderingContext
entity
- The type of the entity on which you want to fetch properties.public Set<String> getEnrichers(String entity)
RenderingContext
getEnrichers
in interface RenderingContext
entity
- The type of the entity on which you want to activate enrichers.public WrappedContext wrap()
RenderingContext
WrappedContext
wrap
in interface RenderingContext
WrappedContext
public <T> T getParameter(String name)
RenderingContext
getParameter
in interface RenderingContext
name
- The parameter name.public boolean getBooleanParameter(String name)
RenderingContext
getBooleanParameter
in interface RenderingContext
public <T> List<T> getParameters(String name)
RenderingContext
getParameters
in interface RenderingContext
name
- The parameter name.public Map<String,List<Object>> getAllParameters()
RenderingContext
getAllParameters
in interface RenderingContext
public void setParameterValues(String name, Object... values)
setParameterValues
in interface RenderingContext
RenderingContext.setParameterListValues(String, List)
public void setParameterListValues(String name, List<Object> values)
RenderingContext
setParameterListValues
in interface RenderingContext
name
- The parameter name.values
- The parameter values.public void addParameterValues(String name, Object... values)
addParameterValues
in interface RenderingContext
RenderingContext.addParameterListValues(String, List)
public void addParameterListValues(String name, List<Object> values)
RenderingContext
addParameterListValues
in interface RenderingContext
name
- The parameter name.values
- The parameter values.Copyright © 2015 Nuxeo SA. All rights reserved.