public final class ThreadSafeRenderingContext extends Object implements RenderingContext
RenderingContext.CtxBuilder, RenderingContext.SessionWrapperDEFAULT_LOCALE, DEFAULT_URL, REPOSITORY_NAME_REQUEST_HEADER, REPOSITORY_NAME_REQUEST_PARAMETER, RESPONSE_HEADER_ENTITY_TYPE_KEY| Constructor and Description |
|---|
ThreadSafeRenderingContext() |
| Modifier and Type | Method and Description |
|---|---|
void |
addParameterListValues(String name,
List<?> 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 ThreadSafeRenderingContext()
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()
RenderingContextLocale.getLocale in interface RenderingContextpublic String getBaseUrl()
RenderingContextgetBaseUrl in interface RenderingContextpublic RenderingContext.SessionWrapper getSession(DocumentModel document)
RenderingContextCoreSession or try to create one.getSession in interface RenderingContextdocument - 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)
RenderingContextCoreSession to marshallers.
For example: a CoreSession from the request context.
setExistingSession in interface RenderingContextsession - The existing CoreSession which lifecycle is managed outside the marshalling context.public Set<String> getProperties()
RenderingContextgetProperties in interface RenderingContextpublic Set<String> getFetched(String entity)
RenderingContextgetFetched in interface RenderingContextentity - The type of the entity on which you want to fetch properties.public Set<String> getTranslated(String entity)
RenderingContextgetTranslated in interface RenderingContextentity - The type of the entity on which you want to fetch properties.public Set<String> getEnrichers(String entity)
RenderingContextgetEnrichers in interface RenderingContextentity - The type of the entity on which you want to activate enrichers.public WrappedContext wrap()
RenderingContextWrappedContextwrap in interface RenderingContextWrappedContextpublic <T> T getParameter(String name)
RenderingContextgetParameter in interface RenderingContextname - The parameter name.public boolean getBooleanParameter(String name)
RenderingContextgetBooleanParameter in interface RenderingContextpublic <T> List<T> getParameters(String name)
RenderingContextgetParameters in interface RenderingContextname - The parameter name.public Map<String,List<Object>> getAllParameters()
RenderingContextgetAllParameters in interface RenderingContextpublic void setParameterValues(String name, Object... values)
setParameterValues in interface RenderingContextRenderingContext.setParameterListValues(String, List)public void setParameterListValues(String name, List<Object> values)
RenderingContextsetParameterListValues in interface RenderingContextname - The parameter name.values - The parameter values.public void addParameterValues(String name, Object... values)
addParameterValues in interface RenderingContextRenderingContext.addParameterListValues(String, List)public void addParameterListValues(String name, List<?> values)
RenderingContextaddParameterListValues in interface RenderingContextname - The parameter name.values - The parameter values.Copyright © 2019 Nuxeo. All rights reserved.