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 Date: Jan 10, 2004

Field Summary
static String ACTION_NAME
           
static String APPLICATION_CONTEXT
           
static String ATTRIBUTES
           
static String CONTROLLER_NAME
           
static String DEFAULT_NAMESPACE
           
static String EXTENSION
           
static String FLASH
           
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 String captureTagOutput(groovy.lang.GroovyObject tagLib, String methodName, Map attrs, Object body, GrailsWebRequest webRequest)
           
 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()
           
 Object getProperty(String property)
           
(package private)  TagLibraryResolver getTagLibraryResolver()
          Obtains a reference to the JSP tag library resolver instance
 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 setGspTagLibraryLookup(TagLibraryLookup gspTagLibraryLookup)
          Sets the GSP tag library lookup class
 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
 
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

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
Constructor Detail

GroovyPage

public GroovyPage()
Method Detail

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 String captureTagOutput(groovy.lang.GroovyObject tagLib,
                                      String methodName,
                                      Map attrs,
                                      Object body,
                                      GrailsWebRequest webRequest)

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

setJspTags

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

Parameters:
jspTags - The JSP tags used


Copyright (c) 2005-2009 The Grails project