bundles/org.apache.jasper.glassfish/src/org/apache/jasper/compiler/JspConfig.java
public JspProperty findJspProperty(String uri) throws JasperException {

	init();

	// JSP Configuration settings do not apply to tag files	    
	if (jspProperties == null || uri.endsWith(".tag")
	        || uri.endsWith(".tagx")) {
	    return defaultJspProperty;
	}

	String uriPath = null;
	int index = uri.lastIndexOf('/');
	if (index >=0 ) {
	    uriPath = uri.substring(0, index+1);
	}
	String uriExtension = null;
	index = uri.lastIndexOf('.');
	if (index >=0) {
	    uriExtension = uri.substring(index+1);
	}

	ArrayList<String> includePreludes = new ArrayList<String>();
	ArrayList<String> includeCodas = new ArrayList<String>();

	JspPropertyGroup isXmlMatch = null;
	JspPropertyGroup elIgnoredMatch = null;
	JspPropertyGroup scriptingInvalidMatch = null;
	JspPropertyGroup trimSpacesMatch = null;
	JspPropertyGroup poundAllowedMatch = null;
	JspPropertyGroup pageEncodingMatch = null;
	JspPropertyGroup defaultContentTypeMatch = null;
	JspPropertyGroup bufferMatch = null;
	JspPropertyGroup errorOnUndeclaredNamespaceMatch = null;

        for (JspPropertyGroup jpg: jspProperties) {

	    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);
             }
             if (jp.getTrimSpaces() != null) {
                 trimSpacesMatch = selectProperty(trimSpacesMatch, jpg);
             }
             if (jp.getPoundAllowed() != null) {
                 poundAllowedMatch = selectProperty(poundAllowedMatch, jpg);
             }
             if (jp.getDefaultContentType() != null) {
                 defaultContentTypeMatch =
                     selectProperty(defaultContentTypeMatch, jpg);
             }
             if (jp.getBuffer() != null) {
                 bufferMatch = selectProperty(bufferMatch, jpg);
             }
             if (jp.errorOnUndeclaredNamespace() != null) {
                 errorOnUndeclaredNamespaceMatch =
                     selectProperty(errorOnUndeclaredNamespaceMatch, jpg);
             }
	}


	String isXml = defaultIsXml;
	String isELIgnored = defaultIsELIgnored;
	String isScriptingInvalid = defaultIsScriptingInvalid;
        String trimSpaces = defaultTrimSpaces;
        String poundAllowed = defaultPoundAllowed;
	String pageEncoding = null;
        String defaultContentType = null;
        String buffer = null;
        String errorOnUndeclaredNamespace = defaultErrorOnUndeclaredNamespace;

	if (isXmlMatch != null) {
	    isXml = isXmlMatch.getJspProperty().isXml();
	}
	if (elIgnoredMatch != null) {
	    isELIgnored = elIgnoredMatch.getJspProperty().isELIgnored();
	}
	if (scriptingInvalidMatch != null) {
	    isScriptingInvalid =
		scriptingInvalidMatch.getJspProperty().isScriptingInvalid();
	}
	if (trimSpacesMatch != null) {
	    trimSpaces = trimSpacesMatch.getJspProperty().getTrimSpaces();
	}
	if (poundAllowedMatch != null) {
	    poundAllowed = poundAllowedMatch.getJspProperty().getPoundAllowed();
	}
	if (pageEncodingMatch != null) {
	    pageEncoding = pageEncodingMatch.getJspProperty().getPageEncoding();
	}
	if (defaultContentTypeMatch != null) {
	    defaultContentType =
                defaultContentTypeMatch.getJspProperty().getDefaultContentType();
	}
	if (bufferMatch != null) {
	    buffer = bufferMatch.getJspProperty().getBuffer();
	}
	if (errorOnUndeclaredNamespaceMatch != null) {
	    errorOnUndeclaredNamespace = errorOnUndeclaredNamespaceMatch.
                getJspProperty().errorOnUndeclaredNamespace();
	}

	return new JspProperty(isXml, isELIgnored, isScriptingInvalid,
                               trimSpaces, poundAllowed,
			       pageEncoding, includePreludes, includeCodas,
                               defaultContentType, buffer,
                               errorOnUndeclaredNamespace);
    }
