FileDocCategorySizeDatePackage
PageInfo.javaAPI DocApache Tomcat 6.0.1419675Fri Jul 20 04:20:36 BST 2007org.apache.jasper.compiler

PageInfo

public class PageInfo extends Object
A repository for various info about the translation unit under compilation.
author
Kin-man Chung

Fields Summary
private Vector
imports
private Vector
dependants
private BeanRepository
beanRepository
private HashMap
taglibsMap
private HashMap
jspPrefixMapper
private HashMap
xmlPrefixMapper
private HashMap
nonCustomTagPrefixMap
private String
jspFile
private String
defaultLanguage
private String
language
private String
defaultExtends
private String
xtends
private String
contentType
private String
session
private boolean
isSession
private String
bufferValue
private int
buffer
private String
autoFlush
private boolean
isAutoFlush
private String
isThreadSafeValue
private boolean
isThreadSafe
private String
isErrorPageValue
private boolean
isErrorPage
private String
errorPage
private String
info
private boolean
scriptless
private boolean
scriptingInvalid
private String
isELIgnoredValue
private boolean
isELIgnored
private String
deferredSyntaxAllowedAsLiteralValue
private boolean
deferredSyntaxAllowedAsLiteral
private ExpressionFactory
expressionFactory
private String
trimDirectiveWhitespacesValue
private boolean
trimDirectiveWhitespaces
private String
omitXmlDecl
private String
doctypeName
private String
doctypePublic
private String
doctypeSystem
private boolean
isJspPrefixHijacked
private HashSet
prefixes
private boolean
hasJspRoot
private Vector
includePrelude
private Vector
includeCoda
private Vector
pluginDcls
Constructors Summary
PageInfo(BeanRepository beanRepository, String jspFile)

      // Id's for tagplugin declarations


        

        this.jspFile = jspFile;
        this.beanRepository = beanRepository;
        this.taglibsMap = new HashMap();
        this.jspPrefixMapper = new HashMap();
        this.xmlPrefixMapper = new HashMap();
        this.nonCustomTagPrefixMap = new HashMap();
        this.imports = new Vector();
        this.dependants = new Vector();
        this.includePrelude = new Vector();
        this.includeCoda = new Vector();
        this.pluginDcls = new Vector();
        this.prefixes = new HashSet();

        // Enter standard imports
        for(int i = 0; i < Constants.STANDARD_IMPORTS.length; i++)
            imports.add(Constants.STANDARD_IMPORTS[i]);
    
Methods Summary
public voidaddDependant(java.lang.String d)

        if (!dependants.contains(d) && !jspFile.equals(d))
                dependants.add(d);
    
public voidaddImport(java.lang.String imp)

        this.imports.add(imp);
    
public voidaddImports(java.util.List imports)

        this.imports.addAll(imports);
    
public voidaddPrefix(java.lang.String prefix)

        prefixes.add(prefix);
    
public voidaddPrefixMapping(java.lang.String prefix, java.lang.String uri)

        jspPrefixMapper.put(prefix, uri);
    
public voidaddTaglib(java.lang.String uri, javax.servlet.jsp.tagext.TagLibraryInfo info)

        taglibsMap.put(uri, info);
    
public booleancontainsPrefix(java.lang.String prefix)

        return prefixes.contains(prefix);
    
public java.lang.StringgetAutoFlush()

        return autoFlush;
    
public BeanRepositorygetBeanRepository()

        return beanRepository;
    
public intgetBuffer()

        return buffer;
    
public java.lang.StringgetBufferValue()

        return bufferValue;
    
public java.lang.StringgetContentType()

        return contentType;
    
public java.lang.StringgetDeferredSyntaxAllowedAsLiteral()

        return deferredSyntaxAllowedAsLiteralValue;
    
public java.util.ListgetDependants()

        return dependants;
    
public java.lang.StringgetDoctypeName()

        return doctypeName;
    
public java.lang.StringgetDoctypePublic()

        return doctypePublic;
    
public java.lang.StringgetDoctypeSystem()

        return doctypeSystem;
    
public java.lang.StringgetErrorPage()

        return errorPage;
    
public javax.el.ExpressionFactorygetExpressionFactory()

        return expressionFactory;
    
public java.lang.StringgetExtends(boolean useDefault)
Gets the value of the 'extends' page directive attribute.

param
useDefault TRUE if the default (org.apache.jasper.runtime.HttpJspBase) should be returned if this attribute has not been set, FALSE otherwise
return
The value of the 'extends' page directive attribute, or the default (org.apache.jasper.runtime.HttpJspBase) if this attribute has not been set and useDefault is TRUE

        return (xtends == null && useDefault ? defaultExtends : xtends);
    
public java.lang.StringgetExtends()
Gets the value of the 'extends' page directive attribute.

return
The value of the 'extends' page directive attribute, or the default (org.apache.jasper.runtime.HttpJspBase) if this attribute has not been set

        return getExtends(true);
    
