Groovy Documentation

org.grails.plugin.vaadin.gsp
[Groovy] Class GspResourcePageRenderer

java.lang.Object
  org.grails.plugin.vaadin.gsp.GspResourcePageRenderer
All Implemented Interfaces:
org.springframework.context.ApplicationContextAware, org.springframework.web.context.ServletContextAware

class GspResourcePageRenderer

Similar to grails.gsp.PageRender, which is included in grails 2.0.x. However, it includes a few enhancements:

  1. The original PageRenderer is restricted to rendering Views. I.e. the GSPs must exist in the views directory. This class allows specifying a GSP as a 'resource' - i.e. it can be located outside the views directory.
  2. The page context is correctly set in the mock request object. With the original grails PageRenderer in Grails 2.0.1, this is currently missing. Therefore any calls to resource(dir:'/') in a GSP may not render the path correctly.
  3. Other request attributes (e.g. session, remoteHost, cookies) that are generally required for GSP rendering are also supported.
Authors:
Graeme Rocher / Francis McKenzie


Field Summary
protected org.codehaus.groovy.grails.web.pages.GroovyPagesTemplateEngine templateEngine

 
Property Summary
org.springframework.context.ApplicationContext applicationContext

org.codehaus.groovy.grails.web.pages.discovery.GroovyPageStaticResourceLocator grailsResourceLocator

org.codehaus.groovy.grails.web.pages.discovery.GrailsConventionGroovyPageLocator groovyPageLocator

def log

ServletContext servletContext

 
Constructor Summary
GspResourcePageRenderer(org.codehaus.groovy.grails.web.pages.GroovyPagesTemplateEngine templateEngine)

 
Method Summary
String render(Map args)

Renders a page and returns the contents

void renderTo(Map args, java.io.Writer writer)

Renders a page and returns the contents

void renderTo(Map args, java.io.OutputStream stream)

Renders a page and returns the contents

protected void renderToWriter(Map args, java.io.Writer writer)

Internal method - renders a page and returns the contents.

 
Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Field Detail

templateEngine

protected org.codehaus.groovy.grails.web.pages.GroovyPagesTemplateEngine templateEngine


 
Property Detail

applicationContext

org.springframework.context.ApplicationContext applicationContext


grailsResourceLocator

org.codehaus.groovy.grails.web.pages.discovery.GroovyPageStaticResourceLocator grailsResourceLocator


groovyPageLocator

org.codehaus.groovy.grails.web.pages.discovery.GrailsConventionGroovyPageLocator groovyPageLocator


log

def log


servletContext

ServletContext servletContext


 
Constructor Detail

GspResourcePageRenderer

GspResourcePageRenderer(org.codehaus.groovy.grails.web.pages.GroovyPagesTemplateEngine templateEngine)


 
Method Detail

render

String render(Map args)
Renders a page and returns the contents
arg:
view The view to render. Must be an absolute view path since the controller name is unknown.
arg:
template The template to render. Must be an absolute template path since the controller name is unknown.
arg:
resource The resource to render. Must be an absolute template path since the controller name is unknown.
arg:
model The model to use for rendering
Parameters:
args - The named arguments
Returns:
The resulting string contents


renderTo

void renderTo(Map args, java.io.Writer writer)
Renders a page and returns the contents
arg:
view The view to render. Must be an absolute view path since the controller name is unknown.
arg:
template The template to render. Must be an absolute template path since the controller name is unknown.
arg:
resource The resource to render. Must be an absolute template path since the controller name is unknown.
arg:
model The model to use for rendering
Parameters:
args - The named arguments
writer - The target writer
Returns:
The resulting string contents


renderTo

void renderTo(Map args, java.io.OutputStream stream)
Renders a page and returns the contents
arg:
view The view to render. Must be an absolute view path since the controller name is unknown.
arg:
template The template to render. Must be an absolute template path since the controller name is unknown.
arg:
resource The resource to render. Must be an absolute template path since the controller name is unknown.
arg:
model The model to use for rendering
Parameters:
args - The named arguments
stream - The target stream
Returns:
The resulting string contents


renderToWriter

protected void renderToWriter(Map args, java.io.Writer writer)
Internal method - renders a page and returns the contents. The public methods call this method.
arg:
view The view to render. Must be an absolute view path since the controller name is unknown.
arg:
template The template to render. Must be an absolute template path since the controller name is unknown.
arg:
resource The resource to render. Must be an absolute template path since the controller name is unknown.
arg:
model The model to use for rendering
arg:
params The request params to use for rendering
arg:
flash The flash scope object to use for rendering
Parameters:
args - The named arguments
writer - The target writer
Returns:
The resulting string contents


 

Groovy Documentation