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.

Author:
Troy Heninger, Graeme Rocher, Lari Hotari Date: Jan 10, 2004

Nested Class Summary
static class GroovyPage.ConstantClosure
           
 
Field Summary
static String ACTION_NAME
           
static String APPLICATION_CONTEXT
           
static String ATTRIBUTES
           
static String CONTROLLER_NAME
           
static String DEFAULT_NAMESPACE
           
protected static groovy.lang.Closure EMPTY_BODY_CLOSURE
           
static String EXTENSION
           
static String FLASH
           
static String LINK_NAMESPACE
           
static String OUT
           
static String PAGE_SCOPE
           
static String PARAMS
           
static String PLUGIN_CONTEXT_PATH
           
static String REQUEST
           
static Collection<String> RESERVED_NAMES
           
static String RESPONSE
           
static String SERVLET_CONTEXT
           
static String SESSION
           
static String SUFFIX
           
static String TEMPLATE_NAMESPACE
           
static String WEB_REQUEST
           
 
Constructor Summary
GroovyPage()
           
 
Method Summary
static Object captureTagOutput(TagLibraryLookup gspTagLibraryLookup, String namespace, String tagName, Map attrs, Object body, GrailsWebRequest webRequest)
           
 void cleanup()
           
protected  groovy.lang.Closure createClosureForHtmlPart(int partNumber)
           
static groovy.lang.Closure createOutputCapturingClosure(Object wrappedInstance, Object body1, GrailsWebRequest webRequest, boolean preferSubChunkWhenWritingToOtherBuffer)
           
 Object evaluate(String exprText, int lineNumber, Object outerIt, groovy.lang.Closure evaluator)
          In the development environment this method is used to evaluate expressions and improve error reporting
abstract  String getGroovyPageFileName()
           
 String[] getHtmlParts()
           
 Writer getOut()
           
 GroovyPageOutputStack getOutputStack()
           
 String getPluginContextPath()
           
 Object getProperty(String property)
           
(package private)  TagLibraryResolver getTagLibraryResolver()
          Obtains a reference to the JSP tag library resolver instance
protected  void init()
           
 void initRun(Writer target, GrailsWebRequest webRequest)
           
 Object invokeMethod(String methodName, Object args)
          Allows invoking of taglibs as method calls with simple bodies.
 void invokeTag(String tagName, Map attrs, groovy.lang.Closure body)
          Attempts to invokes a dynamic tag
 void invokeTag(String tagName, String tagNamespace, int lineNumber, Map attrs, groovy.lang.Closure body)
           
 void invokeTag(String tagName, String tagNamespace, Map attrs, groovy.lang.Closure body)
          Attempts to invokes a dynamic tag
static boolean isReservedName(String name)
          Return whether the given name cannot be used within the binding of a GSP
 void printHtmlPart(int partNumber)
           
 void registerSitemeshPreprocessMode(HttpServletRequest request)
           
 void setGspTagLibraryLookup(TagLibraryLookup gspTagLibraryLookup)
          Sets the GSP tag library lookup class
 void setHtmlParts(String[] htmlParts)
           
 void setJspTagLibraryResolver(TagLibraryResolver jspTagLibraryResolver)
          Sets the JSP tag library resolver to use to resolve JSP tags
 void setJspTags(Map jspTags)
          Sets the JSP tags used by this GroovyPage instance
 void setOut(Writer newWriter)
           
 
Methods inherited from class groovy.lang.Script
evaluate, evaluate, getBinding, print, 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 String REQUEST
See Also:
Constant Field Values

SERVLET_CONTEXT

public static final String SERVLET_CONTEXT
See Also:
Constant Field Values

RESPONSE

public static final String RESPONSE
See Also:
Constant Field Values

OUT

public static final String OUT
See Also:
Constant Field Values

ATTRIBUTES

public static final String ATTRIBUTES
See Also:
Constant Field Values

APPLICATION_CONTEXT

public static final String APPLICATION_CONTEXT
See Also:
Constant Field Values

SESSION

public static final String SESSION
See Also:
Constant Field Values

PARAMS