public java.util.ListgetImports()

        return imports;
    
public java.util.ListgetIncludeCoda()

        return includeCoda;
    
public java.util.ListgetIncludePrelude()

        return includePrelude;
    
public java.lang.StringgetInfo()

        return info;
    
public java.lang.StringgetIsELIgnored()

        return isELIgnoredValue;
    
public java.lang.StringgetIsErrorPage()

        return isErrorPageValue;
    
public java.lang.StringgetIsThreadSafe()

        return isThreadSafeValue;
    
public java.lang.StringgetJspFile()

        return jspFile;
    
public java.lang.StringgetLanguage(boolean useDefault)

        return (language == null && useDefault ? defaultLanguage : language);
    
public java.lang.StringgetLanguage()

        return getLanguage(true);
    
public MarkgetNonCustomTagPrefix(java.lang.String prefix)

        return (Mark) nonCustomTagPrefixMap.get(prefix);
    
public java.lang.StringgetOmitXmlDecl()

        return omitXmlDecl;
    
public java.lang.StringgetSession()

        return session;
    
public javax.servlet.jsp.tagext.TagLibraryInfogetTaglib(java.lang.String uri)

        return (TagLibraryInfo) taglibsMap.get(uri);
    
public java.util.CollectiongetTaglibs()

        return taglibsMap.values();
    
public java.lang.StringgetTrimDirectiveWhitespaces()

        return trimDirectiveWhitespacesValue;
    
public java.lang.StringgetURI(java.lang.String prefix)


        String uri = null;

        LinkedList stack = (LinkedList) xmlPrefixMapper.get(prefix);
        if (stack == null || stack.size() == 0) {
            uri = (String) jspPrefixMapper.get(prefix);
        } else {
            uri = (String) stack.getFirst();
        }

        return uri;
    
public booleanhasJspRoot()

        return hasJspRoot;
    
public booleanhasTaglib(java.lang.String uri)

        return taglibsMap.containsKey(uri);
    
public booleanisAutoFlush()

        return isAutoFlush;
    
public booleanisDeferredSyntaxAllowedAsLiteral()

        return deferredSyntaxAllowedAsLiteral;
    
public booleanisELIgnored()

        return isELIgnored;
    
public booleanisErrorPage()

        return isErrorPage;
    
public booleanisJspPrefixHijacked()

        return isJspPrefixHijacked;
    
public booleanisPluginDeclared(java.lang.String id)
Check if the plugin ID has been previously declared. Make a not that this Id is now declared.

return
true if Id has been declared.

        if (pluginDcls.contains(id))
            return true;
        pluginDcls.add(id);
        return false;
    
public booleanisScriptingInvalid()

        return scriptingInvalid;
    
public booleanisScriptless()

        return scriptless;
    
public booleanisSession()

        return isSession;
    
public booleanisThreadSafe()

        return isThreadSafe;
    
public booleanisTrimDirectiveWhitespaces()

        return trimDirectiveWhitespaces;
    
public voidpopPrefixMapping(java.lang.String prefix)

        LinkedList stack = (LinkedList) xmlPrefixMapper.get(prefix);
        if (stack == null || stack.size() == 0) {
            // XXX throw new Exception("XXX");
        }
        stack.removeFirst();
    
public voidpushPrefixMapping(java.lang.String prefix, java.lang.String uri)

        LinkedList stack = (LinkedList) xmlPrefixMapper.get(prefix);
        if (stack == null) {
            stack = new LinkedList();
            xmlPrefixMapper.put(prefix, stack);
        }
        stack.addFirst(uri);
    
public voidputNonCustomTagPrefix(java.lang.String prefix, Mark where)

        nonCustomTagPrefixMap.put(prefix, where);
    
public voidsetAutoFlush(java.lang.String value, Node n, ErrorDispatcher err)


        if ("true".equalsIgnoreCase(value))
            isAutoFlush = true;
        else if ("false".equalsIgnoreCase(value))
            isAutoFlush = false;
        else
            err.jspError(n, "jsp.error.autoFlush.invalid");

        autoFlush = value;
    
public voidsetBufferValue(java.lang.String value, Node n, ErrorDispatcher err)


        if ("none".equalsIgnoreCase(value))
            buffer = 0;
        else {
            if (value == null || !value.endsWith("kb"))
                err.jspError(n, "jsp.error.page.invalid.buffer");
            try {
                Integer k = new Integer(value.substring(0, value.length()-2));
                buffer = k.intValue() * 1024;
            } catch (NumberFormatException e) {
                err.jspError(n, "jsp.error.page.invalid.buffer");
            }
        }

        bufferValue = value;
    
public voidsetContentType(java.lang.String value)

        contentType = value;
    
