public class RenderService extends Object implements org.springframework.context.ApplicationContextAware
| Modifier and Type | Class and Description |
|---|---|
class |
RenderService.SubComponentData |
| Modifier and Type | Field and Description |
|---|---|
static String |
CONTEXT_VALUE_ERROR_COMPONENT_ID |
static String |
CONTEXT_VALUE_ERROR_DESCRIPTION |
static String |
CONTEXT_VALUE_ERROR_PAGE_ID |
static String |
CONTEXT_VALUE_ERROR_REGION_ID |
static String |
CONTEXT_VALUE_ERROR_REGION_SCOPE_ID |
static String |
CONTEXT_VALUE_ERROR_REGION_SOURCE_ID |
static String |
CONTEXT_VALUE_ERROR_TEMPLATE_ID |
static String |
CONTEXT_VALUE_ERROR_THROWABLE |
static String |
CONTEXT_VALUE_ERROR_TITLE |
static String |
CONTEXT_VALUE_STACKTRACE |
static String |
NEWLINE |
| Constructor and Description |
|---|
RenderService() |
| Modifier and Type | Method and Description |
|---|---|
String |
generateAnchorLink(String pageTypeId,
String pageId,
String objectId,
String formatId,
String target)
This method wraps the
generateLink method to place the link inside an HTML anchor tag which is then
returned. |
String |
generateLink(String pageTypeId,
String pageId,
String objectId,
String formatId)
Uses the
LinkBuilder created from the LinkBuilderFactory that should have been set as
a property of this class when instantiated as a Spring bean. |
String |
generateResourceURL(RequestContext renderContext,
ModelObject object,
String name,
String id,
String protocol,
String endpoint,
String objectId,
String payload) |
String |
getBeanName()
Returns the id given to this class when it is defined as a Spring bean.
|
Component |
getComponentBoundToRegion(RequestContext context,
String regionId,
String regionScopeId,
String regionSourceId)
Determines the component which is bound to the given region
If there is no component bound, then null is returned.
|
Chrome |
getRegionChrome(String regionId,
String chromeId)
Returns the Chrome instance to utilize while rendering the given
region on the given template.
|
Processor |
getRenditionProcessor(Renderable renderable)
Returns a rendition processor for a renderable in the default VIEW render mode
|
Processor |
getRenditionProcessor(Renderable renderable,
RenderMode renderMode)
Returns a rendition processor for a renderable in the given render mode
|
Processor |
getRenditionProcessorById(String id)
Returns a rendition processor for the given id (i.e.
|
SurfBug |
getSurfBug()
Returns the
SurfBug instance associated with the running application (which will be
obtained from the ModelObjectService if not previously obtained. |
protected void |
handleError(RequestContext context,
String errorTitle,
String errorDescription,
Throwable t)
This method sets up the
RequestContext and attempts to redirect the
request to the general error page. |
protected void |
handleRenderProblem(String targetId,
String errorPageId,
RequestContext context,
Throwable t)
This method is invoked whenever the
RenderService fails to render something. |
void |
processComponent(RequestContext context,
RenderFocus renderFocus,
Component component,
boolean chromeless)
Executes the processor for the given render focus on the given component instance.
|
void |
processRenderable(RequestContext context,
RenderFocus renderFocus,
ModelObject object,
Renderable renderable)
Executes the processor for the given focus on the provided renderable object.
|
void |
processTemplate(RequestContext context,
RenderFocus renderFocus,
TemplateInstance template)
Executes the processor for the given render focus on the given template instance.
|
void |
renderChromeInclude(RequestContext context,
ModelObject object)
Renders either a component or a region depending upon the value of
RENDER_TYPE key set in the
current RequestContext. |
void |
renderComponent(RequestContext context,
RenderFocus renderFocus,
Component component,
String chromeIdOverride,
boolean chromeless)
Entry point for the rendering a single identified component
with the default chrome.
|
void |
renderComponent(RequestContext context,
RenderFocus renderFocus,
String componentId,
String overrideChromeId,
boolean chromeless)
Entry point for the rendering a component with the given chrome.
|
boolean |
renderErrorHandlerPage(RequestContext context,
String errorHandlerPageId)
Renders a default error handler page
A system page can be configured to handle a fault state for the web framework.
|
void |
renderPage(RequestContext context,
RenderFocus renderFocus)
Entry point for the rendering of the current page as provided
by the request context.
|
void |
renderRegion(RequestContext context,
RenderFocus renderFocus,
String templateId,
String regionId,
String regionScopeId,
String overrideChromeId,
boolean chromeless)
Entry point for the rendering a region of a given template
|
void |
renderRegionComponents(RequestContext context,
ModelObject object,
boolean chromeless)
Renders the components of the region described by the render context
This method is generally called from the region include tag.
|
void |
renderSubComponent(SubComponent subComponent,
RequestContext context,
RenderFocus renderFocus)
Renders the supplied
SubComponent. |
void |
renderSurfBugInclude(RequestContext context)
Convenience method provided for both the "surfbugInclude" FreeMarker directive and
JSP tag to use.
|
boolean |
renderSystemPage(RequestContext context,
String systemPageId)
Renders a default system page
A system container is a page fragment that is rendered
as a container of other elements like components.
|
void |
renderTemplate(RequestContext context,
RenderFocus renderFocus)
Entry point for the rendering of the current content item as
provided by the request context.
|
String |
renderTemplateHeaderAsString(RequestContext context,
ModelObject object)
Generates text to be inserted into template markup head for a given
renderer context.
|
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
void |
setBeanName(String name)
This method is required to implement the the
BeanNameAware interface and will be
invoked by the Spring framework to set the configured name of this class when defined as a Spring
bean. |
void |
setChromeRenderer(ChromeRenderer chromeRenderer) |
void |
setComponentRenderer(ComponentRenderer componentRenderer) |
void |
setDojoDependencyHandler(DojoDependencyHandler dojoDependencyHandler) |
void |
setLinkBuilderFactory(LinkBuilderFactory linkBuilderFactory)
This method is provided to allow the Spring framework to inject a
LinkBuilderFactory
into this class when it is instantiated as a Spring bean. |
void |
setModelObjectService(ModelObjectService modelObjectService) |
void |
setPageRenderer(PageRenderer pageRenderer) |
void |
setRegionRenderer(RegionRenderer regionRenderer) |
void |
setResourceService(ResourceService resourceService)
This setter method is provided so that Spring can inject a
ResourceService into this bean. |
void |
setTemplateRenderer(TemplateInstanceRenderer templateRenderer) |
void |
setWebFrameworkConfiguration(WebFrameworkConfigElement webFrameworkConfiguration) |
void |
updateStyleSheetImports(RequestContext context,
String href)
Adds to the (or creates a new)
LinkedList of CSS style sheet URLs stored as the
WebFrameworkConstants.STYLESHEET_RENDER_CONTEXT_NAME attribute in the supplied
RequestContext. |
public static final String CONTEXT_VALUE_ERROR_THROWABLE
public static final String CONTEXT_VALUE_ERROR_PAGE_ID
public static final String CONTEXT_VALUE_ERROR_TEMPLATE_ID
public static final String CONTEXT_VALUE_ERROR_REGION_ID
public static final String CONTEXT_VALUE_ERROR_REGION_SCOPE_ID
public static final String CONTEXT_VALUE_ERROR_REGION_SOURCE_ID
public static final String CONTEXT_VALUE_ERROR_COMPONENT_ID
public static final String CONTEXT_VALUE_ERROR_TITLE
public static final String CONTEXT_VALUE_ERROR_DESCRIPTION
public static final String CONTEXT_VALUE_STACKTRACE
public static final String NEWLINE
public Processor getRenditionProcessorById(String id)
id - Stringpublic Processor getRenditionProcessor(Renderable renderable)
renderable - Renderablepublic Processor getRenditionProcessor(Renderable renderable, RenderMode renderMode)
renderable - RenderablerenderMode - RenderModepublic void processRenderable(RequestContext context, RenderFocus renderFocus, ModelObject object, Renderable renderable) throws RendererExecutionException
context - RequestContextrenderFocus - RenderFocusobject - ModelObjectrenderable - RenderableRendererExecutionExceptionpublic SurfBug getSurfBug()
Returns the SurfBug instance associated with the running application (which will be
obtained from the ModelObjectService if not previously obtained.
SurfBug associated with the running application.public void processComponent(RequestContext context, RenderFocus renderFocus, Component component, boolean chromeless) throws RendererExecutionException
context - RequestContextrenderFocus - RenderFocuscomponent - Componentchromeless - booleanRendererExecutionExceptionpublic void renderSubComponent(SubComponent subComponent, RequestContext context, RenderFocus renderFocus)
Renders the supplied SubComponent.
subComponent - The SubComponent to render.context - The current RequestContextrenderFocus - The current focus of the request.public void processTemplate(RequestContext context, RenderFocus renderFocus, TemplateInstance template) throws RendererExecutionException
context - RequestContextrenderFocus - RenderFocustemplate - TemplateInstanceRendererExecutionExceptionpublic void renderPage(RequestContext context, RenderFocus renderFocus)
context - the render contextpublic void renderTemplate(RequestContext context, RenderFocus renderFocus)
context - the render contextrenderFocus - the render focuspublic void renderRegion(RequestContext context, RenderFocus renderFocus, String templateId, String regionId, String regionScopeId, String overrideChromeId, boolean chromeless)
context - RequestContextrenderFocus - RenderFocustemplateId - StringregionId - StringregionScopeId - StringoverrideChromeId - Stringchromeless - booleanpublic void renderRegionComponents(RequestContext context, ModelObject object, boolean chromeless) throws RendererExecutionException
context - RequestContextobject - ModelObjectchromeless - booleanRendererExecutionExceptionpublic void renderComponent(RequestContext context, RenderFocus renderFocus, Component component, String chromeIdOverride, boolean chromeless)
context - RequestContextrenderFocus - RenderFocuscomponent - ComponentchromeIdOverride - Stringchromeless - booleanpublic void renderComponent(RequestContext context, RenderFocus renderFocus, String componentId, String overrideChromeId, boolean chromeless)
context - RequestContextrenderFocus - RenderFocuscomponentId - StringoverrideChromeId - Stringchromeless - booleanpublic Chrome getRegionChrome(String regionId, String chromeId)
public Component getComponentBoundToRegion(RequestContext context, String regionId, String regionScopeId, String regionSourceId)
context - RequestContextregionId - StringregionScopeId - StringregionSourceId - Stringpublic boolean renderErrorHandlerPage(RequestContext context, String errorHandlerPageId) throws RendererExecutionException
context - RequestContexterrorHandlerPageId - StringRendererExecutionExceptionpublic boolean renderSystemPage(RequestContext context, String systemPageId) throws RendererExecutionException
context - RequestContextsystemPageId - StringRendererExecutionExceptionpublic String renderTemplateHeaderAsString(RequestContext context, ModelObject object) throws RendererExecutionException, UnsupportedEncodingException
context - RequestContextobject - ModelObjectRendererExecutionExceptionUnsupportedEncodingExceptionpublic void setResourceService(ResourceService resourceService)
This setter method is provided so that Spring can inject a ResourceService into this bean.
resourceService - ResourceServicepublic void setLinkBuilderFactory(LinkBuilderFactory linkBuilderFactory)
This method is provided to allow the Spring framework to inject a LinkBuilderFactory
into this class when it is instantiated as a Spring bean. As well as setting the LinkBuilderFactory
it will also use the factory to create a new LinkBuilder.
linkBuilderFactory - LinkBuilderFactorypublic void renderSurfBugInclude(RequestContext context) throws RendererExecutionException
Convenience method provided for both the "surfbugInclude" FreeMarker directive and
JSP tag to use. Currently this only defers control to the processComponent
method but in the future may be required to carry out additional processing
context - RequestContextRendererExecutionExceptionpublic void renderChromeInclude(RequestContext context, ModelObject object) throws RequestDispatchException
Renders either a component or a region depending upon the value of RENDER_TYPE key set in the
current RequestContext. This means that either the <componentInclude> or <regionInclude>
tag can be incorrectly used within the chrome implementation without errors occurring.
context - RequestContextobject - ModelObjectRequestDispatchExceptionpublic String generateAnchorLink(String pageTypeId, String pageId, String objectId, String formatId, String target)
This method wraps the generateLink method to place the link inside an HTML anchor tag which is then
returned. The anchor tag can optionally include a "target" property if one is provided.
pageTypeId - StringpageId - StringobjectId - StringformatId - Stringtarget - Stringpublic String generateLink(String pageTypeId, String pageId, String objectId, String formatId)
Uses the LinkBuilder created from the LinkBuilderFactory that should have been set as
a property of this class when instantiated as a Spring bean.
pageTypeId - StringpageId - StringobjectId - StringformatId - Stringpublic String generateResourceURL(RequestContext renderContext, ModelObject object, String name, String id, String protocol, String endpoint, String objectId, String payload)
renderContext - RequestContextname - ModelObjectid - Stringprotocol - Stringendpoint - StringobjectId - Stringpayload - Stringpublic void updateStyleSheetImports(RequestContext context, String href)
Adds to the (or creates a new) LinkedList of CSS style sheet URLs stored as the
WebFrameworkConstants.STYLESHEET_RENDER_CONTEXT_NAME attribute in the supplied
RequestContext.
context - RequestContexthref - Stringprotected void handleError(RequestContext context, String errorTitle, String errorDescription, Throwable t) throws RequestDispatchException
This method sets up the RequestContext and attempts to redirect the
request to the general error page. It only sets the context with non-null arguments.
Ideally, a title, description and Throwable instance should be supplied
to provide as much debug information as possible. The description should be as verbose
as possible and can contain HTML elements to format the output if required.
Currently the output is not translated. In the future this should be updated to accept NLS keys to make the error page consumable in other languages.
context - The context to add the diagnostic information to.errorTitle - The title of the error (a short explanation of what went wrong!)errorDescription - A verbose description of what has happened and what could be
done to address the issue.t - A Throwable instance from which to obtain a stack trace to
display.RequestDispatchExceptionprotected void handleRenderProblem(String targetId, String errorPageId, RequestContext context, Throwable t)
This method is invoked whenever the RenderService fails to render something. It
renders the requested error page (hopefully!) indicating the cause of the problem.
targetId - The id of the page/template/region/component that could not be renderederrorPageId - The target error page to rendercontext - The current RequestContextpublic void setModelObjectService(ModelObjectService modelObjectService)
public void setWebFrameworkConfiguration(WebFrameworkConfigElement webFrameworkConfiguration)
public void setPageRenderer(PageRenderer pageRenderer)
public void setTemplateRenderer(TemplateInstanceRenderer templateRenderer)
public void setRegionRenderer(RegionRenderer regionRenderer)
public void setComponentRenderer(ComponentRenderer componentRenderer)
public void setChromeRenderer(ChromeRenderer chromeRenderer)
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
throws org.springframework.beans.BeansException
setApplicationContext in interface org.springframework.context.ApplicationContextAwareorg.springframework.beans.BeansExceptionpublic void setBeanName(String name)
This method is required to implement the the BeanNameAware interface and will be
invoked by the Spring framework to set the configured name of this class when defined as a Spring
bean.
public String getBeanName()
Returns the id given to this class when it is defined as a Spring bean. If this class has not bean instantiated by the Spring framework then this will return null.
public void setDojoDependencyHandler(DojoDependencyHandler dojoDependencyHandler)
Copyright © 2005–2016 Alfresco Software. All rights reserved.