public JspProperty findJspProperty(String uri) throws JasperException {

	init();

	// JSP Configuration settings do not apply to tag files	    
	if (jspProperties == null || uri.endsWith(".tag")
	        || uri.endsWith(".tagx")) {
	    return defaultJspProperty;
	}

	String uriPath = null;
	int index = uri.lastIndexOf('/');
	if (index >=0 ) {
	    uriPath = uri.substring(0, index+1);
	}
	String uriExtension = null;
	index = uri.lastIndexOf('.');
	if (index >=0) {
	    uriExtension = uri.substring(index+1);
	}

	ArrayList<String> includePreludes = new ArrayList<String>();
	ArrayList<String> includeCodas = new ArrayList<String>();

	JspPropertyGroup isXmlMatch = null;
	JspPropertyGroup elIgnoredMatch = null;
	JspPropertyGroup scriptingInvalidMatch = null;
	JspPropertyGroup trimSpacesMatch = null;
	JspPropertyGroup poundAllowedMatch = null;
	JspPropertyGroup pageEncodingMatch = null;
	JspPropertyGroup defaultContentTypeMatch = null;
	JspPropertyGroup bufferMatch = null;
	JspPropertyGroup errorOnUndeclaredNamespaceMatch = null;

        for (JspPropertyGroup jpg: jspProperties) {

	    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);
             }
             if (jp.getTrimSpaces() != null) {
                 trimSpacesMatch = selectProperty(trimSpacesMatch, jpg);
             }
             if (jp.getPoundAllowed() != null) {
                 poundAllowedMatch = selectProperty(poundAllowedMatch, jpg);
             }
             if (jp.getDefaultContentType() != null) {
                 defaultContentTypeMatch =
                     selectProperty(defaultContentTypeMatch, jpg);
             }
             if (jp.getBuffer() != null) {
                 bufferMatch = selectProperty(bufferMatch, jpg);
             }
             if (jp.errorOnUndeclaredNamespace() != null) {
                 errorOnUndeclaredNamespaceMatch =
                     selectProperty(errorOnUndeclaredNamespaceMatch, jpg);
             }
	}


	String isXml = defaultIsXml;
	String isELIgnored = defaultIsELIgnored;
	String isScriptingInvalid = defaultIsScriptingInvalid;
        String trimSpaces = defaultTrimSpaces;
        String poundAllowed = defaultPoundAllowed;
	String pageEncoding = null;
        String defaultContentType = null;
        String buffer = null;
        String errorOnUndeclaredNamespace = defaultErrorOnUndeclaredNamespace;

	if (isXmlMatch != null) {
	    isXml = isXmlMatch.getJspProperty().isXml();
	}
	if (elIgnoredMatch != null) {
	    isELIgnored = elIgnoredMatch.getJspProperty().isELIgnored();
	}
	if (scriptingInvalidMatch != null) {
	    isScriptingInvalid =
		scriptingInvalidMatch.getJspProperty().isScriptingInvalid();
	}
	if (trimSpacesMatch != null) {
	    trimSpaces = trimSpacesMatch.getJspProperty().getTrimSpaces();
	}
	if (poundAllowedMatch != null) {
	    poundAllowed = poundAllowedMatch.getJspProperty().getPoundAllowed();
	}
	if (pageEncodingMatch != null) {
	    pageEncoding = pageEncodingMatch.getJspProperty().getPageEncoding();
	}
	if (defaultContentTypeMatch != null) {
	    defaultContentType =
                defaultContentTypeMatch.getJspProperty().getDefaultContentType();
	}
	if (bufferMatch != null) {
	    buffer = bufferMatch.getJspProperty().getBuffer();
	}
	if (errorOnUndeclaredNamespaceMatch != null) {
	    errorOnUndeclaredNamespace = errorOnUndeclaredNamespaceMatch.
                getJspProperty().errorOnUndeclaredNamespace();
	}

	return new JspProperty(isXml, isELIgnored, isScriptingInvalid,
                               trimSpaces, poundAllowed,
			       pageEncoding, includePreludes, includeCodas,
                               defaultContentType, buffer,
                               errorOnUndeclaredNamespace);
    }
