Class ThreadSafeRenderingContext
java.lang.Object
org.nuxeo.ecm.core.io.registry.context.ThreadSafeRenderingContext
- All Implemented Interfaces:
RenderingContext
- Since:
- 7.2
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.nuxeo.ecm.core.io.registry.context.RenderingContext
RenderingContext.CtxBuilder, RenderingContext.SessionWrapper
-
Field Summary
Fields inherited from interface org.nuxeo.ecm.core.io.registry.context.RenderingContext
DEFAULT_LOCALE, DEFAULT_URL, REPOSITORY_NAME_REQUEST_HEADER, REPOSITORY_NAME_REQUEST_PARAMETER, RESPONSE_HEADER_ENTITY_TYPE_KEY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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 thisRenderingContext
to use the givenRenderingContext
in the current thread.Get all parameter in this context except wrapped parameters.Gets the current base url.boolean
getBooleanParameter
(String name) Get the underlyingRenderingContext
.getEnrichers
(String entity) Get all enrichers to activate on the given entity type.getFetched
(String entity) Get all properties to fetch for a given entity type.Gets the requestedLocale
.<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.Get all document properties.getSession
(DocumentModel document) Gets the currentCoreSession
or try to create one.getTranslated
(String entity) Get all properties to translate for a given entity type.void
setExistingSession
(CoreSession session) Provides aCoreSession
to marshallers.void
setParameterListValues
(String name, List<Object> values) Push values in the context with a given name.void
setParameterValues
(String name, Object... values) wrap()
seeWrappedContext
-
Constructor Details
-
ThreadSafeRenderingContext
public ThreadSafeRenderingContext()
-
-
Method Details
-
configureThread
Configure thisRenderingContext
to use the givenRenderingContext
in the current thread.- Parameters:
delegates
- The underlyingRenderingContext
.- Since:
- 7.2
-
getDelegate
Get the underlyingRenderingContext
.- Returns:
- The underlying
RenderingContext
. - Since:
- 7.2
-
getLocale
Description copied from interface:RenderingContext
Gets the requestedLocale
.- Specified by:
getLocale
in interfaceRenderingContext
-
getBaseUrl
Description copied from interface:RenderingContext
Gets the current base url.- Specified by:
getBaseUrl
in interfaceRenderingContext
-
getSession
Description copied from interface:RenderingContext
Gets the currentCoreSession
or try to create one.- Specified by:
getSession
in interfaceRenderingContext
- Parameters:
document
- may be null, if present, this method search for a session in the document.- Returns:
- The current
CoreSession
if it exists. null otherwise.
-
setExistingSession
Description copied from interface:RenderingContext
Provides aCoreSession
to marshallers.For example: a
CoreSession
from the request context.- Specified by:
setExistingSession
in interfaceRenderingContext
- Parameters:
session
- The existingCoreSession
which lifecycle is managed outside the marshalling context.
-
getProperties
Description copied from interface:RenderingContext
Get all document properties. This will aggregate all values from parameters "properties", "X-NXproperties" and "X-NXDocumentProperties". This supports value separated by comma.- Specified by:
getProperties
in interfaceRenderingContext
- Returns:
- All document properties.
-
getFetched
Description copied from interface:RenderingContext
Get all properties to fetch for a given entity type. This will aggregate all values from parameters "fetch.entity" and "X-NXfetch.entity". This supports value separated by comma.- Specified by:
getFetched
in interfaceRenderingContext
- Parameters:
entity
- The type of the entity on which you want to fetch properties.- Returns:
- All properties to fetch.
-
getTranslated
Description copied from interface:RenderingContext
Get all properties to translate for a given entity type. This will aggregate all values from parameters "translate.entity" and "X-NXtranslate.entity". This supports value separated by comma.- Specified by:
getTranslated
in interfaceRenderingContext
- Parameters:
entity
- The type of the entity on which you want to fetch properties.- Returns:
- All properties to fetch.
-
getEnrichers
Description copied from interface:RenderingContext
Get all enrichers to activate on the given entity type. This will aggregate all values from parameters "enrichers.entity", "X-NXenrichers.entity" and "X-NXContext-Category". This supports value separated by comma.- Specified by:
getEnrichers
in interfaceRenderingContext
- Parameters:
entity
- The type of the entity on which you want to activate enrichers.- Returns:
- All enrichers to activate.
-
wrap
Description copied from interface:RenderingContext
seeWrappedContext
- Specified by:
wrap
in interfaceRenderingContext
- Returns:
- A new
WrappedContext
-
getParameter
Description copied from interface:RenderingContext
Get the casted parameter value for a given name. If multiple are available, the first found is returned.- Specified by:
getParameter
in interfaceRenderingContext
- Parameters:
name
- The parameter name.- Returns:
- The first parameter value, null if no parameter are availble.
-
getBooleanParameter
Description copied from interface:RenderingContext
- Specified by:
getBooleanParameter
in interfaceRenderingContext
- Returns:
- true is the parameter exists and if it's Boolean.TRUE or "true", false otherwise.
-
getParameters
Description copied from interface:RenderingContext
Get the casted parameter values for a given name.- Specified by:
getParameters
in interfaceRenderingContext
- Parameters:
name
- The parameter name.- Returns:
- The parameter values.
-
getAllParameters
Description copied from interface:RenderingContext
Get all parameter in this context except wrapped parameters.- Specified by:
getAllParameters
in interfaceRenderingContext
- Returns:
- All parameter's names and their values.
-
setParameterValues
- Specified by:
setParameterValues
in interfaceRenderingContext
- See Also:
-
setParameterListValues
Description copied from interface:RenderingContext
Push values in the context with a given name. Please note that this method remove any value for the given name.- Specified by:
setParameterListValues
in interfaceRenderingContext
- Parameters:
name
- The parameter name.values
- The parameter values.
-
addParameterValues
- Specified by:
addParameterValues
in interfaceRenderingContext
- See Also:
-
addParameterListValues
Description copied from interface:RenderingContext
Add values in the context with a given name. Please note that this method keep current values for the given name.- Specified by:
addParameterListValues
in interfaceRenderingContext
- Parameters:
name
- The parameter name.values
- The parameter values.
-