org.codehaus.groovy.grails.web.pages
Class GroovyPage

java.lang.Object
  extended by groovy.lang.GroovyObjectSupport
      extended by groovy.lang.Script
          extended by org.codehaus.groovy.grails.web.pages.GroovyPage
All Implemented Interfaces:
groovy.lang.GroovyObject

public abstract class GroovyPage
extends groovy.lang.Script

NOTE: Based on work done by on the GSP standalone project (https://gsp.dev.java.net/)

Base class for a GroovyPage (at the moment there is nothing in here but could be useful for providing utility methods etc.


Nested Class Summary
static class GroovyPage.ConstantClosure
           
 
Field Summary
static java.lang.String ACTION_NAME
           
static java.lang.String APPLICATION_CONTEXT
           
static java.lang.String ATTRIBUTES
           
static java.lang.String CODEC_OUT
           
static java.lang.String CODEC_OUT_STATEMENT
           
static java.lang.String CODEC_VARNAME
           
static java.lang.String CONTROLLER_NAME
           
static java.lang.String DEFAULT_NAMESPACE
           
protected static groovy.lang.Closure<?> EMPTY_BODY_CLOSURE
           
static java.lang.String EXTENSION
           
static java.lang.String FLASH
           
static java.lang.String LINK_NAMESPACE
           
static java.lang.String OUT
           
static java.lang.String OUT_STATEMENT
           
static java.lang.String PAGE_SCOPE
           
static java.lang.String PARAMS
           
static java.lang.String PLUGIN_CONTEXT_PATH
           
static java.lang.String REQUEST
           
static java.util.Collection<java.lang.String> RESERVED_NAMES
           
static java.lang.String RESPONSE
           
static java.lang.String SERVLET_CONTEXT
           
static java.lang.String SESSION
           
static java.lang.String SUFFIX
           
static java.lang.String TEMPLATE_NAMESPACE
           
static java.lang.String WEB_REQUEST
           
 
Constructor Summary
GroovyPage()
           
 
Method Summary
static java.lang.Object captureTagOutput(TagLibraryLookup gspTagLibraryLookup, java.lang.String namespace, java.lang.String tagName, java.util.Map attrs, java.lang.Object body, GrailsWebRequest webRequest)
           
 void changeItVariable(java.lang.Object value)
           
 void cleanup()
           
 void createClosureForHtmlPart(int partNumber, int bodyClosureIndex)
           
static groovy.lang.Closure<?> createOutputCapturingClosure(java.lang.Object wrappedInstance, java.lang.Object body1, GrailsWebRequest webRequest, boolean preferSubChunkWhenWritingToOtherBuffer)
           
 void createTagBody(int bodyClosureIndex, groovy.lang.Closure<?> bodyClosure)
           
 java.lang.Object evaluate(java.lang.String exprText, int lineNumber, java.lang.Object outerIt, groovy.lang.Closure<?> evaluator)
          In the development environment this method is used to evaluate expressions and improve error reporting
 groovy.lang.Closure<?> getBodyClosure(int index)
           
 java.io.Writer getCodecOut()
           
abstract  java.lang.String getGroovyPageFileName()
           
 java.lang.String[] getHtmlParts()
           
 JspTag getJspTag(java.lang.String uri, java.lang.String name)
           
 java.io.Writer getOut()
           
 GroovyPageOutputStack getOutputStack()
           
 java.lang.String getPluginContextPath()
           
 java.lang.Object getProperty(java.lang.String property)
           
 javax.servlet.http.HttpServletRequest getRequest()
           
protected  void init()
           
 void initRun(java.io.Writer target, GrailsWebRequest grailsWebRequest, org.codehaus.groovy.grails.commons.GrailsApplication grailsApplication, java.lang.Class codecClass)
           
 void invokeTag(java.lang.String tagName, java.lang.String tagNamespace, int lineNumber, java.util.Map attrs, int bodyClosureIndex)
          Attempts to invokes a dynamic tag
static boolean isReservedName(java.lang.String name)
          Return whether the given name cannot be used within the binding of a GSP
 void printHtmlPart(int partNumber)
           
 void registerSitemeshPreprocessMode()
           
 void setBodyClosure(int index, groovy.lang.Closure<?> bodyClosure)
           
 void setGspTagLibraryLookup(TagLibraryLookup gspTagLibraryLookup)
          Sets the GSP tag library lookup class
 void setHtmlParts(java.lang.String[] htmlParts)
           
 void setJspTagLibraryResolver(org.codehaus.groovy.grails.web.pages.ext.jsp.TagLibraryResolver jspTagLibraryResolver)
          Sets the JSP tag library resolver to use to resolve JSP tags
 void setJspTags(java.util.Map jspTags)
          Sets the JSP tags used by this GroovyPage instance
 void setOut(java.io.Writer newWriter)
           
 void setPluginContextPath(java.lang.String pluginContextPath)
           
 
Methods inherited from class groovy.lang.Script
evaluate, evaluate, getBinding, invokeMethod, print, printf, printf, println, println, run, run, setBinding, setProperty
 
Methods inherited from class groovy.lang.GroovyObjectSupport
getMetaClass, setMetaClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REQUEST

public static final java.lang.String REQUEST
See Also:
Constant Field Values

SERVLET_CONTEXT

public static final java.lang.String SERVLET_CONTEXT
See Also:
Constant Field Values

RESPONSE

public static final java.lang.String RESPONSE
See Also:
Constant Field Values

OUT

public static final java.lang.String OUT
See Also:
Constant Field Values

CODEC_OUT

public static final java.lang.String CODEC_OUT
See Also:
Constant Field Values

CODEC_OUT_STATEMENT

public static final java.lang.String CODEC_OUT_STATEMENT
See Also:
Constant Field Values

OUT_STATEMENT

public static final java.lang.String OUT_STATEMENT
See Also:
Constant Field Values

CODEC_VARNAME

public static final java.lang.String CODEC_VARNAME
See Also:
Constant Field Values

ATTRIBUTES

public static final java.lang.String ATTRIBUTES
See Also:
Constant Field Values

APPLICATION_CONTEXT

public static final java.lang.String APPLICATION_CONTEXT
See Also:
Constant Field Values

SESSION

public static final java.lang.String SESSION
See Also:
Constant Field Values

PARAMS

public static final java.lang.String PARAMS
See Also:
Constant Field Values

FLASH

public static final java.lang.String FLASH
See Also:
Constant Field Values

PLUGIN_CONTEXT_PATH

public static final java.lang.String PLUGIN_CONTEXT_PATH
See Also:
Constant Field Values

EXTENSION

public static final java.lang.String EXTENSION
See Also:
Constant Field Values

WEB_REQUEST

public static final java.lang.String WEB_REQUEST
See Also:
Constant Field Values

DEFAULT_NAMESPACE

public static final java.lang.String DEFAULT_NAMESPACE
See Also:
Constant Field Values

LINK_NAMESPACE

public static final java.lang.String LINK_NAMESPACE
See Also:
Constant Field Values

TEMPLATE_NAMESPACE

public static final java.lang.String TEMPLATE_NAMESPACE
See Also:
Constant Field Values

PAGE_SCOPE

public static final java.lang.String PAGE_SCOPE
See Also:
Constant Field Values

CONTROLLER_NAME

public static final java.lang.String CONTROLLER_NAME
See Also:
Constant Field Values

SUFFIX

public static final java.lang.String SUFFIX
See Also:
Constant Field Values

ACTION_NAME

public static final java.lang.String ACTION_NAME
See Also:
Constant Field Values

RESERVED_NAMES

public static final java.util.Collection<java.lang.String> RESERVED_NAMES

EMPTY_BODY_CLOSURE

protected static final groovy.lang.Closure<?> EMPTY_BODY_CLOSURE
Constructor Detail

GroovyPage

public GroovyPage()
Method Detail

init

protected void init()

getOut

public final java.io.Writer getOut()

getCodecOut

public final java.io.Writer getCodecOut()

setOut

public void setOut(java.io.Writer newWriter)

initRun

public void initRun(java.io.Writer target,
                    GrailsWebRequest grailsWebRequest,
                    org.codehaus.groovy.grails.commons.GrailsApplication grailsApplication,
                    java.lang.Class codecClass)

getPluginContextPath

public java.lang.String getPluginContextPath()

setPluginContextPath

public void setPluginContextPath(java.lang.String pluginContextPath)

cleanup

public void cleanup()

createClosureForHtmlPart

public final void createClosureForHtmlPart(int partNumber,
                                           int bodyClosureIndex)

setBodyClosure

public final void setBodyClosure(int index,
                                 groovy.lang.Closure<?> bodyClosure)

getBodyClosure

public final groovy.lang.Closure<?> getBodyClosure(int index)

setJspTagLibraryResolver

public void setJspTagLibraryResolver(org.codehaus.groovy.grails.web.pages.ext.jsp.TagLibraryResolver jspTagLibraryResolver)
Sets the JSP tag library resolver to use to resolve JSP tags

Parameters:
jspTagLibraryResolver - The JSP tag resolve

setGspTagLibraryLookup

public void setGspTagLibraryLookup(TagLibraryLookup gspTagLibraryLookup)
Sets the GSP tag library lookup class

Parameters:
gspTagLibraryLookup - The class used to lookup a GSP tag library

evaluate

public java.lang.Object evaluate(java.lang.String exprText,
                                 int lineNumber,
                                 java.lang.Object outerIt,
                                 groovy.lang.Closure<?> evaluator)
In the development environment this method is used to evaluate expressions and improve error reporting

Parameters:
exprText - The expression text
lineNumber - The line number
outerIt - The other reference to the variable 'it'
evaluator - The expression evaluator
Returns:
The result

getGroovyPageFileName

public abstract java.lang.String getGroovyPageFileName()

getProperty

public java.lang.Object getProperty(java.lang.String property)
Specified by:
getProperty in interface groovy.lang.GroovyObject
Overrides:
getProperty in class groovy.lang.Script

getJspTag

public JspTag getJspTag(java.lang.String uri,
                        java.lang.String name)

invokeTag

public final void invokeTag(java.lang.String tagName,
                            java.lang.String tagNamespace,
                            int lineNumber,
                            java.util.Map attrs,
                            int bodyClosureIndex)
Attempts to invokes a dynamic tag

Parameters:
tagName - The name of the tag
tagNamespace - The taglib's namespace
lineNumber - GSP source lineNumber
attrs - The tags attributes
bodyClosureIndex - The index of the body variable

captureTagOutput

public static final java.lang.Object captureTagOutput(TagLibraryLookup gspTagLibraryLookup,
                                                      java.lang.String namespace,
                                                      java.lang.String tagName,
                                                      java.util.Map attrs,
                                                      java.lang.Object body,
                                                      GrailsWebRequest webRequest)

createOutputCapturingClosure

public static final groovy.lang.Closure<?> createOutputCapturingClosure(java.lang.Object wrappedInstance,
                                                                        java.lang.Object body1,
                                                                        GrailsWebRequest webRequest,
                                                                        boolean preferSubChunkWhenWritingToOtherBuffer)

isReservedName

public static final boolean isReservedName(java.lang.String name)
Return whether the given name cannot be used within the binding of a GSP

Parameters:
name - True if it can't
Returns:
A boolean true or false

printHtmlPart

public final void printHtmlPart(int partNumber)

setJspTags

public void setJspTags(java.util.Map jspTags)
Sets the JSP tags used by this GroovyPage instance

Parameters:
jspTags - The JSP tags used

getHtmlParts

public java.lang.String[] getHtmlParts()

setHtmlParts

public void setHtmlParts(java.lang.String[] htmlParts)

getOutputStack

public final GroovyPageOutputStack getOutputStack()

getRequest

public final javax.servlet.http.HttpServletRequest getRequest()

registerSitemeshPreprocessMode

public final void registerSitemeshPreprocessMode()

createTagBody

public final void createTagBody(int bodyClosureIndex,
                                groovy.lang.Closure<?> bodyClosure)

changeItVariable

public void changeItVariable(java.lang.Object value)