public JspProperty findJspProperty ( String uri ) throws JasperException { init ( ) ; // JSP Configuration settings do not apply to tag files	     if ( jspProperties == null || uri . endsWith ( ".tag" ) || uri . endsWith ( ".tagx" ) ) { return defaultJspProperty ; } String uriPath = null ; int index = uri . lastIndexOf ( ' ' ) ; if ( index >= 0 ) { uriPath = uri . substring ( 0 , index + 1 ) ; } String uriExtension = null ; index = uri . lastIndexOf ( ' ' ) ; if ( index >= 0 ) { uriExtension = uri . substring ( index + 1 ) ; } ArrayList < String > includePreludes = new ArrayList < String > ( ) ; ArrayList < String > includeCodas = new ArrayList < String > ( ) ; JspPropertyGroup isXmlMatch = null ; JspPropertyGroup elIgnoredMatch = null ; JspPropertyGroup scriptingInvalidMatch = null ; JspPropertyGroup trimSpacesMatch = null ; JspPropertyGroup poundAllowedMatch = null ; JspPropertyGroup pageEncodingMatch = null ; JspPropertyGroup defaultContentTypeMatch = null ; JspPropertyGroup bufferMatch = null ; JspPropertyGroup errorOnUndeclaredNamespaceMatch = null ; for ( JspPropertyGroup jpg : jspProperties ) { 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 ) ; } if ( jp . getTrimSpaces ( ) != null ) { trimSpacesMatch = selectProperty ( trimSpacesMatch , jpg ) ; } if ( jp . getPoundAllowed ( ) != null ) { poundAllowedMatch = selectProperty ( poundAllowedMatch , jpg ) ; } if ( jp . getDefaultContentType ( ) != null ) { defaultContentTypeMatch = selectProperty ( defaultContentTypeMatch , jpg ) ; } if ( jp . getBuffer ( ) != null ) { bufferMatch = selectProperty ( bufferMatch , jpg ) ; } if ( jp . errorOnUndeclaredNamespace ( ) != null ) { errorOnUndeclaredNamespaceMatch = selectProperty ( errorOnUndeclaredNamespaceMatch , jpg ) ; } } String isXml = defaultIsXml ; String isELIgnored = defaultIsELIgnored ; String isScriptingInvalid = defaultIsScriptingInvalid ; String trimSpaces = defaultTrimSpaces ; String poundAllowed = defaultPoundAllowed ; String pageEncoding = null ; String defaultContentType = null ; String buffer = null ; String errorOnUndeclaredNamespace = defaultErrorOnUndeclaredNamespace ; if ( isXmlMatch != null ) { isXml = isXmlMatch . getJspProperty ( ) . isXml ( ) ; } if ( elIgnoredMatch != null ) { isELIgnored = elIgnoredMatch . getJspProperty ( ) . isELIgnored ( ) ; } if ( scriptingInvalidMatch != null ) { isScriptingInvalid = scriptingInvalidMatch . getJspProperty ( ) . isScriptingInvalid ( ) ; } if ( trimSpacesMatch != null ) { trimSpaces = trimSpacesMatch . getJspProperty ( ) . getTrimSpaces ( ) ; } if ( poundAllowedMatch != null ) { poundAllowed = poundAllowedMatch . getJspProperty ( ) . getPoundAllowed ( ) ; } if ( pageEncodingMatch != null ) { pageEncoding = pageEncodingMatch . getJspProperty ( ) . getPageEncoding ( ) ; } if ( defaultContentTypeMatch != null ) { defaultContentType = defaultContentTypeMatch . getJspProperty ( ) . getDefaultContentType ( ) ; } if ( bufferMatch != null ) { buffer = bufferMatch . getJspProperty ( ) . getBuffer ( ) ; } if ( errorOnUndeclaredNamespaceMatch != null ) { errorOnUndeclaredNamespace = errorOnUndeclaredNamespaceMatch . getJspProperty ( ) . errorOnUndeclaredNamespace ( ) ; } return new JspProperty ( isXml , isELIgnored , isScriptingInvalid , trimSpaces , poundAllowed , pageEncoding , includePreludes , includeCodas , defaultContentType , buffer , errorOnUndeclaredNamespace ) ; }
Find a property that best matches the supplied resource.
@param uri the resource supplied.
@return a JspProperty indicating the best match, or some default.
Find a property that best matches the supplied resource .