public voidsetDeferredSyntaxAllowedAsLiteral(java.lang.String value, Node n, ErrorDispatcher err, boolean pagedir)


        if ("true".equalsIgnoreCase(value))
            deferredSyntaxAllowedAsLiteral = true;
        else if ("false".equalsIgnoreCase(value))
            deferredSyntaxAllowedAsLiteral = false;
        else {
            if (pagedir)
                err.jspError(n, "jsp.error.page.invalid.deferredsyntaxallowedasliteral");
            else
                err.jspError(n, "jsp.error.tag.invalid.deferredsyntaxallowedasliteral");
        }

        deferredSyntaxAllowedAsLiteralValue = value;
    
public voidsetDeferredSyntaxAllowedAsLiteral(boolean isELDeferred)

        this.deferredSyntaxAllowedAsLiteral = isELDeferred;
    
public voidsetDoctypeName(java.lang.String doctypeName)

        this.doctypeName = doctypeName;
    
public voidsetDoctypePublic(java.lang.String doctypePublic)

        this.doctypePublic = doctypePublic;
    
public voidsetDoctypeSystem(java.lang.String doctypeSystem)

        this.doctypeSystem = doctypeSystem;
    
public voidsetELIgnored(boolean s)

        isELIgnored = s;
    
public voidsetErrorPage(java.lang.String value)

        errorPage = value;
    
public voidsetExtends(java.lang.String value, Node.PageDirective n)


        xtends = value;

        /*
         * If page superclass is top level class (i.e. not in a package)
         * explicitly import it. If this is not done, the compiler will assume
         * the extended class is in the same pkg as the generated servlet.
         */
        if (value.indexOf('.") < 0)
            n.addImport(value);
    
public voidsetHasJspRoot(boolean s)

        hasJspRoot = s;
    
public voidsetIncludeCoda(java.util.Vector coda)

        includeCoda = coda;
    
public voidsetIncludePrelude(java.util.Vector prelude)

        includePrelude = prelude;
    
public voidsetInfo(java.lang.String value)

        info = value;
    
public voidsetIsELIgnored(java.lang.String value, Node n, ErrorDispatcher err, boolean pagedir)


        if ("true".equalsIgnoreCase(value))
            isELIgnored = true;
        else if ("false".equalsIgnoreCase(value))
            isELIgnored = false;
        else {
            if (pagedir)
                err.jspError(n, "jsp.error.page.invalid.iselignored");
            else
                err.jspError(n, "jsp.error.tag.invalid.iselignored");
        }

        isELIgnoredValue = value;
    
public voidsetIsErrorPage(java.lang.String value, Node n, ErrorDispatcher err)


        if ("true".equalsIgnoreCase(value))
            isErrorPage = true;
        else if ("false".equalsIgnoreCase(value))
            isErrorPage = false;
        else
            err.jspError(n, "jsp.error.page.invalid.iserrorpage");

        isErrorPageValue = value;
    
public voidsetIsJspPrefixHijacked(boolean isHijacked)

        isJspPrefixHijacked = isHijacked;
    
public voidsetIsThreadSafe(java.lang.String value, Node n, ErrorDispatcher err)


        if ("true".equalsIgnoreCase(value))
            isThreadSafe = true;
        else if ("false".equalsIgnoreCase(value))
            isThreadSafe = false;
        else
            err.jspError(n, "jsp.error.page.invalid.isthreadsafe");

        isThreadSafeValue = value;
    
public voidsetLanguage(java.lang.String value, Node n, ErrorDispatcher err, boolean pagedir)


        if (!"java".equalsIgnoreCase(value)) {
            if (pagedir)
                err.jspError(n, "jsp.error.page.language.nonjava");
            else
                err.jspError(n, "jsp.error.tag.language.nonjava");
        }

        language = value;
    
public voidsetOmitXmlDecl(java.lang.String omit)

        omitXmlDecl = omit;
    
public voidsetScriptingInvalid(boolean s)

        scriptingInvalid = s;
    
public voidsetScriptless(boolean s)

        scriptless = s;
    
public voidsetSession(java.lang.String value, Node n, ErrorDispatcher err)


        if ("true".equalsIgnoreCase(value))
            isSession = true;
        else if ("false".equalsIgnoreCase(value))
            isSession = false;
        else
            err.jspError(n, "jsp.error.page.invalid.session");

        session = value;
    
public voidsetTrimDirectiveWhitespaces(java.lang.String value, Node n, ErrorDispatcher err, boolean pagedir)


        if ("true".equalsIgnoreCase(value))
            trimDirectiveWhitespaces = true;
        else if ("false".equalsIgnoreCase(value))
            trimDirectiveWhitespaces = false;
        else {
            if (pagedir)
                err.jspError(n, "jsp.error.page.invalid.trimdirectivewhitespaces");
            else
                err.jspError(n, "jsp.error.tag.invalid.trimdirectivewhitespaces");
        }

        trimDirectiveWhitespacesValue = value;
    
public voidsetTrimDirectiveWhitespaces(boolean trimDirectiveWhitespaces)

        this.trimDirectiveWhitespaces = trimDirectiveWhitespaces;