public class GroovyPageParser extends java.lang.Object implements Tokens
NOTE: Based on work done by the GSP standalone project (https://gsp.dev.java.net/).
Parsing implementation for GSP files. This class is responsible for parsing .gsp extension files and converting them to Groovy source code that extends the GroovyPage base class. It also gathers taglib references and html parts (contants with no modification) and writes them to a separate file. For improved debugging, line number references are also stored for easier exception tracing.
| Constructor and description |
|---|
GroovyPageParser(java.lang.String name, java.lang.String uri, java.lang.String filename, java.io.InputStream in, java.lang.String encoding, java.lang.String expressionCodecName, ConfigMap configMap) |
GroovyPageParser(java.lang.String name, java.lang.String uri, java.lang.String filename, java.lang.String gspSource, ConfigMap configMap) |
GroovyPageParser(java.lang.String name, java.lang.String uri, java.lang.String filename, java.io.InputStream in, ConfigMap configMap) |
GroovyPageParser(java.lang.String name, java.lang.String uri, java.lang.String filename, java.lang.String gspSource, java.lang.String expressionCodecName, ConfigMap configMap) |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public static java.lang.String |
checksumOf(byte[] source)Computes the checksum recorded in the SOURCE_CHECKSUM constant of a generated page. |
|
public void |
flushTagBuffering() |
|
public void |
generateGsp(java.io.Writer target) |
|
public void |
generateGsp(java.io.Writer target, boolean precompileMode) |
|
public java.lang.String |
getClassName() |
|
public java.lang.String |
getContentType() |
|
public int |
getCurrentOutputLineNumber() |
|
public java.lang.String |
getExpressionCodecDirectiveValue() |
|
public java.lang.String |
getExpressionText(java.lang.String text)Returns an expression text for the given expression |
|
public java.lang.String |
getExpressionText(java.lang.String text, boolean _safeDereference) |
|
public static java.lang.String |
getGspEncoding() |
|
public java.util.List<java.lang.String> |
getHtmlParts() |
|
public java.lang.String[] |
getHtmlPartsArray() |
|
public java.util.Map<java.lang.String, java.lang.String> |
getJspTags() |
|
public int[] |
getLineNumberMatrix() |
|
public java.lang.String |
getOutCodecDirectiveValue() |
|
public java.lang.String |
getPackageName() |
|
public java.lang.String |
getPageName() |
|
public java.lang.String |
getSourceChecksum()
|
|
public java.lang.String |
getStaticCodecDirectiveValue() |
|
public java.lang.String |
getTaglibCodecDirectiveValue() |
|
public boolean |
isCompileStaticMode() |
|
public boolean |
isInClosure() |
|
public boolean |
isModelFieldsMode() |
|
public java.io.InputStream |
parse() |
|
public void |
setClassName(java.lang.String className) |
|
public void |
setEnableGrailsLayoutProcessing(boolean enableGrailsLayoutProcessing) |
|
public void |
setExpressionCodecDirectiveValue(java.lang.String expressionCodecDirectiveValue) |
|
public void |
setKeepGeneratedDirectory(java.io.File keepGeneratedDirectory) |
|
public void |
setOutCodecDirectiveValue(java.lang.String outCodecDirectiveValue) |
|
public void |
setPackageName(java.lang.String packageName) |
|
public void |
setSourceChecksum(java.lang.String sourceChecksum)Records a checksum of the GSP source, emitted as the SOURCE_CHECKSUM constant so that the
runtime can detect an edited source without depending on its modification time. |
|
public void |
setStaticCodecDirectiveValue(java.lang.String staticCodecDirectiveValue) |
|
public void |
setTaglibCodecDirectiveValue(java.lang.String taglibCodecDirectiveValue) |
|
public void |
writeHtmlParts(java.io.File filename) |
|
public void |
writeLineNumbers(java.io.File filename) |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#getClass(), java.lang.Object#hashCode(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString(), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int) |
Computes the checksum recorded in the SOURCE_CHECKSUM constant of a generated page.
Both the compiler that writes the constant and the runtime that compares against it use this method, so that the two can never disagree on how a GSP source is digested.
The argument must be the raw stored bytes of the page, exactly as they sit on disk or in the jar entry — not the decoded, re-encoded or otherwise decorated source the runtime parse path works with. That is the invariant that lets a checksum taken at compile time be compared against one taken by re-reading the resource at reload time.
source - the raw bytes of the GSP sourceReturns an expression text for the given expression
text - The text
null if none was recorded Records a checksum of the GSP source, emitted as the SOURCE_CHECKSUM constant so that the
runtime can detect an edited source without depending on its modification time.
sourceChecksum - the checksum, or null to record none