You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by mu...@apache.org on 2009/08/14 23:02:36 UTC
svn commit: r804373 [4/19] - in /struts/sandbox/trunk/struts2-jsp-plugin: ./
src/main/java/org/apache/struts2/ src/main/java/org/apache/struts2/jasper/
src/main/java/org/apache/struts2/jasper/compiler/
src/main/java/org/apache/struts2/jasper/compiler/t...
Modified: struts/sandbox/trunk/struts2-jsp-plugin/src/main/java/org/apache/struts2/jasper/compiler/ImplicitTagLibraryInfo.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-jsp-plugin/src/main/java/org/apache/struts2/jasper/compiler/ImplicitTagLibraryInfo.java?rev=804373&r1=804372&r2=804373&view=diff
==============================================================================
--- struts/sandbox/trunk/struts2-jsp-plugin/src/main/java/org/apache/struts2/jasper/compiler/ImplicitTagLibraryInfo.java (original)
+++ struts/sandbox/trunk/struts2-jsp-plugin/src/main/java/org/apache/struts2/jasper/compiler/ImplicitTagLibraryInfo.java Fri Aug 14 21:02:33 2009
@@ -31,7 +31,7 @@
/**
* Class responsible for generating an implicit tag library containing tag
- * handlers corresponding to the tag files in "/WEB-INF/tags/" or a
+ * handlers corresponding to the tag files in "/WEB-INF/tags/" or a
* subdirectory of it.
*
* @author Jan Luehe
@@ -55,57 +55,57 @@
* Constructor.
*/
public ImplicitTagLibraryInfo(JspCompilationContext ctxt,
- ParserController pc,
- String prefix,
- String tagdir,
- ErrorDispatcher err) throws JasperException {
+ ParserController pc,
+ String prefix,
+ String tagdir,
+ ErrorDispatcher err) throws JasperException {
super(prefix, null);
- this.pc = pc;
- this.tagFileMap = new Hashtable();
- this.vec = new Vector();
+ this.pc = pc;
+ this.tagFileMap = new Hashtable();
+ this.vec = new Vector();
// Implicit tag libraries have no functions:
this.functions = new FunctionInfo[0];
- tlibversion = TLIB_VERSION;
- jspversion = JSP_VERSION;
+ tlibversion = TLIB_VERSION;
+ jspversion = JSP_VERSION;
- if (!tagdir.startsWith(WEB_INF_TAGS)) {
- err.jspError("jsp.error.invalid.tagdir", tagdir);
- }
-
- // Determine the value of the <short-name> subelement of the
- // "imaginary" <taglib> element
- if (tagdir.equals(WEB_INF_TAGS)
- || tagdir.equals( WEB_INF_TAGS + "/")) {
- shortname = TAGS_SHORTNAME;
- } else {
- shortname = tagdir.substring(WEB_INF_TAGS.length());
- shortname = shortname.replace('/', '-');
- }
-
- // Populate mapping of tag names to tag file paths
- Set dirList = ctxt.getResourcePaths(tagdir);
- if (dirList != null) {
- Iterator it = dirList.iterator();
- while (it.hasNext()) {
- String path = (String) it.next();
- if (path.endsWith(TAG_FILE_SUFFIX)
- || path.endsWith(TAGX_FILE_SUFFIX)) {
- /*
- * Use the filename of the tag file, without the .tag or
- * .tagx extension, respectively, as the <name> subelement
- * of the "imaginary" <tag-file> element
- */
- String suffix = path.endsWith(TAG_FILE_SUFFIX) ?
- TAG_FILE_SUFFIX : TAGX_FILE_SUFFIX;
- String tagName = path.substring(path.lastIndexOf("/") + 1);
- tagName = tagName.substring(0,
- tagName.lastIndexOf(suffix));
- tagFileMap.put(tagName, path);
- }
- }
- }
+ if (!tagdir.startsWith(WEB_INF_TAGS)) {
+ err.jspError("jsp.error.invalid.tagdir", tagdir);
+ }
+
+ // Determine the value of the <short-name> subelement of the
+ // "imaginary" <taglib> element
+ if (tagdir.equals(WEB_INF_TAGS)
+ || tagdir.equals(WEB_INF_TAGS + "/")) {
+ shortname = TAGS_SHORTNAME;
+ } else {
+ shortname = tagdir.substring(WEB_INF_TAGS.length());
+ shortname = shortname.replace('/', '-');
+ }
+
+ // Populate mapping of tag names to tag file paths
+ Set dirList = ctxt.getResourcePaths(tagdir);
+ if (dirList != null) {
+ Iterator it = dirList.iterator();
+ while (it.hasNext()) {
+ String path = (String) it.next();
+ if (path.endsWith(TAG_FILE_SUFFIX)
+ || path.endsWith(TAGX_FILE_SUFFIX)) {
+ /*
+ * Use the filename of the tag file, without the .tag or
+ * .tagx extension, respectively, as the <name> subelement
+ * of the "imaginary" <tag-file> element
+ */
+ String suffix = path.endsWith(TAG_FILE_SUFFIX) ?
+ TAG_FILE_SUFFIX : TAGX_FILE_SUFFIX;
+ String tagName = path.substring(path.lastIndexOf("/") + 1);
+ tagName = tagName.substring(0,
+ tagName.lastIndexOf(suffix));
+ tagFileMap.put(tagName, path);
+ }
+ }
+ }
}
/**
@@ -113,34 +113,34 @@
* and if so, parses the corresponding tag file.
*
* @return The TagFileInfo corresponding to the given tag name, or null if
- * the given tag name is not implemented as a tag file
+ * the given tag name is not implemented as a tag file
*/
public TagFileInfo getTagFile(String shortName) {
- TagFileInfo tagFile = super.getTagFile(shortName);
- if (tagFile == null) {
- String path = (String) tagFileMap.get(shortName);
- if (path == null) {
- return null;
- }
-
- TagInfo tagInfo = null;
- try {
- tagInfo = TagFileProcessor.parseTagFileDirectives(pc,
- shortName,
- path,
- this);
- } catch (JasperException je) {
- throw new RuntimeException(je.toString());
- }
-
- tagFile = new TagFileInfo(shortName, path, tagInfo);
- vec.addElement(tagFile);
-
- this.tagFiles = new TagFileInfo[vec.size()];
- vec.copyInto(this.tagFiles);
- }
+ TagFileInfo tagFile = super.getTagFile(shortName);
+ if (tagFile == null) {
+ String path = (String) tagFileMap.get(shortName);
+ if (path == null) {
+ return null;
+ }
+
+ TagInfo tagInfo = null;
+ try {
+ tagInfo = TagFileProcessor.parseTagFileDirectives(pc,
+ shortName,
+ path,
+ this);
+ } catch (JasperException je) {
+ throw new RuntimeException(je.toString());
+ }
+
+ tagFile = new TagFileInfo(shortName, path, tagInfo);
+ vec.addElement(tagFile);
+
+ this.tagFiles = new TagFileInfo[vec.size()];
+ vec.copyInto(this.tagFiles);
+ }
- return tagFile;
+ return tagFile;
}
}
Modified: struts/sandbox/trunk/struts2-jsp-plugin/src/main/java/org/apache/struts2/jasper/compiler/JasperTagInfo.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-jsp-plugin/src/main/java/org/apache/struts2/jasper/compiler/JasperTagInfo.java?rev=804373&r1=804372&r2=804373&view=diff
==============================================================================
--- struts/sandbox/trunk/struts2-jsp-plugin/src/main/java/org/apache/struts2/jasper/compiler/JasperTagInfo.java (original)
+++ struts/sandbox/trunk/struts2-jsp-plugin/src/main/java/org/apache/struts2/jasper/compiler/JasperTagInfo.java Fri Aug 14 21:02:33 2009
@@ -30,26 +30,26 @@
private String dynamicAttrsMapName;
public JasperTagInfo(String tagName,
- String tagClassName,
- String bodyContent,
- String infoString,
- TagLibraryInfo taglib,
- TagExtraInfo tagExtraInfo,
- TagAttributeInfo[] attributeInfo,
- String displayName,
- String smallIcon,
- String largeIcon,
- TagVariableInfo[] tvi,
- String mapName) {
+ String tagClassName,
+ String bodyContent,
+ String infoString,
+ TagLibraryInfo taglib,
+ TagExtraInfo tagExtraInfo,
+ TagAttributeInfo[] attributeInfo,
+ String displayName,
+ String smallIcon,
+ String largeIcon,
+ TagVariableInfo[] tvi,
+ String mapName) {
- super(tagName, tagClassName, bodyContent, infoString, taglib,
- tagExtraInfo, attributeInfo, displayName, smallIcon, largeIcon,
- tvi);
- this.dynamicAttrsMapName = mapName;
+ super(tagName, tagClassName, bodyContent, infoString, taglib,
+ tagExtraInfo, attributeInfo, displayName, smallIcon, largeIcon,
+ tvi);
+ this.dynamicAttrsMapName = mapName;
}
public String getDynamicAttributesMapName() {
- return dynamicAttrsMapName;
+ return dynamicAttrsMapName;
}
public boolean hasDynamicAttributes() {
Modified: struts/sandbox/trunk/struts2-jsp-plugin/src/main/java/org/apache/struts2/jasper/compiler/JavacErrorDetail.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-jsp-plugin/src/main/java/org/apache/struts2/jasper/compiler/JavacErrorDetail.java?rev=804373&r1=804372&r2=804373&view=diff
==============================================================================
--- struts/sandbox/trunk/struts2-jsp-plugin/src/main/java/org/apache/struts2/jasper/compiler/JavacErrorDetail.java (original)
+++ struts/sandbox/trunk/struts2-jsp-plugin/src/main/java/org/apache/struts2/jasper/compiler/JavacErrorDetail.java Fri Aug 14 21:02:33 2009
@@ -41,10 +41,10 @@
/**
* Constructor.
*
- * @param javaFileName The name of the Java file in which the
- * compilation error occurred
- * @param javaLineNum The compilation error line number
- * @param errMsg The compilation error message
+ * @param javaFileName The name of the Java file in which the
+ * compilation error occurred
+ * @param javaLineNum The compilation error line number
+ * @param errMsg The compilation error message
*/
public JavacErrorDetail(String javaFileName,
int javaLineNum,
@@ -59,14 +59,14 @@
/**
* Constructor.
*
- * @param javaFileName The name of the Java file in which the
- * compilation error occurred
- * @param javaLineNum The compilation error line number
- * @param jspFileName The name of the JSP file from which the Java source
- * file was generated
+ * @param javaFileName The name of the Java file in which the
+ * compilation error occurred
+ * @param javaLineNum The compilation error line number
+ * @param jspFileName The name of the JSP file from which the Java source
+ * file was generated
* @param jspBeginLineNum The start line number of the JSP element
- * responsible for the compilation error
- * @param errMsg The compilation error message
+ * responsible for the compilation error
+ * @param errMsg The compilation error message
*/
public JavacErrorDetail(String javaFileName,
int javaLineNum,
@@ -79,15 +79,15 @@
}
public JavacErrorDetail(String javaFileName,
- int javaLineNum,
- String jspFileName,
- int jspBeginLineNum,
- StringBuffer errMsg,
- JspCompilationContext ctxt) {
+ int javaLineNum,
+ String jspFileName,
+ int jspBeginLineNum,
+ StringBuffer errMsg,
+ JspCompilationContext ctxt) {
this(javaFileName, javaLineNum, errMsg);
this.jspFileName = jspFileName;
this.jspBeginLineNum = jspBeginLineNum;
-
+
if (jspBeginLineNum > 0 && ctxt != null) {
InputStream is = null;
FileInputStream fis = null;
@@ -95,40 +95,40 @@
// Read both files in, so we can inspect them
is = ctxt.getResourceAsStream(jspFileName);
String[] jspLines = readFile(is);
-
+
fis = new FileInputStream(ctxt.getServletJavaFileName());
String[] javaLines = readFile(fis);
-
+
// If the line contains the opening of a multi-line scriptlet
// block, then the JSP line number we got back is probably
// faulty. Scan forward to match the java line...
- if (jspLines[jspBeginLineNum-1].lastIndexOf("<%") >
- jspLines[jspBeginLineNum-1].lastIndexOf("%>")) {
- String javaLine = javaLines[javaLineNum-1].trim();
-
- for (int i=jspBeginLineNum-1; i<jspLines.length; i++) {
+ if (jspLines[jspBeginLineNum - 1].lastIndexOf("<%") >
+ jspLines[jspBeginLineNum - 1].lastIndexOf("%>")) {
+ String javaLine = javaLines[javaLineNum - 1].trim();
+
+ for (int i = jspBeginLineNum - 1; i < jspLines.length; i++) {
if (jspLines[i].indexOf(javaLine) != -1) {
// Update jsp line number
- this.jspBeginLineNum = i+1;
+ this.jspBeginLineNum = i + 1;
break;
}
}
}
-
+
// copy out a fragment of JSP to display to the user
StringBuffer fragment = new StringBuffer(1024);
- int startIndex = Math.max(0, this.jspBeginLineNum-1-3);
+ int startIndex = Math.max(0, this.jspBeginLineNum - 1 - 3);
int endIndex = Math.min(
- jspLines.length-1, this.jspBeginLineNum-1+3);
-
- for (int i=startIndex;i<=endIndex; ++i) {
- fragment.append(i+1);
+ jspLines.length - 1, this.jspBeginLineNum - 1 + 3);
+
+ for (int i = startIndex; i <= endIndex; ++i) {
+ fragment.append(i + 1);
fragment.append(": ");
fragment.append(jspLines[i]);
fragment.append("\n");
}
jspExtract = fragment.toString();
-
+
} catch (IOException ioe) {
// Can't read files - ignore
} finally {
@@ -150,6 +150,7 @@
}
}
+
/**
* Gets the name of the Java source file in which the compilation error
* occurred.
@@ -162,7 +163,7 @@
/**
* Gets the compilation error line number.
- *
+ *
* @return Compilation error line number
*/
public int getJavaLineNumber() {
@@ -184,7 +185,7 @@
* responsible for the compilation error.
*
* @return Start line number of the JSP element responsible for the
- * compilation error
+ * compilation error
*/
public int getJspBeginLineNumber() {
return this.jspBeginLineNum;
@@ -198,7 +199,7 @@
public String getErrorMessage() {
return this.errMsg.toString();
}
-
+
/**
* Gets the extract of the JSP that corresponds to this message.
*
@@ -207,7 +208,7 @@
public String getJspExtract() {
return this.jspExtract;
}
-
+
/**
* Reads a text file from an input stream into a String[]. Used to read in
* the JSP and generated Java file when generating error messages.
@@ -217,10 +218,10 @@
List lines = new ArrayList();
String line;
- while ( (line = reader.readLine()) != null ) {
+ while ((line = reader.readLine()) != null) {
lines.add(line);
}
- return (String[]) lines.toArray( new String[lines.size()] );
+ return (String[]) lines.toArray(new String[lines.size()]);
}
}
Modified: struts/sandbox/trunk/struts2-jsp-plugin/src/main/java/org/apache/struts2/jasper/compiler/JspConfig.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-jsp-plugin/src/main/java/org/apache/struts2/jasper/compiler/JspConfig.java?rev=804373&r1=804372&r2=804373&view=diff
==============================================================================
--- struts/sandbox/trunk/struts2-jsp-plugin/src/main/java/org/apache/struts2/jasper/compiler/JspConfig.java (original)
+++ struts/sandbox/trunk/struts2-jsp-plugin/src/main/java/org/apache/struts2/jasper/compiler/JspConfig.java Fri Aug 14 21:02:33 2009
@@ -17,8 +17,8 @@
package org.apache.struts2.jasper.compiler;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import com.opensymphony.xwork2.util.logging.Logger;
+import com.opensymphony.xwork2.util.logging.LoggerFactory;
import org.apache.struts2.jasper.JasperException;
import org.apache.struts2.jasper.xmlparser.ParserUtils;
import org.apache.struts2.jasper.xmlparser.TreeNode;
@@ -42,7 +42,7 @@
private static final String WEB_XML = "/WEB-INF/web.xml";
// Logger
- private Log log = LogFactory.getLog(JspConfig.class);
+ private Logger log = LoggerFactory.getLogger(JspConfig.class);
private Vector jspProperties = null;
private ServletContext ctxt;
@@ -70,7 +70,7 @@
is = uri.openStream();
InputSource ip = new InputSource(is);
- ip.setSystemId(uri.toExternalForm());
+ ip.setSystemId(uri.toExternalForm());
ParserUtils pu = new ParserUtils();
TreeNode webApp = pu.parseXMLDocument(WEB_XML, ip);
@@ -106,7 +106,7 @@
String tname = element.getName();
if ("url-pattern".equals(tname))
- urlPatterns.addElement( element.getBody() );
+ urlPatterns.addElement(element.getBody());
else if ("page-encoding".equals(tname))
pageEncoding = element.getBody();
else if ("is-xml".equals(tname))
@@ -124,14 +124,14 @@
if (urlPatterns.size() == 0) {
continue;
}
-
+
// Add one JspPropertyGroup for each URL Pattern. This makes
// the matching logic easier.
- for( int p = 0; p < urlPatterns.size(); p++ ) {
- String urlPattern = (String)urlPatterns.elementAt( p );
+ for (int p = 0; p < urlPatterns.size(); p++) {
+ String urlPattern = (String) urlPatterns.elementAt(p);
String path = null;
String extension = null;
-
+
if (urlPattern.indexOf('*') < 0) {
// Exact match
path = urlPattern;
@@ -139,17 +139,17 @@
int i = urlPattern.lastIndexOf('/');
String file;
if (i >= 0) {
- path = urlPattern.substring(0,i+1);
- file = urlPattern.substring(i+1);
+ path = urlPattern.substring(0, i + 1);
+ file = urlPattern.substring(i + 1);
} else {
file = urlPattern;
}
-
+
// pattern must be "*", or of the form "*.jsp"
if (file.equals("*")) {
extension = "*";
} else if (file.startsWith("*.")) {
- extension = file.substring(file.indexOf('.')+1);
+ extension = file.substring(file.indexOf('.') + 1);
}
// The url patterns are reconstructed as the follwoing:
@@ -161,21 +161,21 @@
|| (path != null && !isStar)) {
if (log.isWarnEnabled()) {
log.warn(Localizer.getMessage(
- "jsp.warning.bad.urlpattern.propertygroup",
- urlPattern));
+ "jsp.warning.bad.urlpattern.propertygroup",
+ urlPattern));
}
continue;
}
}
JspProperty property = new JspProperty(isXml,
- elIgnored,
- scriptingInvalid,
- pageEncoding,
- includePrelude,
- includeCoda);
+ elIgnored,
+ scriptingInvalid,
+ pageEncoding,
+ includePrelude,
+ includeCoda);
JspPropertyGroup propertyGroup =
- new JspPropertyGroup(path, extension, property);
+ new JspPropertyGroup(path, extension, property);
jspProperties.addElement(propertyGroup);
}
@@ -186,7 +186,8 @@
if (is != null) {
try {
is.close();
- } catch (Throwable t) {}
+ } catch (Throwable t) {
+ }
}
}
}
@@ -196,9 +197,9 @@
if (!initialized) {
processWebDotXml(ctxt);
defaultJspProperty = new JspProperty(defaultIsXml,
- defaultIsELIgnored,
- defaultIsScriptingInvalid,
- null, null, null);
+ defaultIsELIgnored,
+ defaultIsScriptingInvalid,
+ null, null, null);
initialized = true;
}
}
@@ -237,10 +238,11 @@
}
return curr;
}
-
+
/**
* Find a property that best matches the supplied resource.
+ *
* @param uri the resource supplied.
* @return a JspProperty indicating the best match, or some default.
*/
@@ -256,13 +258,13 @@
String uriPath = null;
int index = uri.lastIndexOf('/');
- if (index >=0 ) {
- uriPath = uri.substring(0, index+1);
+ if (index >= 0) {
+ uriPath = uri.substring(0, index + 1);
}
String uriExtension = null;
index = uri.lastIndexOf('.');
- if (index >=0) {
- uriExtension = uri.substring(index+1);
+ if (index >= 0) {
+ uriExtension = uri.substring(index + 1);
}
Vector includePreludes = new Vector();
@@ -279,53 +281,53 @@
JspPropertyGroup jpg = (JspPropertyGroup) iter.next();
JspProperty jp = jpg.getJspProperty();
- // (arrays will be the same length)
- String extension = jpg.getExtension();
- String path = jpg.getPath();
-
- if (extension == null) {
- // exact match pattern: /a/foo.jsp
- if (!uri.equals(path)) {
- // not matched;
- continue;
- }
- } else {
- // Matching patterns *.ext or /p/*
- if (path != null && uriPath != null &&
- ! uriPath.startsWith(path)) {
- // not matched
- continue;
- }
- if (!extension.equals("*") &&
- !extension.equals(uriExtension)) {
- // not matched
- continue;
- }
- }
- // We have a match
- // Add include-preludes and include-codas
- if (jp.getIncludePrelude() != null) {
- includePreludes.addAll(jp.getIncludePrelude());
- }
- if (jp.getIncludeCoda() != null) {
- includeCodas.addAll(jp.getIncludeCoda());
- }
-
- // If there is a previous match for the same property, remember
- // the one that is more restrictive.
- if (jp.isXml() != null) {
- isXmlMatch = selectProperty(isXmlMatch, jpg);
- }
- if (jp.isELIgnored() != null) {
- elIgnoredMatch = selectProperty(elIgnoredMatch, jpg);
- }
- if (jp.isScriptingInvalid() != null) {
- scriptingInvalidMatch =
- selectProperty(scriptingInvalidMatch, jpg);
- }
- if (jp.getPageEncoding() != null) {
- pageEncodingMatch = selectProperty(pageEncodingMatch, jpg);
- }
+ // (arrays will be the same length)
+ String extension = jpg.getExtension();
+ String path = jpg.getPath();
+
+ if (extension == null) {
+ // exact match pattern: /a/foo.jsp
+ if (!uri.equals(path)) {
+ // not matched;
+ continue;
+ }
+ } else {
+ // Matching patterns *.ext or /p/*
+ if (path != null && uriPath != null &&
+ !uriPath.startsWith(path)) {
+ // not matched
+ continue;
+ }
+ if (!extension.equals("*") &&
+ !extension.equals(uriExtension)) {
+ // not matched
+ continue;
+ }
+ }
+ // We have a match
+ // Add include-preludes and include-codas
+ if (jp.getIncludePrelude() != null) {
+ includePreludes.addAll(jp.getIncludePrelude());
+ }
+ if (jp.getIncludeCoda() != null) {
+ includeCodas.addAll(jp.getIncludeCoda());
+ }
+
+ // If there is a previous match for the same property, remember
+ // the one that is more restrictive.
+ if (jp.isXml() != null) {
+ isXmlMatch = selectProperty(isXmlMatch, jpg);
+ }
+ if (jp.isELIgnored() != null) {
+ elIgnoredMatch = selectProperty(elIgnoredMatch, jpg);
+ }
+ if (jp.isScriptingInvalid() != null) {
+ scriptingInvalidMatch =
+ selectProperty(scriptingInvalidMatch, jpg);
+ }
+ if (jp.getPageEncoding() != null) {
+ pageEncodingMatch = selectProperty(pageEncodingMatch, jpg);
+ }
}
@@ -342,14 +344,14 @@
}
if (scriptingInvalidMatch != null) {
isScriptingInvalid =
- scriptingInvalidMatch.getJspProperty().isScriptingInvalid();
+ scriptingInvalidMatch.getJspProperty().isScriptingInvalid();
}
if (pageEncodingMatch != null) {
pageEncoding = pageEncodingMatch.getJspProperty().getPageEncoding();
}
return new JspProperty(isXml, isELIgnored, isScriptingInvalid,
- pageEncoding, includePreludes, includeCodas);
+ pageEncoding, includePreludes, includeCodas);
}
/**
@@ -365,13 +367,13 @@
String uriPath = null;
int index = uri.lastIndexOf('/');
- if (index >=0 ) {
- uriPath = uri.substring(0, index+1);
+ if (index >= 0) {
+ uriPath = uri.substring(0, index + 1);
}
String uriExtension = null;
index = uri.lastIndexOf('.');
- if (index >=0) {
- uriExtension = uri.substring(index+1);
+ if (index >= 0) {
+ uriExtension = uri.substring(index + 1);
}
Iterator iter = jspProperties.iterator();
@@ -389,7 +391,7 @@
}
} else {
if ((path == null || path.equals(uriPath)) &&
- (extension.equals("*") || extension.equals(uriExtension))) {
+ (extension.equals("*") || extension.equals(uriExtension))) {
// Matches *, *.ext, /p/*, or /p/*.ext
return true;
}
@@ -433,8 +435,8 @@
private Vector includeCoda;
public JspProperty(String isXml, String elIgnored,
- String scriptingInvalid, String pageEncoding,
- Vector includePrelude, Vector includeCoda) {
+ String scriptingInvalid, String pageEncoding,
+ Vector includePrelude, Vector includeCoda) {
this.isXml = isXml;
this.elIgnored = elIgnored;
Modified: struts/sandbox/trunk/struts2-jsp-plugin/src/main/java/org/apache/struts2/jasper/compiler/JspDocumentParser.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-jsp-plugin/src/main/java/org/apache/struts2/jasper/compiler/JspDocumentParser.java?rev=804373&r1=804372&r2=804373&view=diff
==============================================================================
--- struts/sandbox/trunk/struts2-jsp-plugin/src/main/java/org/apache/struts2/jasper/compiler/JspDocumentParser.java (original)
+++ struts/sandbox/trunk/struts2-jsp-plugin/src/main/java/org/apache/struts2/jasper/compiler/JspDocumentParser.java Fri Aug 14 21:02:33 2009
@@ -45,18 +45,18 @@
*/
class JspDocumentParser
- extends DefaultHandler
- implements LexicalHandler, TagConstants {
+ extends DefaultHandler
+ implements LexicalHandler, TagConstants {
private static final String JSP_VERSION = "version";
private static final String LEXICAL_HANDLER_PROPERTY =
- "http://xml.org/sax/properties/lexical-handler";
+ "http://xml.org/sax/properties/lexical-handler";
private static final String JSP_URI = "http://java.sun.com/JSP/Page";
private static final EnableDTDValidationException ENABLE_DTD_VALIDATION_EXCEPTION =
- new EnableDTDValidationException(
- "jsp.error.enable_dtd_validation",
- null);
+ new EnableDTDValidationException(
+ "jsp.error.enable_dtd_validation",
+ null);
private ParserController parserController;
private JspCompilationContext ctxt;
@@ -71,7 +71,7 @@
* Outermost (in the nesting hierarchy) node whose body is declared to be
* scriptless. If a node's body is declared to be scriptless, all its
* nested nodes must be scriptless, too.
- */
+ */
private Node scriptlessBodyNode;
private Locator locator;
@@ -108,10 +108,10 @@
* Constructor
*/
public JspDocumentParser(
- ParserController pc,
- String path,
- boolean isTagFile,
- boolean directivesOnly) {
+ ParserController pc,
+ String path,
+ boolean isTagFile,
+ boolean directivesOnly) {
this.parserController = pc;
this.ctxt = pc.getJspCompilationContext();
this.pageInfo = pc.getCompiler().getPageInfo();
@@ -128,19 +128,19 @@
* @throws JasperException
*/
public static Node.Nodes parse(
- ParserController pc,
- String path,
- JarFile jarFile,
- Node parent,
- boolean isTagFile,
- boolean directivesOnly,
- String pageEnc,
- String jspConfigPageEnc,
- boolean isEncodingSpecifiedInProlog)
- throws JasperException {
+ ParserController pc,
+ String path,
+ JarFile jarFile,
+ Node parent,
+ boolean isTagFile,
+ boolean directivesOnly,
+ String pageEnc,
+ String jspConfigPageEnc,
+ boolean isEncodingSpecifiedInProlog)
+ throws JasperException {
JspDocumentParser jspDocParser =
- new JspDocumentParser(pc, path, isTagFile, directivesOnly);
+ new JspDocumentParser(pc, path, isTagFile, directivesOnly);
Node.Nodes pageNodes = null;
try {
@@ -150,12 +150,12 @@
dummyRoot.setPageEncoding(pageEnc);
dummyRoot.setJspConfigPageEncoding(jspConfigPageEnc);
dummyRoot.setIsEncodingSpecifiedInProlog(
- isEncodingSpecifiedInProlog);
+ isEncodingSpecifiedInProlog);
jspDocParser.current = dummyRoot;
if (parent == null) {
jspDocParser.addInclude(
- dummyRoot,
- jspDocParser.pageInfo.getIncludePrelude());
+ dummyRoot,
+ jspDocParser.pageInfo.getIncludePrelude());
} else {
jspDocParser.isTop = false;
}
@@ -165,8 +165,8 @@
InputStream inStream = null;
try {
inStream = JspUtil.getInputStream(path, jarFile,
- jspDocParser.ctxt,
- jspDocParser.err);
+ jspDocParser.ctxt,
+ jspDocParser.err);
saxParser.parse(new InputSource(inStream), jspDocParser);
} catch (EnableDTDValidationException e) {
saxParser = getSAXParser(true, jspDocParser);
@@ -178,8 +178,8 @@
}
}
inStream = JspUtil.getInputStream(path, jarFile,
- jspDocParser.ctxt,
- jspDocParser.err);
+ jspDocParser.ctxt,
+ jspDocParser.err);
saxParser.parse(new InputSource(inStream), jspDocParser);
} finally {
if (inStream != null) {
@@ -192,8 +192,8 @@
if (parent == null) {
jspDocParser.addInclude(
- dummyRoot,
- jspDocParser.pageInfo.getIncludeCoda());
+ dummyRoot,
+ jspDocParser.pageInfo.getIncludeCoda());
}
// Create Node.Nodes from dummy root
@@ -203,9 +203,9 @@
jspDocParser.err.jspError("jsp.error.data.file.read", path, ioe);
} catch (SAXParseException e) {
jspDocParser.err.jspError
- (new Mark(jspDocParser.ctxt, path, e.getLineNumber(),
- e.getColumnNumber()),
- e.getMessage());
+ (new Mark(jspDocParser.ctxt, path, e.getLineNumber(),
+ e.getColumnNumber()),
+ e.getMessage());
} catch (Exception e) {
jspDocParser.err.jspError(e);
}
@@ -223,14 +223,14 @@
if (files != null) {
Iterator iter = files.iterator();
while (iter.hasNext()) {
- String file = (String)iter.next();
+ String file = (String) iter.next();
AttributesImpl attrs = new AttributesImpl();
attrs.addAttribute("", "file", "file", "CDATA", file);
// Create a dummy Include directive node
- Node includeDir =
+ Node includeDir =
new Node.IncludeDirective(attrs, null, // XXX
- parent);
+ parent);
processIncludeDirective(file, includeDir);
}
}
@@ -250,11 +250,11 @@
* tag libraries.
*/
public void startElement(
- String uri,
- String localName,
- String qName,
- Attributes attrs)
- throws SAXException {
+ String uri,
+ String localName,
+ String qName,
+ Attributes attrs)
+ throws SAXException {
AttributesImpl taglibAttrs = null;
AttributesImpl nonTaglibAttrs = null;
@@ -265,22 +265,22 @@
checkPrefixes(uri, qName, attrs);
if (directivesOnly &&
- !(JSP_URI.equals(uri) && localName.startsWith(DIRECTIVE_ACTION))) {
+ !(JSP_URI.equals(uri) && localName.startsWith(DIRECTIVE_ACTION))) {
return;
}
String currentPrefix = getPrefix(current.getQName());
-
+
// jsp:text must not have any subelements
if (JSP_URI.equals(uri) && TEXT_ACTION.equals(current.getLocalName())
&& "jsp".equals(currentPrefix)) {
throw new SAXParseException(
- Localizer.getMessage("jsp.error.text.has_subelement"),
- locator);
+ Localizer.getMessage("jsp.error.text.has_subelement"),
+ locator);
}
startMark = new Mark(ctxt, path, locator.getLineNumber(),
- locator.getColumnNumber());
+ locator.getColumnNumber());
if (attrs != null) {
/*
@@ -296,11 +296,11 @@
nonTaglibAttrs = new AttributesImpl();
}
nonTaglibAttrs.addAttribute(
- attrs.getURI(i),
- attrs.getLocalName(i),
- attrs.getQName(i),
- attrs.getType(i),
- attrs.getValue(i));
+ attrs.getURI(i),
+ attrs.getLocalName(i),
+ attrs.getQName(i),
+ attrs.getType(i),
+ attrs.getValue(i));
} else {
if (attrQName.startsWith("xmlns:jsp")) {
isTaglib = true;
@@ -315,21 +315,21 @@
taglibAttrs = new AttributesImpl();
}
taglibAttrs.addAttribute(
- attrs.getURI(i),
- attrs.getLocalName(i),
- attrs.getQName(i),
- attrs.getType(i),
- attrs.getValue(i));
+ attrs.getURI(i),
+ attrs.getLocalName(i),
+ attrs.getQName(i),
+ attrs.getType(i),
+ attrs.getValue(i));
} else {
if (nonTaglibXmlnsAttrs == null) {
nonTaglibXmlnsAttrs = new AttributesImpl();
}
nonTaglibXmlnsAttrs.addAttribute(
- attrs.getURI(i),
- attrs.getLocalName(i),
- attrs.getQName(i),
- attrs.getType(i),
- attrs.getValue(i));
+ attrs.getURI(i),
+ attrs.getLocalName(i),
+ attrs.getQName(i),
+ attrs.getType(i),
+ attrs.getValue(i));
}
}
}
@@ -338,32 +338,32 @@
Node node = null;
if (tagDependentPending && JSP_URI.equals(uri) &&
- localName.equals(BODY_ACTION)) {
+ localName.equals(BODY_ACTION)) {
tagDependentPending = false;
tagDependentNesting++;
current =
- parseStandardAction(
- qName,
- localName,
- nonTaglibAttrs,
- nonTaglibXmlnsAttrs,
- taglibAttrs,
- startMark,
- current);
+ parseStandardAction(
+ qName,
+ localName,
+ nonTaglibAttrs,
+ nonTaglibXmlnsAttrs,
+ taglibAttrs,
+ startMark,
+ current);
return;
}
if (tagDependentPending && JSP_URI.equals(uri) &&
- localName.equals(ATTRIBUTE_ACTION)) {
+ localName.equals(ATTRIBUTE_ACTION)) {
current =
- parseStandardAction(
- qName,
- localName,
- nonTaglibAttrs,
- nonTaglibXmlnsAttrs,
- taglibAttrs,
- startMark,
- current);
+ parseStandardAction(
+ qName,
+ localName,
+ nonTaglibAttrs,
+ nonTaglibXmlnsAttrs,
+ taglibAttrs,
+ startMark,
+ current);
return;
}
@@ -374,45 +374,45 @@
if (tagDependentNesting > 0) {
node =
- new Node.UninterpretedTag(
- qName,
- localName,
- nonTaglibAttrs,
- nonTaglibXmlnsAttrs,
- taglibAttrs,
- startMark,
- current);
+ new Node.UninterpretedTag(
+ qName,
+ localName,
+ nonTaglibAttrs,
+ nonTaglibXmlnsAttrs,
+ taglibAttrs,
+ startMark,
+ current);
} else if (JSP_URI.equals(uri)) {
node =
- parseStandardAction(
- qName,
- localName,
- nonTaglibAttrs,
- nonTaglibXmlnsAttrs,
- taglibAttrs,
- startMark,
- current);
+ parseStandardAction(
+ qName,
+ localName,
+ nonTaglibAttrs,
+ nonTaglibXmlnsAttrs,
+ taglibAttrs,
+ startMark,
+ current);
} else {
node =
- parseCustomAction(
- qName,
- localName,
- uri,
- nonTaglibAttrs,
- nonTaglibXmlnsAttrs,
- taglibAttrs,
- startMark,
- current);
+ parseCustomAction(
+ qName,
+ localName,
+ uri,
+ nonTaglibAttrs,
+ nonTaglibXmlnsAttrs,
+ taglibAttrs,
+ startMark,
+ current);
if (node == null) {
node =
- new Node.UninterpretedTag(
- qName,
- localName,
- nonTaglibAttrs,
- nonTaglibXmlnsAttrs,
- taglibAttrs,
- startMark,
- current);
+ new Node.UninterpretedTag(
+ qName,
+ localName,
+ nonTaglibAttrs,
+ nonTaglibXmlnsAttrs,
+ taglibAttrs,
+ startMark,
+ current);
} else {
// custom action
String bodyType = getBodyType((Node.CustomTag) node);
@@ -420,8 +420,7 @@
if (scriptlessBodyNode == null
&& bodyType.equalsIgnoreCase(TagInfo.BODY_CONTENT_SCRIPTLESS)) {
scriptlessBodyNode = node;
- }
- else if (TagInfo.BODY_CONTENT_TAG_DEPENDENT.equalsIgnoreCase(bodyType)) {
+ } else if (TagInfo.BODY_CONTENT_TAG_DEPENDENT.equalsIgnoreCase(bodyType)) {
tagDependentPending = true;
}
}
@@ -470,12 +469,12 @@
*/
boolean isAllSpace = true;
if (!(current instanceof Node.JspText)
- && !(current instanceof Node.NamedAttribute)) {
+ && !(current instanceof Node.NamedAttribute)) {
for (int i = 0; i < charBuffer.length(); i++) {
if (!(charBuffer.charAt(i) == ' '
- || charBuffer.charAt(i) == '\n'
- || charBuffer.charAt(i) == '\r'
- || charBuffer.charAt(i) == '\t')) {
+ || charBuffer.charAt(i) == '\n'
+ || charBuffer.charAt(i) == '\r'
+ || charBuffer.charAt(i) == '\t')) {
isAllSpace = false;
break;
}
@@ -492,14 +491,14 @@
new Node.TemplateText(charBuffer.toString(), startMark, current);
}
startMark = new Mark(ctxt, path, locator.getLineNumber(),
- locator.getColumnNumber());
+ locator.getColumnNumber());
charBuffer = null;
return;
}
if ((current instanceof Node.JspText)
- || (current instanceof Node.NamedAttribute)
- || !isAllSpace) {
+ || (current instanceof Node.NamedAttribute)
+ || !isAllSpace) {
int line = startMark.getLineNumber();
int column = startMark.getColumnNumber();
@@ -518,9 +517,9 @@
if (lastCh == '$' && ch == '{') {
if (ttext.size() > 0) {
new Node.TemplateText(
- ttext.toString(),
- startMark,
- current);
+ ttext.toString(),
+ startMark,
+ current);
ttext = new CharArrayWriter();
//We subtract two from the column number to
//account for the '${' that we've already parsed
@@ -531,13 +530,13 @@
boolean singleQ = false;
boolean doubleQ = false;
lastCh = 0;
- for (;; i++) {
+ for (; ; i++) {
if (i >= charBuffer.length()) {
throw new SAXParseException(
- Localizer.getMessage(
- "jsp.error.unterminated",
- "${"),
- locator);
+ Localizer.getMessage(
+ "jsp.error.unterminated",
+ "${"),
+ locator);
}
ch = charBuffer.charAt(i);
@@ -554,9 +553,9 @@
}
if (ch == '}') {
new Node.ELExpression(
- ttext.toString(),
- startMark,
- current);
+ ttext.toString(),
+ startMark,
+ current);
ttext = new CharArrayWriter();
startMark = new Mark(ctxt, path, line, column);
break;
@@ -590,7 +589,7 @@
}
}
startMark = new Mark(ctxt, path, locator.getLineNumber(),
- locator.getColumnNumber());
+ locator.getColumnNumber());
charBuffer = null;
}
@@ -599,18 +598,18 @@
* Receives notification of the end of an element.
*/
public void endElement(String uri, String localName, String qName)
- throws SAXException {
+ throws SAXException {
processChars();
if (directivesOnly &&
- !(JSP_URI.equals(uri) && localName.startsWith(DIRECTIVE_ACTION))) {
+ !(JSP_URI.equals(uri) && localName.startsWith(DIRECTIVE_ACTION))) {
return;
}
if (current instanceof Node.NamedAttribute) {
- boolean isTrim = ((Node.NamedAttribute)current).isTrim();
- Node.Nodes subElems = ((Node.NamedAttribute)current).getBody();
+ boolean isTrim = ((Node.NamedAttribute) current).isTrim();
+ Node.Nodes subElems = ((Node.NamedAttribute) current).getBody();
for (int i = 0; subElems != null && i < subElems.size(); i++) {
Node subElem = subElems.getNode(i);
if (!(subElem instanceof Node.TemplateText)) {
@@ -627,23 +626,23 @@
// is set to FALSE, which must be kept verbatim.
if (i == 0) {
if (isTrim) {
- ((Node.TemplateText)subElem).ltrim();
+ ((Node.TemplateText) subElem).ltrim();
}
} else if (i == subElems.size() - 1) {
if (isTrim) {
- ((Node.TemplateText)subElem).rtrim();
+ ((Node.TemplateText) subElem).rtrim();
}
} else {
- if (((Node.TemplateText)subElem).isAllSpace()) {
+ if (((Node.TemplateText) subElem).isAllSpace()) {
subElems.remove(subElem);
}
}
}
} else if (current instanceof Node.ScriptingElement) {
- checkScriptingBody((Node.ScriptingElement)current);
+ checkScriptingBody((Node.ScriptingElement) current);
}
- if ( isTagDependent(current)) {
+ if (isTagDependent(current)) {
tagDependentNesting--;
}
@@ -676,11 +675,11 @@
// ignore comments in the DTD
if (!inDTD) {
startMark =
- new Mark(
- ctxt,
- path,
- locator.getLineNumber(),
- locator.getColumnNumber());
+ new Mark(
+ ctxt,
+ path,
+ locator.getLineNumber(),
+ locator.getColumnNumber());
new Node.Comment(new String(buf, offset, len), startMark, current);
}
}
@@ -692,7 +691,7 @@
processChars(); // Flush char buffer and remove white spaces
startMark = new Mark(ctxt, path, locator.getLineNumber(),
- locator.getColumnNumber());
+ locator.getColumnNumber());
}
/*
@@ -720,7 +719,7 @@
* See org.xml.sax.ext.LexicalHandler.
*/
public void startDTD(String name, String publicId, String systemId)
- throws SAXException {
+ throws SAXException {
if (!isValidating) {
fatalError(ENABLE_DTD_VALIDATION_EXCEPTION);
}
@@ -753,20 +752,20 @@
* Receives notification of the start of a Namespace mapping.
*/
public void startPrefixMapping(String prefix, String uri)
- throws SAXException {
+ throws SAXException {
TagLibraryInfo taglibInfo;
if (directivesOnly && !(JSP_URI.equals(uri))) {
return;
}
-
+
try {
taglibInfo = getTaglibInfo(prefix, uri);
} catch (JasperException je) {
throw new SAXParseException(
- Localizer.getMessage("jsp.error.could.not.add.taglibraries"),
- locator,
- je);
+ Localizer.getMessage("jsp.error.could.not.add.taglibraries"),
+ locator,
+ je);
}
if (taglibInfo != null) {
@@ -798,329 +797,329 @@
// Private utility methods
private Node parseStandardAction(
- String qName,
- String localName,
- Attributes nonTaglibAttrs,
- Attributes nonTaglibXmlnsAttrs,
- Attributes taglibAttrs,
- Mark start,
- Node parent)
- throws SAXException {
+ String qName,
+ String localName,
+ Attributes nonTaglibAttrs,
+ Attributes nonTaglibXmlnsAttrs,
+ Attributes taglibAttrs,
+ Mark start,
+ Node parent)
+ throws SAXException {
Node node = null;
if (localName.equals(ROOT_ACTION)) {
if (!(current instanceof Node.Root)) {
throw new SAXParseException(
- Localizer.getMessage("jsp.error.nested_jsproot"),
- locator);
+ Localizer.getMessage("jsp.error.nested_jsproot"),
+ locator);
}
node =
- new Node.JspRoot(
- qName,
- nonTaglibAttrs,
- nonTaglibXmlnsAttrs,
- taglibAttrs,
- start,
- current);
+ new Node.JspRoot(
+ qName,
+ nonTaglibAttrs,
+ nonTaglibXmlnsAttrs,
+ taglibAttrs,
+ start,
+ current);
if (isTop) {
pageInfo.setHasJspRoot(true);
}
} else if (localName.equals(PAGE_DIRECTIVE_ACTION)) {
if (isTagFile) {
throw new SAXParseException(
- Localizer.getMessage(
- "jsp.error.action.istagfile",
- localName),
- locator);
+ Localizer.getMessage(
+ "jsp.error.action.istagfile",
+ localName),
+ locator);
}
node =
- new Node.PageDirective(
- qName,
- nonTaglibAttrs,
- nonTaglibXmlnsAttrs,
- taglibAttrs,
- start,
- current);
+ new Node.PageDirective(
+ qName,
+ nonTaglibAttrs,
+ nonTaglibXmlnsAttrs,
+ taglibAttrs,
+ start,
+ current);
String imports = nonTaglibAttrs.getValue("import");
// There can only be one 'import' attribute per page directive
if (imports != null) {
- ((Node.PageDirective)node).addImport(imports);
+ ((Node.PageDirective) node).addImport(imports);
}
} else if (localName.equals(INCLUDE_DIRECTIVE_ACTION)) {
node =
- new Node.IncludeDirective(
- qName,
- nonTaglibAttrs,
- nonTaglibXmlnsAttrs,
- taglibAttrs,
- start,
- current);
+ new Node.IncludeDirective(
+ qName,
+ nonTaglibAttrs,
+ nonTaglibXmlnsAttrs,
+ taglibAttrs,
+ start,
+ current);
processIncludeDirective(nonTaglibAttrs.getValue("file"), node);
} else if (localName.equals(DECLARATION_ACTION)) {
if (scriptlessBodyNode != null) {
// We're nested inside a node whose body is
// declared to be scriptless
throw new SAXParseException(
- Localizer.getMessage(
- "jsp.error.no.scriptlets",
- localName),
- locator);
+ Localizer.getMessage(
+ "jsp.error.no.scriptlets",
+ localName),
+ locator);
}
node =
- new Node.Declaration(
- qName,
- nonTaglibXmlnsAttrs,
- taglibAttrs,
- start,
- current);
+ new Node.Declaration(
+ qName,
+ nonTaglibXmlnsAttrs,
+ taglibAttrs,
+ start,
+ current);
} else if (localName.equals(SCRIPTLET_ACTION)) {
if (scriptlessBodyNode != null) {
// We're nested inside a node whose body is
// declared to be scriptless
throw new SAXParseException(
- Localizer.getMessage(
- "jsp.error.no.scriptlets",
- localName),
- locator);
+ Localizer.getMessage(
+ "jsp.error.no.scriptlets",
+ localName),
+ locator);
}
node =
- new Node.Scriptlet(
- qName,
- nonTaglibXmlnsAttrs,
- taglibAttrs,
- start,
- current);
+ new Node.Scriptlet(
+ qName,
+ nonTaglibXmlnsAttrs,
+ taglibAttrs,
+ start,
+ current);
} else if (localName.equals(EXPRESSION_ACTION)) {
if (scriptlessBodyNode != null) {
// We're nested inside a node whose body is
// declared to be scriptless
throw new SAXParseException(
- Localizer.getMessage(
- "jsp.error.no.scriptlets",
- localName),
- locator);
+ Localizer.getMessage(
+ "jsp.error.no.scriptlets",
+ localName),
+ locator);
}
node =
- new Node.Expression(
- qName,
- nonTaglibXmlnsAttrs,
- taglibAttrs,
- start,
- current);
+ new Node.Expression(
+ qName,
+ nonTaglibXmlnsAttrs,
+ taglibAttrs,
+ start,
+ current);
} else if (localName.equals(USE_BEAN_ACTION)) {
node =
- new Node.UseBean(
- qName,
- nonTaglibAttrs,
- nonTaglibXmlnsAttrs,
- taglibAttrs,
- start,
- current);
+ new Node.UseBean(
+ qName,
+ nonTaglibAttrs,
+ nonTaglibXmlnsAttrs,
+ taglibAttrs,
+ start,
+ current);
} else if (localName.equals(SET_PROPERTY_ACTION)) {
node =
- new Node.SetProperty(
- qName,
- nonTaglibAttrs,
- nonTaglibXmlnsAttrs,
- taglibAttrs,
- start,
- current);
+ new Node.SetProperty(
+ qName,
+ nonTaglibAttrs,
+ nonTaglibXmlnsAttrs,
+ taglibAttrs,
+ start,
+ current);
} else if (localName.equals(GET_PROPERTY_ACTION)) {
node =
- new Node.GetProperty(
- qName,
- nonTaglibAttrs,
- nonTaglibXmlnsAttrs,
- taglibAttrs,
- start,
- current);
+ new Node.GetProperty(
+ qName,
+ nonTaglibAttrs,
+ nonTaglibXmlnsAttrs,
+ taglibAttrs,
+ start,
+ current);
} else if (localName.equals(INCLUDE_ACTION)) {
node =
- new Node.IncludeAction(
- qName,
- nonTaglibAttrs,
- nonTaglibXmlnsAttrs,
- taglibAttrs,
- start,
- current);
+ new Node.IncludeAction(
+ qName,
+ nonTaglibAttrs,
+ nonTaglibXmlnsAttrs,
+ taglibAttrs,
+ start,
+ current);
} else if (localName.equals(FORWARD_ACTION)) {
node =
- new Node.ForwardAction(
- qName,
- nonTaglibAttrs,
- nonTaglibXmlnsAttrs,
- taglibAttrs,
- start,
- current);
+ new Node.ForwardAction(
+ qName,
+ nonTaglibAttrs,
+ nonTaglibXmlnsAttrs,
+ taglibAttrs,
+ start,
+ current);
} else if (localName.equals(PARAM_ACTION)) {
node =
- new Node.ParamAction(
- qName,
- nonTaglibAttrs,
- nonTaglibXmlnsAttrs,
- taglibAttrs,
- start,
- current);
+ new Node.ParamAction(
+ qName,
+ nonTaglibAttrs,
+ nonTaglibXmlnsAttrs,
+ taglibAttrs,
+ start,
+ current);
} else if (localName.equals(PARAMS_ACTION)) {
node =
- new Node.ParamsAction(
- qName,
- nonTaglibXmlnsAttrs,
- taglibAttrs,
- start,
- current);
+ new Node.ParamsAction(
+ qName,
+ nonTaglibXmlnsAttrs,
+ taglibAttrs,
+ start,
+ current);
} else if (localName.equals(PLUGIN_ACTION)) {
node =
- new Node.PlugIn(
- qName,
- nonTaglibAttrs,
- nonTaglibXmlnsAttrs,
- taglibAttrs,
- start,
- current);
+ new Node.PlugIn(
+ qName,
+ nonTaglibAttrs,
+ nonTaglibXmlnsAttrs,
+ taglibAttrs,
+ start,
+ current);
} else if (localName.equals(TEXT_ACTION)) {
node =
- new Node.JspText(
- qName,
- nonTaglibXmlnsAttrs,
- taglibAttrs,
- start,
- current);
+ new Node.JspText(
+ qName,
+ nonTaglibXmlnsAttrs,
+ taglibAttrs,
+ start,
+ current);
} else if (localName.equals(BODY_ACTION)) {
node =
- new Node.JspBody(
- qName,
- nonTaglibXmlnsAttrs,
- taglibAttrs,
- start,
- current);
+ new Node.JspBody(
+ qName,
+ nonTaglibXmlnsAttrs,
+ taglibAttrs,
+ start,
+ current);
} else if (localName.equals(ATTRIBUTE_ACTION)) {
node =
- new Node.NamedAttribute(
- qName,
- nonTaglibAttrs,
- nonTaglibXmlnsAttrs,
- taglibAttrs,
- start,
- current);
+ new Node.NamedAttribute(
+ qName,
+ nonTaglibAttrs,
+ nonTaglibXmlnsAttrs,
+ taglibAttrs,
+ start,
+ current);
} else if (localName.equals(OUTPUT_ACTION)) {
node =
- new Node.JspOutput(
- qName,
- nonTaglibAttrs,
- nonTaglibXmlnsAttrs,
- taglibAttrs,
- start,
- current);
+ new Node.JspOutput(
+ qName,
+ nonTaglibAttrs,
+ nonTaglibXmlnsAttrs,
+ taglibAttrs,
+ start,
+ current);
} else if (localName.equals(TAG_DIRECTIVE_ACTION)) {
if (!isTagFile) {
throw new SAXParseException(
- Localizer.getMessage(
- "jsp.error.action.isnottagfile",
- localName),
- locator);
+ Localizer.getMessage(
+ "jsp.error.action.isnottagfile",
+ localName),
+ locator);
}
node =
- new Node.TagDirective(
- qName,
- nonTaglibAttrs,
- nonTaglibXmlnsAttrs,
- taglibAttrs,
- start,
- current);
+ new Node.TagDirective(
+ qName,
+ nonTaglibAttrs,
+ nonTaglibXmlnsAttrs,
+ taglibAttrs,
+ start,
+ current);
String imports = nonTaglibAttrs.getValue("import");
// There can only be one 'import' attribute per tag directive
if (imports != null) {
- ((Node.TagDirective)node).addImport(imports);
+ ((Node.TagDirective) node).addImport(imports);
}
} else if (localName.equals(ATTRIBUTE_DIRECTIVE_ACTION)) {
if (!isTagFile) {
throw new SAXParseException(
- Localizer.getMessage(
- "jsp.error.action.isnottagfile",
- localName),
- locator);
+ Localizer.getMessage(
+ "jsp.error.action.isnottagfile",
+ localName),
+ locator);
}
node =
- new Node.AttributeDirective(
- qName,
- nonTaglibAttrs,
- nonTaglibXmlnsAttrs,
- taglibAttrs,
- start,
- current);
+ new Node.AttributeDirective(
+ qName,
+ nonTaglibAttrs,
+ nonTaglibXmlnsAttrs,
+ taglibAttrs,
+ start,
+ current);
} else if (localName.equals(VARIABLE_DIRECTIVE_ACTION)) {
if (!isTagFile) {
throw new SAXParseException(
- Localizer.getMessage(
- "jsp.error.action.isnottagfile",
- localName),
- locator);
+ Localizer.getMessage(
+ "jsp.error.action.isnottagfile",
+ localName),
+ locator);
}
node =
- new Node.VariableDirective(
- qName,
- nonTaglibAttrs,
- nonTaglibXmlnsAttrs,
- taglibAttrs,
- start,
- current);
+ new Node.VariableDirective(
+ qName,
+ nonTaglibAttrs,
+ nonTaglibXmlnsAttrs,
+ taglibAttrs,
+ start,
+ current);
} else if (localName.equals(INVOKE_ACTION)) {
if (!isTagFile) {
throw new SAXParseException(
- Localizer.getMessage(
- "jsp.error.action.isnottagfile",
- localName),
- locator);
+ Localizer.getMessage(
+ "jsp.error.action.isnottagfile",
+ localName),
+ locator);
}
node =
- new Node.InvokeAction(
- qName,
- nonTaglibAttrs,
- nonTaglibXmlnsAttrs,
- taglibAttrs,
- start,
- current);
+ new Node.InvokeAction(
+ qName,
+ nonTaglibAttrs,
+ nonTaglibXmlnsAttrs,
+ taglibAttrs,
+ start,
+ current);
} else if (localName.equals(DOBODY_ACTION)) {
if (!isTagFile) {
throw new SAXParseException(
- Localizer.getMessage(
- "jsp.error.action.isnottagfile",
- localName),
- locator);
+ Localizer.getMessage(
+ "jsp.error.action.isnottagfile",
+ localName),
+ locator);
}
node =
- new Node.DoBodyAction(
- qName,
- nonTaglibAttrs,
- nonTaglibXmlnsAttrs,
- taglibAttrs,
- start,
- current);
+ new Node.DoBodyAction(
+ qName,
+ nonTaglibAttrs,
+ nonTaglibXmlnsAttrs,
+ taglibAttrs,
+ start,
+ current);
} else if (localName.equals(ELEMENT_ACTION)) {
node =
- new Node.JspElement(
- qName,
- nonTaglibAttrs,
- nonTaglibXmlnsAttrs,
- taglibAttrs,
- start,
- current);
+ new Node.JspElement(
+ qName,
+ nonTaglibAttrs,
+ nonTaglibXmlnsAttrs,
+ taglibAttrs,
+ start,
+ current);
} else if (localName.equals(FALLBACK_ACTION)) {
node =
- new Node.FallBackAction(
- qName,
- nonTaglibXmlnsAttrs,
- taglibAttrs,
- start,
- current);
+ new Node.FallBackAction(
+ qName,
+ nonTaglibXmlnsAttrs,
+ taglibAttrs,
+ start,
+ current);
} else {
throw new SAXParseException(
- Localizer.getMessage(
- "jsp.error.xml.badStandardAction",
- localName),
- locator);
+ Localizer.getMessage(
+ "jsp.error.xml.badStandardAction",
+ localName),
+ locator);
}
return node;
@@ -1131,15 +1130,15 @@
* and returns the corresponding Node object.
*/
private Node parseCustomAction(
- String qName,
- String localName,
- String uri,
- Attributes nonTaglibAttrs,
- Attributes nonTaglibXmlnsAttrs,
- Attributes taglibAttrs,
- Mark start,
- Node parent)
- throws SAXException {
+ String qName,
+ String localName,
+ String uri,
+ Attributes nonTaglibAttrs,
+ Attributes nonTaglibXmlnsAttrs,
+ Attributes taglibAttrs,
+ Mark start,
+ Node parent)
+ throws SAXException {
// Check if this is a user-defined (custom) tag
TagLibraryInfo tagLibInfo = pageInfo.getTaglib(uri);
@@ -1151,20 +1150,20 @@
TagFileInfo tagFileInfo = tagLibInfo.getTagFile(localName);
if (tagInfo == null && tagFileInfo == null) {
throw new SAXException(
- Localizer.getMessage("jsp.error.xml.bad_tag", localName, uri));
+ Localizer.getMessage("jsp.error.xml.bad_tag", localName, uri));
}
Class tagHandlerClass = null;
if (tagInfo != null) {
String handlerClassName = tagInfo.getTagClassName();
try {
tagHandlerClass =
- ctxt.getClassLoader().loadClass(handlerClassName);
+ ctxt.getClassLoader().loadClass(handlerClassName);
} catch (Exception e) {
throw new SAXException(
- Localizer.getMessage("jsp.error.loadclass.taghandler",
- handlerClassName,
- qName),
- e);
+ Localizer.getMessage("jsp.error.loadclass.taghandler",
+ handlerClassName,
+ qName),
+ e);
}
}
@@ -1173,31 +1172,31 @@
Node.CustomTag ret = null;
if (tagInfo != null) {
ret =
- new Node.CustomTag(
- qName,
- prefix,
- localName,
- uri,
- nonTaglibAttrs,
- nonTaglibXmlnsAttrs,
- taglibAttrs,
- start,
- parent,
- tagInfo,
- tagHandlerClass);
+ new Node.CustomTag(
+ qName,
+ prefix,
+ localName,
+ uri,
+ nonTaglibAttrs,
+ nonTaglibXmlnsAttrs,
+ taglibAttrs,
+ start,
+ parent,
+ tagInfo,
+ tagHandlerClass);
} else {
ret =
- new Node.CustomTag(
- qName,
- prefix,
- localName,
- uri,
- nonTaglibAttrs,
- nonTaglibXmlnsAttrs,
- taglibAttrs,
- start,
- parent,
- tagFileInfo);
+ new Node.CustomTag(
+ qName,
+ prefix,
+ localName,
+ uri,
+ nonTaglibAttrs,
+ nonTaglibXmlnsAttrs,
+ taglibAttrs,
+ start,
+ parent,
+ tagFileInfo);
}
return ret;
@@ -1213,7 +1212,7 @@
* @return The tag library associated with the given uri namespace
*/
private TagLibraryInfo getTaglibInfo(String prefix, String uri)
- throws JasperException {
+ throws JasperException {
TagLibraryInfo result = null;
@@ -1221,12 +1220,12 @@
// uri (of the form "urn:jsptagdir:path") references tag file dir
String tagdir = uri.substring(URN_JSPTAGDIR.length());
result =
- new ImplicitTagLibraryInfo(
- ctxt,
- parserController,
- prefix,
- tagdir,
- err);
+ new ImplicitTagLibraryInfo(
+ ctxt,
+ parserController,
+ prefix,
+ tagdir,
+ err);
} else {
// uri references TLD file
boolean isPlainUri = false;
@@ -1250,13 +1249,13 @@
* value must be treated as uninterpreted.
*/
result =
- new TagLibraryInfoImpl(
- ctxt,
- parserController,
- prefix,
- uri,
- location,
- err);
+ new TagLibraryInfoImpl(
+ ctxt,
+ parserController,
+ prefix,
+ uri,
+ location,
+ err);
if (ctxt.getOptions().isCaching()) {
ctxt.getOptions().getCache().put(uri, result);
}
@@ -1276,7 +1275,7 @@
* scripting element has been reached.
*/
private void checkScriptingBody(Node.ScriptingElement scriptingElem)
- throws SAXException {
+ throws SAXException {
Node.Nodes body = scriptingElem.getBody();
if (body != null) {
int size = body.size();
@@ -1289,9 +1288,9 @@
if (scriptingElem instanceof Node.Expression)
elemType = EXPRESSION_ACTION;
String msg =
- Localizer.getMessage(
- "jsp.error.parse.xml.scripting.invalid.body",
- elemType);
+ Localizer.getMessage(
+ "jsp.error.parse.xml.scripting.invalid.body",
+ elemType);
throw new SAXException(msg);
}
}
@@ -1306,7 +1305,7 @@
* @param parent The Node representing the include directive
*/
private void processIncludeDirective(String fname, Node parent)
- throws SAXException {
+ throws SAXException {
if (fname == null) {
return;
@@ -1316,9 +1315,9 @@
parserController.parse(fname, parent, null);
} catch (FileNotFoundException fnfe) {
throw new SAXParseException(
- Localizer.getMessage("jsp.error.file.not.found", fname),
- locator,
- fnfe);
+ Localizer.getMessage("jsp.error.file.not.found", fname),
+ locator,
+ fnfe);
} catch (Exception e) {
throw new SAXException(e);
}
@@ -1380,22 +1379,22 @@
* @return The SAXParser
*/
private static SAXParser getSAXParser(
- boolean validating,
- JspDocumentParser jspDocParser)
- throws Exception {
+ boolean validating,
+ JspDocumentParser jspDocParser)
+ throws Exception {
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setNamespaceAware(true);
// Preserve xmlns attributes
factory.setFeature(
- "http://xml.org/sax/features/namespace-prefixes",
- true);
+ "http://xml.org/sax/features/namespace-prefixes",
+ true);
factory.setValidating(validating);
//factory.setFeature(
// "http://xml.org/sax/features/validation",
// validating);
-
+
// Configure the parser
SAXParser saxParser = factory.newSAXParser();
XMLReader xmlReader = saxParser.getXMLReader();
@@ -1410,7 +1409,7 @@
* validation is turned off.
*/
private static class EnableDTDValidationException
- extends SAXParseException {
+ extends SAXParseException {
EnableDTDValidationException(String message, Locator loc) {
super(message, loc);
@@ -1431,7 +1430,7 @@
if (n instanceof Node.CustomTag) {
String bodyType = getBodyType((Node.CustomTag) n);
return
- TagInfo.BODY_CONTENT_TAG_DEPENDENT.equalsIgnoreCase(bodyType);
+ TagInfo.BODY_CONTENT_TAG_DEPENDENT.equalsIgnoreCase(bodyType);
}
return false;
}