org.codehaus.groovy.grails.web.servlet.view
Class GroovyPageView
java.lang.Object
org.springframework.context.support.ApplicationObjectSupport
org.springframework.web.context.support.WebApplicationObjectSupport
org.springframework.web.servlet.view.AbstractView
org.springframework.web.servlet.view.AbstractUrlBasedView
org.codehaus.groovy.grails.web.servlet.view.GroovyPageView
- All Implemented Interfaces:
- BeanNameAware, InitializingBean, ApplicationContextAware, ServletContextAware, View
- Direct Known Subclasses:
- ScaffoldedGroovyPageView
public class GroovyPageView
- extends AbstractUrlBasedView
A Spring View that renders Groovy Server Pages to the reponse. It requires an instance
of GroovyPagesTemplateEngine to be set and will render to view returned by the getUrl()
method of AbstractUrlBasedView
This view also requires an instance of GrailsWebRequest to be bound to the currently
executing Thread using Spring's RequestContextHolder. This can be done with by adding
the GrailsWebRequestFilter.
- Since:
- 0.4
Created: Feb 27, 2007
Time: 8:25:10 AM
- Author:
- Graeme Rocher
- See Also:
AbstractUrlBasedView.getUrl()
,
GroovyPagesTemplateEngine
,
GrailsWebRequestFilter
,
RequestContextHolder
Method Summary |
protected Writer |
createResponseWriter(HttpServletResponse response)
Creates the Response Writer for the specified HttpServletResponse instance |
protected void |
handleException(Exception exception,
Writer out,
GroovyPagesTemplateEngine engine,
HttpServletRequest request,
HttpServletResponse response)
Performs exception handling by attempting to render the Errors view |
protected void |
renderMergedOutputModel(Map model,
HttpServletRequest request,
HttpServletResponse response)
Delegates to renderMergedOutputModel(..) |
protected void |
renderWithTemplateEngine(GroovyPagesTemplateEngine templateEngine,
Map model,
HttpServletResponse response,
HttpServletRequest request)
Renders a page with the specified TemplateEngine, mode and response |
void |
setTemplateEngine(GroovyPagesTemplateEngine templateEngine)
|
Methods inherited from class org.springframework.web.servlet.view.AbstractView |
addStaticAttribute, createRequestContext, createTemporaryOutputStream, exposeModelAsRequestAttributes, generatesDownloadContent, getAttributesMap, getBeanName, getContentType, getRequestContextAttribute, getStaticAttributes, prepareResponse, render, setAttributes, setAttributesCSV, setAttributesMap, setBeanName, setContentType, setRequestContextAttribute, writeToResponse |
EXCEPTION_MODEL_KEY
public static final String EXCEPTION_MODEL_KEY
- See Also:
- Constant Field Values
GroovyPageView
public GroovyPageView()
renderMergedOutputModel
protected final void renderMergedOutputModel(Map model,
HttpServletRequest request,
HttpServletResponse response)
throws Exception
- Delegates to renderMergedOutputModel(..)
- Specified by:
renderMergedOutputModel
in class AbstractView
- Parameters:
model
- The view modelrequest
- The HttpServletRequestresponse
- The HttpServletResponse
- Throws:
Exception
- When an error occurs rendering the view- See Also:
renderMergedOutputModel(java.util.Map, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
renderWithTemplateEngine
protected void renderWithTemplateEngine(GroovyPagesTemplateEngine templateEngine,
Map model,
HttpServletResponse response,
HttpServletRequest request)
throws IOException
- Renders a page with the specified TemplateEngine, mode and response
- Parameters:
templateEngine
- The TemplateEngine to usemodel
- The model to useresponse
- The HttpServletResponse instancerequest
- The HttpServletRequest
- Throws:
IOException
- Thrown when an error occurs writing the response
handleException
protected void handleException(Exception exception,
Writer out,
GroovyPagesTemplateEngine engine,
HttpServletRequest request,
HttpServletResponse response)
- Performs exception handling by attempting to render the Errors view
- Parameters:
exception
- The exception that occuredout
- The Writerengine
- The GSP engine
createResponseWriter
protected Writer createResponseWriter(HttpServletResponse response)
- Creates the Response Writer for the specified HttpServletResponse instance
- Parameters:
response
- The HttpServletResponse instance
- Returns:
- A response Writer
setTemplateEngine
public void setTemplateEngine(GroovyPagesTemplateEngine templateEngine)
Copyright (c) 2005-2009 The Grails project