/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.
*/ package org.apache.jasper.compiler;
import org.apache.jasper.JasperException;
/** * Collect info about the page and nodes, and make them available through * the PageInfo object. * * @author Kin-man Chung * @author Mark Roth
*/
class Collector {
/** * A visitor for collecting information on the page and the body of * the custom tags.
*/ privatestaticclass CollectVisitor extends Node.Visitor {
@Override publicvoid visit(Node.CustomTag n) throws JasperException { // Check to see what kinds of element we see as child elements
checkSeen( n.getChildInfo(), n );
}
/** * Check all child nodes for various elements and update the given * ChildInfo object accordingly. Visits body in the process.
*/ privatevoid checkSeen( Node.ChildInfo ci, Node n ) throws JasperException
{ // save values collected so far boolean scriptingElementSeenSave = scriptingElementSeen;
scriptingElementSeen = false; boolean usebeanSeenSave = usebeanSeen;
usebeanSeen = false; boolean includeActionSeenSave = includeActionSeen;
includeActionSeen = false; boolean paramActionSeenSave = paramActionSeen;
paramActionSeen = false; boolean setPropertySeenSave = setPropertySeen;
setPropertySeen = false; boolean hasScriptingVarsSave = hasScriptingVars;
hasScriptingVars = false;
// Scan attribute list for expressions if( n instanceof Node.CustomTag ) {
Node.CustomTag ct = (Node.CustomTag)n;
Node.JspAttribute[] attrs = ct.getJspAttributes(); for (int i = 0; attrs != null && i < attrs.length; i++) { if (attrs[i].isExpression()) {
scriptingElementSeen = true; break;
}
}
}
// Record if the tag element and its body contains any scriptlet.
ci.setScriptless(! scriptingElementSeen);
ci.setHasUseBean(usebeanSeen);
ci.setHasIncludeAction(includeActionSeen);
ci.setHasParamAction(paramActionSeen);
ci.setHasSetProperty(setPropertySeen);
ci.setHasScriptingVars(hasScriptingVars);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.