## org.codehaus.groovy.grails.web.pages
Class GroovyPageWritable

    java.lang.Object
      org.codehaus.groovy.grails.web.pages.GroovyPageWritable

All Implemented Interfaces:
  groovy.lang.Writable

     class GroovyPageWritable

extends Object
implements groovy.lang.Writable

An instance of groovy.lang.Writable that writes itself to the specified writer, typically the response writer

Since:
  0.5

  Created: Feb 23, 2007 Time: 11:36:44 AM
Author:
  Graeme Rocher

Constructor Summary
`GroovyPageWritable(GroovyPageMetaInfo metaInfo)`

Method Summary
`protected void` `copyBinding(groovy.lang.Binding binding, groovy.lang.Binding oldBinding, Writer out)`
`protected void` `formulateBinding(HttpServletRequest request, HttpServletResponse response, groovy.lang.Binding binding, Writer out)` Prepare Bindings before instantiating page.
`protected void` `populateViewModel(HttpServletRequest request, groovy.lang.Binding binding)`
`void` `setBinding(Map binding)` This sets any additional variables that need to be placed in the Binding of the GSP page.
`void` `setShowSource(boolean showSource)` Set to true if the generated source should be output instead
`protected void` `writeGroovySourceToResponse(GroovyPageMetaInfo info, Writer out)` Writes the Groovy source code attached to the given info object to the response, prefixing each line with its line number.
`protected void` `writeInputStreamToResponse(InputStream in, Writer out)` Copy all of input to output.
`Writer` `writeTo(Writer out)` Writes the template to the specified Writer

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### GroovyPageWritable

    public GroovyPageWritable(GroovyPageMetaInfo metaInfo)

Method Detail

### setBinding

    public void setBinding(Map binding)

  This sets any additional variables that need to be placed in the Binding of the GSP page.

  Parameters:
    `binding` - The additional variables

### setShowSource

    public void setShowSource(boolean showSource)

  Set to true if the generated source should be output instead

  Parameters:
    `showSource` - True if source output should be output

### writeTo

    public Writer writeTo(Writer out)
                   throws IOException

  Writes the template to the specified Writer

  Specified by:
    `writeTo` in interface `groovy.lang.Writable`
  Parameters:
    `out` - The Writer to write to, normally the HttpServletResponse
  Returns:
    Returns the passed Writer
  Throws:
    `IOException`

### copyBinding

    protected void copyBinding(groovy.lang.Binding binding,
                               groovy.lang.Binding oldBinding,
                               Writer out)
                        throws IOException

  Throws:
    `IOException`

### writeInputStreamToResponse

    protected void writeInputStreamToResponse(InputStream in,
                                              Writer out)
                                       throws IOException

  Copy all of input to output.

  Parameters:
    `in` - The input stream to writeInputStreamToResponse from
    `out` - The output to write to
  Throws:
    `IOException` - When an error occurs writing to the response Writer

### writeGroovySourceToResponse

    protected void writeGroovySourceToResponse(GroovyPageMetaInfo info,
                                               Writer out)
                                        throws IOException

  Writes the Groovy source code attached to the given info object to the response, prefixing each line with its line number. The line numbers make it easier to match line numbers in exceptions to the generated source.

  Parameters:
    `info` - The meta info for the GSP page that we want to write the generated source for.
    `out` - The writer to send the source to.
  Throws:
    `IOException` - If there is either a problem with the input stream for the Groovy source, or the writer.

### formulateBinding

    protected void formulateBinding(HttpServletRequest request,
                                    HttpServletResponse response,
                                    groovy.lang.Binding binding,
                                    Writer out)
                             throws IOException

  Prepare Bindings before instantiating page.

  Parameters:
    `request` - The HttpServletRequest instance
    `response` - The HttpServletResponse instance
    `out` - The response out
  Throws:
    `IOException` - Thrown when an IO error occurs creating the binding

### populateViewModel

    protected void populateViewModel(HttpServletRequest request,
                                     groovy.lang.Binding binding)

Copyright (c) 2005-2009 The Grails project