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
Methods inherited from class org.springframework.web.servlet.view.AbstractView |
addStaticAttribute, createRequestContext, exposeModelAsRequestAttributes, getAttributesMap, getBeanName, getContentType, getRequestContextAttribute, getStaticAttributes, render, setAttributes, setAttributesCSV, setAttributesMap, setBeanName, setContentType, setRequestContextAttribute |
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)
- 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
Copyright (c) 2005-2006 The Grails project