org.springframework.extensions.surf.render
Class RenderService

java.lang.Object
  extended by org.springframework.extensions.surf.render.RenderService
All Implemented Interfaces:
org.springframework.context.ApplicationContextAware

public class RenderService
extends Object
implements org.springframework.context.ApplicationContextAware

Web Framework Render Service.

Author:
muzquiano

Field Summary
static String NEWLINE
           
 
Constructor Summary
RenderService()
           
 
Method Summary
 org.springframework.context.ApplicationContext getApplicationContext()
          Gets the application context.
 Component getComponentBoundToRegion(RenderContext 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 getComponentChrome(RenderContext context, Component component, String chromeId)
          Returns the Chrome instance to utilize while rendering the given component.
 Processor getProcessor(Renderable renderable)
          Returns a processor for a renderable in the default VIEW render mode
 Processor getProcessor(Renderable renderable, RenderMode renderMode)
          Returns a processor for a renderable in the given render mode
 Processor getProcessorById(String id)
          Returns a processor for the given id (i.e.
 Chrome getRegionChrome(RenderContext context, TemplateInstance template, String regionId, String chromeId)
          Returns the Chrome instance to utilize while rendering the given region on the given template.
 RenderContextProvider getRenderContextProvider()
          Returns the render context provider instance
 Renderer getRenderer(ModelObject modelObject)
          Gets a renderer for the given model object type (i.e.
 Renderer getRenderer(RendererType rendererType)
          Gets a renderer for the given renderer type (i.e.
 Renderer getRenderer(String id)
          Gets a renderer for the given id
 WebFrameworkServiceRegistry getServiceRegistry()
          Gets the service registry.
 WebFrameworkConfigElement getWebFrameworkConfiguration()
          Gets the web framework configuration.
 void mergeRenderContext(RenderContext renderContext, ModelObject modelObject)
          Merges a model object into the given render context.
 void processComponent(RenderContext context, RenderFocus renderFocus, Component component)
          Executes the processor for the given render focus on the given component instance.
 void processRenderable(RenderContext context, RenderFocus renderFocus, Renderable renderable)
          Executes the processor for the given focus on the provided renderable object.
 void processTemplate(RenderContext context, RenderFocus renderFocus, TemplateInstance template)
          Executes the processor for the given render focus on the given template instance.
 RenderContext provideRenderContext(RenderContext renderContext)
          Provides a new render context instance which inherits properties from the given render context instance
 RenderContext provideRenderContext(RenderContext renderContext, ModelObject modelObject)
          Provides a new render context instance which inherits properties from the given render context instance The given model object will be bound to the render context.
 RenderContext provideRenderContext(RequestContext context, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Provides a new render context bound to the given model object This will use the VIEW render mode
 RenderContext provideRenderContext(RequestContext context, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, RenderMode renderMode)
          Provides a new render context bound to the given model object
 void releaseRenderContext(RenderContext renderContext)
          Releases the given render context
 void renderComponent(RenderContext parentContext, RenderFocus renderFocus, String componentId)
          Entry point for the rendering a single identified component with the default chrome.
 void renderComponent(RenderContext parentContext, RenderFocus renderFocus, String componentId, String overrideChromeId)
          Entry point for the rendering a component with the given chrome.
 void renderContent(RenderContext parentContext, RenderFocus renderFocus)
          Entry point for the rendering of the current content item as provided by the request context.
 boolean renderErrorHandlerPage(RenderContext parentContext, String errorHandlerPageId)
          Renders a default error handler page A system page can be configured to handle a fault state for the web framework.
 void renderJspPage(RenderContext parentContext, String dispatchPath)
          Entry point for the rendering of a JSP page.
 void renderModelObject(RenderContext renderContext)
          Renders the ALL focus for the given model object
 void renderModelObject(RenderContext renderContext, RenderFocus renderFocus)
          Renders the specific focus for the given model object
 void renderPage(RenderContext parentContext, RenderFocus renderFocus)
          Entry point for the rendering of the current page as provided by the request context.
 void renderRawComponent(RenderContext parentContext, RenderFocus renderFocus, Component component)
           
 void renderRawComponent(RenderContext parentContext, RenderFocus renderFocus, String componentId)
           
 void renderRegion(RenderContext parentContext, RenderFocus renderFocus, String templateId, String regionId, String regionScopeId, String overrideChromeId)
          Entry point for the rendering a region of a given template
 void renderRegionComponents(RenderContext parentContext)
          Renders the components of the region described by the render context This method is generally called from the region include tag.
 boolean renderSystemPage(RenderContext parentContext, 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.
 String renderTemplateHeaderAsString(RenderContext parentContext)
          Generates text to be inserted into template markup head for a given renderer context.
 void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
           
 void setServiceRegistry(WebFrameworkServiceRegistry webFrameworkServiceRegistry)
          Sets the service registry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NEWLINE

public static final String NEWLINE
See Also:
Constant Field Values
Constructor Detail

RenderService

public RenderService()
Method Detail

setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
                           throws org.springframework.beans.BeansException
Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware
Throws:
org.springframework.beans.BeansException

getApplicationContext

public org.springframework.context.ApplicationContext getApplicationContext()
Gets the application context.

Returns:
the application context

setServiceRegistry

public void setServiceRegistry(WebFrameworkServiceRegistry webFrameworkServiceRegistry)
Sets the service registry.

Parameters:
webFrameworkServiceRegistry - the new service registry

getServiceRegistry

public WebFrameworkServiceRegistry getServiceRegistry()
Gets the service registry.

Returns:
the service registry

getWebFrameworkConfiguration

public WebFrameworkConfigElement getWebFrameworkConfiguration()
Gets the web framework configuration.

Returns:
the web framework configuration

getRenderer

public Renderer getRenderer(RendererType rendererType)
Gets a renderer for the given renderer type (i.e. page, template, component, etc)

Parameters:
rendererType -
Returns:
renderer

getRenderer

public Renderer getRenderer(ModelObject modelObject)
Gets a renderer for the given model object type (i.e. page, template, component, etc)

Parameters:
modelObject -
Returns:
renderer

getRenderer

public Renderer getRenderer(String id)
Gets a renderer for the given id

Parameters:
id -
Returns:
renderer

getProcessorById

public Processor getProcessorById(String id)
Returns a processor for the given id (i.e. jsp, webscript, etc)

Parameters:
id -
Returns:
processor

getProcessor

public Processor getProcessor(Renderable renderable)
Returns a processor for a renderable in the default VIEW render mode

Parameters:
renderable -
Returns:

getProcessor

public Processor getProcessor(Renderable renderable,
                              RenderMode renderMode)
Returns a processor for a renderable in the given render mode

Parameters:
renderable -
renderMode -
Returns:

getRenderContextProvider

public RenderContextProvider getRenderContextProvider()
Returns the render context provider instance

Returns:
render context provider

provideRenderContext

public RenderContext provideRenderContext(RequestContext context,
                                          javax.servlet.http.HttpServletRequest request,
                                          javax.servlet.http.HttpServletResponse response)
Provides a new render context bound to the given model object This will use the VIEW render mode

Parameters:
context -
request -
response -
Returns:
render context

provideRenderContext

public RenderContext provideRenderContext(RequestContext context,
                                          javax.servlet.http.HttpServletRequest request,
                                          javax.servlet.http.HttpServletResponse response,
                                          RenderMode renderMode)
Provides a new render context bound to the given model object

Parameters:
context -
request -
response -
renderMode -
Returns:
render context

provideRenderContext

public RenderContext provideRenderContext(RenderContext renderContext)
Provides a new render context instance which inherits properties from the given render context instance

Parameters:
renderContext -
Returns:

provideRenderContext

public RenderContext provideRenderContext(RenderContext renderContext,
                                          ModelObject modelObject)
Provides a new render context instance which inherits properties from the given render context instance The given model object will be bound to the render context.

Parameters:
renderContext -
modelObject -
Returns:

mergeRenderContext

public void mergeRenderContext(RenderContext renderContext,
                               ModelObject modelObject)
Merges a model object into the given render context.

Parameters:
renderContext -
modelObject -

releaseRenderContext

public void releaseRenderContext(RenderContext renderContext)
Releases the given render context

Parameters:
renderContext -

renderModelObject

public void renderModelObject(RenderContext renderContext)
                       throws RendererExecutionException
Renders the ALL focus for the given model object

Parameters:
renderContext -
Throws:
RendererExecutionException

renderModelObject

public void renderModelObject(RenderContext renderContext,
                              RenderFocus renderFocus)
                       throws RendererExecutionException
Renders the specific focus for the given model object

Parameters:
renderContext -
renderFocus -
Throws:
RendererExecutionException

processRenderable

public void processRenderable(RenderContext context,
                              RenderFocus renderFocus,
                              Renderable renderable)
                       throws RendererExecutionException
Executes the processor for the given focus on the provided renderable object.

Parameters:
context -
renderFocus -
renderable -
Throws:
RendererExecutionException

processComponent

public void processComponent(RenderContext context,
                             RenderFocus renderFocus,
                             Component component)
                      throws RendererExecutionException
Executes the processor for the given render focus on the given component instance.

Parameters:
context -
renderFocus -
component -
Throws:
RendererExecutionException

processTemplate

public void processTemplate(RenderContext context,
                            RenderFocus renderFocus,
                            TemplateInstance template)
                     throws RendererExecutionException
Executes the processor for the given render focus on the given template instance.

Parameters:
context -
renderFocus -
template -
Throws:
RendererExecutionException

renderJspPage

public void renderJspPage(RenderContext parentContext,
                          String dispatchPath)
                   throws JspRenderException
Entry point for the rendering of a JSP page.

Parameters:
parentContext - the render context
dispatchPath -
Throws:
JspRenderException

renderPage

public void renderPage(RenderContext parentContext,
                       RenderFocus renderFocus)
                throws RendererExecutionException
Entry point for the rendering of the current page as provided by the request context.

Parameters:
parentContext - the render context
Throws:
RendererExecutionException

renderContent

public void renderContent(RenderContext parentContext,
                          RenderFocus renderFocus)
                   throws RendererExecutionException
Entry point for the rendering of the current content item as provided by the request context.

Parameters:
parentContext - the render context
Throws:
RendererExecutionException

renderRegion

public void renderRegion(RenderContext parentContext,
                         RenderFocus renderFocus,
                         String templateId,
                         String regionId,
                         String regionScopeId,
                         String overrideChromeId)
                  throws RendererExecutionException
Entry point for the rendering a region of a given template

Parameters:
parentContext -
renderFocus -
templateId -
regionId -
regionScopeId -
overrideChromeId -
Throws:
RendererExecutionException

renderRegionComponents

public void renderRegionComponents(RenderContext parentContext)
                            throws RendererExecutionException
Renders the components of the region described by the render context This method is generally called from the region include tag.

Parameters:
parentContext -
Throws:
RendererExecutionException

renderComponent

public void renderComponent(RenderContext parentContext,
                            RenderFocus renderFocus,
                            String componentId)
                     throws RendererExecutionException
Entry point for the rendering a single identified component with the default chrome.

Parameters:
parentContext -
renderFocus -
componentId -
Throws:
RendererExecutionException

renderComponent

public void renderComponent(RenderContext parentContext,
                            RenderFocus renderFocus,
                            String componentId,
                            String overrideChromeId)
                     throws RendererExecutionException
Entry point for the rendering a component with the given chrome.

Parameters:
parentContext -
renderFocus -
componentId -
overrideChromeId -
Throws:
RendererExecutionException

renderRawComponent

public void renderRawComponent(RenderContext parentContext,
                               RenderFocus renderFocus,
                               String componentId)
                        throws RendererExecutionException
Throws:
RendererExecutionException

renderRawComponent

public void renderRawComponent(RenderContext parentContext,
                               RenderFocus renderFocus,
                               Component component)
                        throws RendererExecutionException
Throws:
RendererExecutionException

getRegionChrome

public Chrome getRegionChrome(RenderContext context,
                              TemplateInstance template,
                              String regionId,
                              String chromeId)
Returns the Chrome instance to utilize while rendering the given region on the given template.


getComponentChrome

public Chrome getComponentChrome(RenderContext context,
                                 Component component,
                                 String chromeId)
Returns the Chrome instance to utilize while rendering the given component.


getComponentBoundToRegion

public Component getComponentBoundToRegion(RenderContext 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.

Parameters:
context -
regionId -
regionScopeId -
regionSourceId -
Returns:
the component

renderErrorHandlerPage

public boolean renderErrorHandlerPage(RenderContext parentContext,
                                      String errorHandlerPageId)
                               throws RendererExecutionException
Renders a default error handler page A system page can be configured to handle a fault state for the web framework. Several fault states exist and a system page provides a way for default presentation to be rendered back.

Parameters:
parentContext -
errorHandlerPageId -
defaultErrorHandlerPageRenderer -
Returns:
whether an error handler page could handle the fault
Throws:
RendererExecutionException

renderSystemPage

public boolean renderSystemPage(RenderContext parentContext,
                                String systemPageId)
                         throws RendererExecutionException
Renders a default system page A system container is a page fragment that is rendered as a container of other elements like components.

Parameters:
context -
systemPageId -
Throws:
RendererExecutionException

renderTemplateHeaderAsString

public String renderTemplateHeaderAsString(RenderContext parentContext)
                                    throws RendererExecutionException,
                                           UnsupportedEncodingException
Generates text to be inserted into template markup head for a given renderer context. The renderer context must describe a template.

Parameters:
rendererContext -
Returns:
head tags render output
Throws:
RendererExecutionException
UnsupportedEncodingException


Copyright © 2009 SpringSource, Inc. All Rights Reserved.