Package: org.grails.web.servlet.view

## [Java] Class GroovyPageView

- org.grails.web.servlet.view.GroovyPageView

- A Spring View that renders Groovy Server Pages to the response. 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.

  Authors:
    Graeme Rocher
  See Also:
    getUrl()
    GroovyPagesTemplateEngine
    org.springframework.web.context.request.RequestContextHolder
  Since:
    0.4

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static java.lang.String` | `EXCEPTION_MODEL_KEY` |
    `protected GroovyPageTemplate` | `template` |
    `protected GroovyPagesTemplateEngine` | `templateEngine` |

  - Inherited fields
    Fields inherited from class | Fields
    --- | ---
    `class org.springframework.web.servlet.view.AbstractUrlBasedView` | `DEFAULT_CONTENT_TYPE, RESPONSE_STATUS_ATTRIBUTE, PATH_VARIABLES, SELECTED_CONTENT_TYPE`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `void` | `afterPropertiesSet()`
    `` | `static GroovyPagesException` | `createGroovyPageException(java.lang.Exception exception, GroovyPagesTemplateEngine engine, java.lang.String pageUrl)`
    `` | `protected GSPResponseWriter` | `createResponseWriter(GrailsWebRequest webRequest, javax.servlet.http.HttpServletResponse response)` Creates the Response Writer for the specified HttpServletResponse instance.
    `` | `groovy.text.Template` | `getTemplate()`
    `` | `protected void` | `handleException(java.lang.Exception exception, GroovyPagesTemplateEngine engine)` Performs exception handling by attempting to render the Errors view.
    `` | `protected void` | `initTemplate()`
    `` | `boolean` | `isExpired()`
    `` | `protected boolean` | `isUrlRequired()`
    `` | `protected void` | `renderTemplate(java.util.Map<java.lang.String, java.lang.Object> model, GrailsWebRequest webRequest, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)`
    `` | `void` | `rethrowRenderException(java.lang.Throwable ex, java.lang.String message)`
    `` | `void` | `setScriptSource(org.springframework.scripting.ScriptSource scriptSource)`
    `` | `void` | `setTemplate(groovy.text.Template template)`
    `` | `void` | `setTemplateEngine(GroovyPagesTemplateEngine templateEngine)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class AbstractGrailsView` | `createGrailsWebRequest, getTemplate, renderMergedOutputModel, renderTemplate, rethrowRenderException`
    `class org.springframework.web.servlet.view.AbstractUrlBasedView` | `org.springframework.web.servlet.view.AbstractUrlBasedView#checkResource(java.util.Locale), org.springframework.web.servlet.view.AbstractUrlBasedView#setUrl(java.lang.String), org.springframework.web.servlet.view.AbstractUrlBasedView#getUrl(), org.springframework.web.servlet.view.AbstractUrlBasedView#afterPropertiesSet(), org.springframework.web.servlet.view.AbstractUrlBasedView#toString(), org.springframework.web.servlet.view.AbstractUrlBasedView#getContentType(), org.springframework.web.servlet.view.AbstractUrlBasedView#setContentType(java.lang.String), org.springframework.web.servlet.view.AbstractUrlBasedView#setRequestContextAttribute(java.lang.String), org.springframework.web.servlet.view.AbstractUrlBasedView#getRequestContextAttribute(), org.springframework.web.servlet.view.AbstractUrlBasedView#setAttributes(java.util.Properties), org.springframework.web.servlet.view.AbstractUrlBasedView#setAttributesMap(java.util.Map), org.springframework.web.servlet.view.AbstractUrlBasedView#getAttributesMap(), org.springframework.web.servlet.view.AbstractUrlBasedView#setExposePathVariables(boolean), org.springframework.web.servlet.view.AbstractUrlBasedView#setExposeContextBeansAsAttributes(boolean), org.springframework.web.servlet.view.AbstractUrlBasedView#setExposedContextBeanNames([Ljava.lang.String;), org.springframework.web.servlet.view.AbstractUrlBasedView#getBeanName(), org.springframework.web.servlet.view.AbstractUrlBasedView#render(java.util.Map, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse), org.springframework.web.servlet.view.AbstractUrlBasedView#setAttributesCSV(java.lang.String), org.springframework.web.servlet.view.AbstractUrlBasedView#setBeanName(java.lang.String), org.springframework.web.servlet.view.AbstractUrlBasedView#addStaticAttribute(java.lang.String, java.lang.Object), org.springframework.web.servlet.view.AbstractUrlBasedView#getStaticAttributes(), org.springframework.web.servlet.view.AbstractUrlBasedView#isExposePathVariables(), org.springframework.web.servlet.view.AbstractUrlBasedView#setServletContext(javax.servlet.ServletContext), org.springframework.web.servlet.view.AbstractUrlBasedView#getApplicationContext(), org.springframework.web.servlet.view.AbstractUrlBasedView#setApplicationContext(org.springframework.context.ApplicationContext), org.springframework.web.servlet.view.AbstractUrlBasedView#wait(long, int), org.springframework.web.servlet.view.AbstractUrlBasedView#wait(long), org.springframework.web.servlet.view.AbstractUrlBasedView#wait(), org.springframework.web.servlet.view.AbstractUrlBasedView#equals(java.lang.Object), org.springframework.web.servlet.view.AbstractUrlBasedView#hashCode(), org.springframework.web.servlet.view.AbstractUrlBasedView#getClass(), org.springframework.web.servlet.view.AbstractUrlBasedView#notify(), org.springframework.web.servlet.view.AbstractUrlBasedView#notifyAll()`

- - ### Field Detail

    - #### public static final java.lang.String EXCEPTION_MODEL_KEY

    - #### protected GroovyPageTemplate template

    - #### protected GroovyPagesTemplateEngine templateEngine

  - ### Method Detail

    - #### @java.lang.Override public void afterPropertiesSet()

    - #### public static GroovyPagesException createGroovyPageException(java.lang.Exception exception, GroovyPagesTemplateEngine engine, java.lang.String pageUrl)

    - #### protected GSPResponseWriter createResponseWriter(GrailsWebRequest webRequest, javax.servlet.http.HttpServletResponse response)

      Creates the Response Writer for the specified HttpServletResponse instance.

      Parameters:
        `response` - The HttpServletResponse instance
      Returns:
        A response Writer

    - #### public groovy.text.Template getTemplate()

    - #### protected void handleException(java.lang.Exception exception, GroovyPagesTemplateEngine engine)

      Performs exception handling by attempting to render the Errors view.

      Parameters:
        `exception` - The exception that occured
        `engine` - The GSP engine

    - #### protected void initTemplate()

    - #### public boolean isExpired()

    - #### @java.lang.Override protected boolean isUrlRequired()

    - #### @java.lang.Override protected void renderTemplate(java.util.Map<java.lang.String, java.lang.Object> model, GrailsWebRequest webRequest, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)

    - #### public void rethrowRenderException(java.lang.Throwable ex, java.lang.String message)

    - #### public void setScriptSource(org.springframework.scripting.ScriptSource scriptSource)

    - #### public void setTemplate(groovy.text.Template template)

    - #### public void setTemplateEngine(GroovyPagesTemplateEngine templateEngine)