public static final String PARAMS
See Also:
Constant Field Values

FLASH

public static final String FLASH
See Also:
Constant Field Values

PLUGIN_CONTEXT_PATH

public static final String PLUGIN_CONTEXT_PATH
See Also:
Constant Field Values

EXTENSION

public static final String EXTENSION
See Also:
Constant Field Values

WEB_REQUEST

public static final String WEB_REQUEST
See Also:
Constant Field Values

DEFAULT_NAMESPACE

public static final String DEFAULT_NAMESPACE
See Also:
Constant Field Values

LINK_NAMESPACE

public static final String LINK_NAMESPACE
See Also:
Constant Field Values

TEMPLATE_NAMESPACE

public static final String TEMPLATE_NAMESPACE
See Also:
Constant Field Values

PAGE_SCOPE

public static final String PAGE_SCOPE
See Also:
Constant Field Values

CONTROLLER_NAME

public static final String CONTROLLER_NAME
See Also:
Constant Field Values

SUFFIX

public static final String SUFFIX
See Also:
Constant Field Values

ACTION_NAME

public static final String ACTION_NAME
See Also:
Constant Field Values

RESERVED_NAMES

public static final Collection<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 Writer getOut()

setOut

public void setOut(Writer newWriter)

initRun

public void initRun(Writer target,
                    GrailsWebRequest webRequest)

getPluginContextPath

public String getPluginContextPath()

cleanup

public void cleanup()

createClosureForHtmlPart

protected groovy.lang.Closure createClosureForHtmlPart(int partNumber)

setJspTagLibraryResolver

public void setJspTagLibraryResolver(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

getTagLibraryResolver

TagLibraryResolver getTagLibraryResolver()
Obtains a reference to the JSP tag library resolver instance

Returns:
The JSP TagLibraryResolver instance

evaluate

public Object evaluate(String exprText,
                       int lineNumber,
                       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 String getGroovyPageFileName()

getProperty

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

invokeTag

public void invokeTag(String tagName,
                      Map attrs,
                      groovy.lang.Closure body)
Attempts to invokes a dynamic tag

Parameters:
tagName - The name of the tag
attrs - The tags attributes
body - The body of the tag as a closure

invokeTag

public void invokeTag(String tagName,
                      String tagNamespace,
                      Map attrs,
                      groovy.lang.Closure body)
Attempts to invokes a dynamic tag

Parameters:
tagName - The name of the tag
tagNamespace - The taglib's namespace
attrs - The tags attributes
body - The body of the tag as a closure

invokeTag

public void invokeTag(String tagName,
                      String tagNamespace,
                      int lineNumber,
                      Map attrs,
                      groovy.lang.Closure body)

invokeMethod

public Object invokeMethod(String methodName,
                           Object args)
Allows invoking of taglibs as method calls with simple bodies. The bodies should only contain text

Specified by:
invokeMethod in interface groovy.lang.GroovyObject
Overrides:
invokeMethod in class groovy.lang.Script
Parameters:
methodName - The methodName of the tag to call or the methodName of a method on GroovPage
args - The Arguments
Returns:
The result of the invocation

captureTagOutput

public static Object captureTagOutput(TagLibraryLookup gspTagLibraryLookup,
                                      String namespace,
                                      String tagName,
                                      Map attrs,
                                      Object body,
                                      GrailsWebRequest webRequest)

createOutputCapturingClosure

public static groovy.lang.Closure createOutputCapturingClosure(Object wrappedInstance,
                                                               Object body1,
                                                               GrailsWebRequest webRequest,
                                                               boolean preferSubChunkWhenWritingToOtherBuffer)

isReservedName

public static boolean isReservedName(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(Map jspTags)
Sets the JSP tags used by this GroovyPage instance

Parameters:
jspTags - The JSP tags used

getHtmlParts

public String[] getHtmlParts()

setHtmlParts

public void setHtmlParts(String[] htmlParts)

getOutputStack

public GroovyPageOutputStack getOutputStack()

registerSitemeshPreprocessMode

public void registerSitemeshPreprocessMode(HttpServletRequest request)


Copyright (c) 2005-2009 The Grails project