Author: musachy Date: Mon Sep 28 00:43:34 2009 New Revision: 819435 URL: http://svn.apache.org/viewvc?rev=819435&view=rev Log: importing jasper 6.0.20, this code will not compile
Added: struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/ struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/Constants.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/EmbeddedServletOptions.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/JasperException.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/JspC.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/JspCompilationContext.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/Options.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/ struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/AntCompiler.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/BeanRepository.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/Collector.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/Compiler.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/DefaultErrorHandler.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/Dumper.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/ELFunctionMapper.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/ELNode.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/ELParser.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/ErrorDispatcher.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/ErrorHandler.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/Generator.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/ImplicitTagLibraryInfo.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/JDTCompiler.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/JasperTagInfo.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/JavacErrorDetail.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/JspConfig.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/JspDocumentParser.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/JspReader.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/JspRuntimeContext.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/JspUtil.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/Localizer.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/Mark.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/Node.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/PageDataImpl.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/PageInfo.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/Parser.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/ParserController.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/ScriptingVariabler.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/ServletWriter.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/SmapGenerator.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/SmapStratum.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/SmapUtil.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/TagConstants.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/TagFileProcessor.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/TagLibraryInfoImpl.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/TagPluginManager.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/TextOptimizer.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/TldLocationsCache.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/Validator.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/tagplugin/ struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/tagplugin/TagPlugin.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/tagplugin/TagPluginContext.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/el/ struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/el/ELContextImpl.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/el/ELContextWrapper.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/el/ELResolverImpl.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/el/ExpressionEvaluatorImpl.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/el/ExpressionImpl.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/el/FunctionMapperImpl.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/el/JspELException.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/el/JspMethodExpression.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/el/JspMethodNotFoundException.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/el/JspPropertyNotFoundException.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/el/JspPropertyNotWritableException.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/el/JspValueExpression.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/el/VariableResolverImpl.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/runtime/ struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/runtime/AnnotationHelper.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/runtime/BodyContentImpl.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/runtime/HttpJspBase.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/runtime/JspApplicationContextImpl.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/runtime/JspContextWrapper.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/runtime/JspFactoryImpl.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/runtime/JspFragmentHelper.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/runtime/JspRuntimeLibrary.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/runtime/JspSourceDependent.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/runtime/JspWriterImpl.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/runtime/PageContextImpl.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/runtime/PerThreadTagHandlerPool.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/runtime/ProtectedFunctionMapper.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/runtime/ServletResponseWrapperInclude.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/runtime/TagHandlerPool.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/security/ struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/security/SecurityClassLoad.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/security/SecurityUtil.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/servlet/ struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/servlet/JasperLoader.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/servlet/JspCServletContext.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/servlet/JspServlet.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/servlet/JspServletWrapper.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/servlet/mbeans-descriptors.xml struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/tagplugins/ struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/tagplugins/jstl/ struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/tagplugins/jstl/Util.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/tagplugins/jstl/core/ struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/tagplugins/jstl/core/Catch.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/tagplugins/jstl/core/Choose.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/tagplugins/jstl/core/ForEach.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/tagplugins/jstl/core/ForTokens.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/tagplugins/jstl/core/If.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/tagplugins/jstl/core/Import.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/tagplugins/jstl/core/Otherwise.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/tagplugins/jstl/core/Out.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/tagplugins/jstl/core/Param.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/tagplugins/jstl/core/Redirect.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/tagplugins/jstl/core/Remove.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/tagplugins/jstl/core/Set.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/tagplugins/jstl/core/Url.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/tagplugins/jstl/core/When.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/tagplugins/jstl/tagPlugins.xml struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/util/ struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/util/Enumerator.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/xmlparser/ struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/xmlparser/ASCIIReader.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/xmlparser/EncodingMap.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/xmlparser/ParserUtils.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/xmlparser/SymbolTable.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/xmlparser/TreeNode.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/xmlparser/UCSReader.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/xmlparser/UTF8Reader.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/xmlparser/XMLChar.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/xmlparser/XMLEncodingDetector.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/xmlparser/XMLString.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/xmlparser/XMLStringBuffer.java Added: struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/Constants.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/Constants.java?rev=819435&view=auto ============================================================================== --- struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/Constants.java (added) +++ struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/Constants.java Mon Sep 28 00:43:34 2009 @@ -0,0 +1,208 @@ +/* + * 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; + + +/** + * Some constants and other global data that are used by the compiler and the runtime. + * + * @author Anil K. Vijendran + * @author Harish Prabandham + * @author Shawn Bayern + * @author Mark Roth + */ +public class Constants { + + /** + * The base class of the generated servlets. + */ + public static final String JSP_SERVLET_BASE = + System.getProperty("org.apache.jasper.Constants.JSP_SERVLET_BASE", "org.apache.jasper.runtime.HttpJspBase"); + + /** + * _jspService is the name of the method that is called by + * HttpJspBase.service(). This is where most of the code generated + * from JSPs go. + */ + public static final String SERVICE_METHOD_NAME = + System.getProperty("org.apache.jasper.Constants.SERVICE_METHOD_NAME", "_jspService"); + + /** + * Default servlet content type. + */ + public static final String SERVLET_CONTENT_TYPE = "text/html"; + + /** + * These classes/packages are automatically imported by the + * generated code. + */ + public static final String[] STANDARD_IMPORTS = { + "javax.servlet.*", + "javax.servlet.http.*", + "javax.servlet.jsp.*" + }; + + /** + * ServletContext attribute for classpath. This is tomcat specific. + * Other servlet engines may choose to support this attribute if they + * want to have this JSP engine running on them. + */ + public static final String SERVLET_CLASSPATH = + System.getProperty("org.apache.jasper.Constants.SERVLET_CLASSPATH", "org.apache.catalina.jsp_classpath"); + + /** + * Request attribute for <code><jsp-file></code> element of a + * servlet definition. If present on a request, this overrides the + * value returned by <code>request.getServletPath()</code> to select + * the JSP page to be executed. + */ + public static final String JSP_FILE = + System.getProperty("org.apache.jasper.Constants.JSP_FILE", "org.apache.catalina.jsp_file"); + + + /** + * Default size of the JSP buffer. + */ + public static final int DEFAULT_BUFFER_SIZE = 8 * 1024; + + /** + * Default size for the tag buffers. + */ + public static final int DEFAULT_TAG_BUFFER_SIZE = 512; + + /** + * Default tag handler pool size. + */ + public static final int MAX_POOL_SIZE = 5; + + /** + * The query parameter that causes the JSP engine to just + * pregenerated the servlet but not invoke it. + */ + public static final String PRECOMPILE = + System.getProperty("org.apache.jasper.Constants.PRECOMPILE", "jsp_precompile"); + + /** + * The default package name for compiled jsp pages. + */ + public static final String JSP_PACKAGE_NAME = + System.getProperty("org.apache.jasper.Constants.JSP_PACKAGE_NAME", "org.apache.jsp"); + + /** + * The default package name for tag handlers generated from tag files + */ + public static final String TAG_FILE_PACKAGE_NAME = + System.getProperty("org.apache.jasper.Constants.TAG_FILE_PACKAGE_NAME", "org.apache.jsp.tag"); + + /** + * Servlet context and request attributes that the JSP engine + * uses. + */ + public static final String INC_SERVLET_PATH = "javax.servlet.include.servlet_path"; + public static final String TMP_DIR = "javax.servlet.context.tempdir"; + + // Must be kept in sync with org/apache/catalina/Globals.java + public static final String ALT_DD_ATTR = + System.getProperty("org.apache.jasper.Constants.ALT_DD_ATTR", "org.apache.catalina.deploy.alt_dd"); + + /** + * Public Id and the Resource path (of the cached copy) + * of the DTDs for tag library descriptors. + */ + public static final String TAGLIB_DTD_PUBLIC_ID_11 = + "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"; + public static final String TAGLIB_DTD_RESOURCE_PATH_11 = + "/javax/servlet/jsp/resources/web-jsptaglibrary_1_1.dtd"; + public static final String TAGLIB_DTD_PUBLIC_ID_12 = + "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"; + public static final String TAGLIB_DTD_RESOURCE_PATH_12 = + "/javax/servlet/jsp/resources/web-jsptaglibrary_1_2.dtd"; + + /** + * Public Id and the Resource path (of the cached copy) + * of the DTDs for web application deployment descriptors + */ + public static final String WEBAPP_DTD_PUBLIC_ID_22 = + "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"; + public static final String WEBAPP_DTD_RESOURCE_PATH_22 = + "/javax/servlet/resources/web-app_2_2.dtd"; + public static final String WEBAPP_DTD_PUBLIC_ID_23 = + "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"; + public static final String WEBAPP_DTD_RESOURCE_PATH_23 = + "/javax/servlet/resources/web-app_2_3.dtd"; + + /** + * List of the Public IDs that we cache, and their + * associated location. This is used by + * an EntityResolver to return the location of the + * cached copy of a DTD. + */ + public static final String[] CACHED_DTD_PUBLIC_IDS = { + TAGLIB_DTD_PUBLIC_ID_11, + TAGLIB_DTD_PUBLIC_ID_12, + WEBAPP_DTD_PUBLIC_ID_22, + WEBAPP_DTD_PUBLIC_ID_23, + }; + public static final String[] CACHED_DTD_RESOURCE_PATHS = { + TAGLIB_DTD_RESOURCE_PATH_11, + TAGLIB_DTD_RESOURCE_PATH_12, + WEBAPP_DTD_RESOURCE_PATH_22, + WEBAPP_DTD_RESOURCE_PATH_23, + }; + + /** + * Default URLs to download the pluging for Netscape and IE. + */ + public static final String NS_PLUGIN_URL = + "http://java.sun.com/products/plugin/"; + + public static final String IE_PLUGIN_URL = + "http://java.sun.com/products/plugin/1.2.2/jinstall-1_2_2-win.cab#Version=1,2,2,0"; + + /** + * Prefix to use for generated temporary variable names + */ + public static final String TEMP_VARIABLE_NAME_PREFIX = + System.getProperty("org.apache.jasper.Constants.TEMP_VARIABLE_NAME_PREFIX", "_jspx_temp"); + + /** + * A replacement char for "\$". + * XXX This is a hack to avoid changing EL interpreter to recognize "\$" + * @deprecated + */ + public static final char ESC = '\u001b'; + /** + * @deprecated + */ + public static final String ESCStr = "'\\u001b'"; + + /** + * Has security been turned on? + */ + public static final boolean IS_SECURITY_ENABLED = + (System.getSecurityManager() != null); + + /** + * The name of the path parameter used to pass the session identifier + * back and forth with the client. + */ + public static final String SESSION_PARAMETER_NAME = + System.getProperty("org.apache.catalina.SESSION_PARAMETER_NAME", + "jsessionid"); + +} Added: struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/EmbeddedServletOptions.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/EmbeddedServletOptions.java?rev=819435&view=auto ============================================================================== --- struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/EmbeddedServletOptions.java (added) +++ struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/EmbeddedServletOptions.java Mon Sep 28 00:43:34 2009 @@ -0,0 +1,673 @@ +/* + * 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; + +import java.io.File; +import java.util.*; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletContext; + +import org.apache.jasper.compiler.TldLocationsCache; +import org.apache.jasper.compiler.JspConfig; +import org.apache.jasper.compiler.TagPluginManager; +import org.apache.jasper.compiler.Localizer; +import org.apache.jasper.xmlparser.ParserUtils; +import org.apache.juli.logging.Log; +import org.apache.juli.logging.LogFactory; + +/** + * A class to hold all init parameters specific to the JSP engine. + * + * @author Anil K. Vijendran + * @author Hans Bergsten + * @author Pierre Delisle + */ +public final class EmbeddedServletOptions implements Options { + + // Logger + private Log log = LogFactory.getLog(EmbeddedServletOptions.class); + + private Properties settings = new Properties(); + + /** + * Is Jasper being used in development mode? + */ + private boolean development = true; + + /** + * Should Ant fork its java compiles of JSP pages. + */ + public boolean fork = true; + + /** + * Do you want to keep the generated Java files around? + */ + private boolean keepGenerated = true; + + /** + * Should white spaces between directives or actions be trimmed? + */ + private boolean trimSpaces = false; + + /** + * Determines whether tag handler pooling is enabled. + */ + private boolean isPoolingEnabled = true; + + /** + * Do you want support for "mapped" files? This will generate + * servlet that has a print statement per line of the JSP file. + * This seems like a really nice feature to have for debugging. + */ + private boolean mappedFile = true; + + /** + * Do we want to include debugging information in the class file? + */ + private boolean classDebugInfo = true; + + /** + * Background compile thread check interval in seconds. + */ + private int checkInterval = 0; + + /** + * Is the generation of SMAP info for JSR45 debuggin suppressed? + */ + private boolean isSmapSuppressed = false; + + /** + * Should SMAP info for JSR45 debugging be dumped to a file? + */ + private boolean isSmapDumped = false; + + /** + * Are Text strings to be generated as char arrays? + */ + private boolean genStringAsCharArray = false; + + private boolean errorOnUseBeanInvalidClassAttribute = true; + + /** + * I want to see my generated servlets. Which directory are they + * in? + */ + private File scratchDir; + + /** + * Need to have this as is for versions 4 and 5 of IE. Can be set from + * the initParams so if it changes in the future all that is needed is + * to have a jsp initParam of type ieClassId="<value>" + */ + private String ieClassId = "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"; + + /** + * What classpath should I use while compiling generated servlets? + */ + private String classpath = null; + + /** + * Compiler to use. + */ + private String compiler = null; + + /** + * Compiler target VM. + */ + private String compilerTargetVM = "1.5"; + + /** + * The compiler source VM. + */ + private String compilerSourceVM = "1.5"; + + /** + * The compiler class name. + */ + private String compilerClassName = null; + + /** + * Cache for the TLD locations + */ + private TldLocationsCache tldLocationsCache = null; + + /** + * Jsp config information + */ + private JspConfig jspConfig = null; + + /** + * TagPluginManager + */ + private TagPluginManager tagPluginManager = null; + + /** + * Java platform encoding to generate the JSP + * page servlet. + */ + private String javaEncoding = "UTF8"; + + /** + * Modification test interval. + */ + private int modificationTestInterval = 4; + + /** + * Is generation of X-Powered-By response header enabled/disabled? + */ + private boolean xpoweredBy; + + /** + * Should we include a source fragment in exception messages, which could be displayed + * to the developer ? + */ + private boolean displaySourceFragment = true; + + + public String getProperty(String name ) { + return settings.getProperty( name ); + } + + public void setProperty(String name, String value ) { + if (name != null && value != null){ + settings.setProperty( name, value ); + } + } + + /** + * Are we keeping generated code around? + */ + public boolean getKeepGenerated() { + return keepGenerated; + } + + /** + * Should white spaces between directives or actions be trimmed? + */ + public boolean getTrimSpaces() { + return trimSpaces; + } + + public boolean isPoolingEnabled() { + return isPoolingEnabled; + } + + /** + * Are we supporting HTML mapped servlets? + */ + public boolean getMappedFile() { + return mappedFile; + } + + /** + * Should errors be sent to client or thrown into stderr? + * @deprecated + */ + @Deprecated + public boolean getSendErrorToClient() { + return true; + } + + /** + * Should class files be compiled with debug information? + */ + public boolean getClassDebugInfo() { + return classDebugInfo; + } + + /** + * Background JSP compile thread check intervall + */ + public int getCheckInterval() { + return checkInterval; + } + + /** + * Modification test interval. + */ + public int getModificationTestInterval() { + return modificationTestInterval; + } + + /** + * Is Jasper being used in development mode? + */ + public boolean getDevelopment() { + return development; + } + + /** + * Is the generation of SMAP info for JSR45 debuggin suppressed? + */ + public boolean isSmapSuppressed() { + return isSmapSuppressed; + } + + /** + * Should SMAP info for JSR45 debugging be dumped to a file? + */ + public boolean isSmapDumped() { + return isSmapDumped; + } + + /** + * Are Text strings to be generated as char arrays? + */ + public boolean genStringAsCharArray() { + return this.genStringAsCharArray; + } + + /** + * Class ID for use in the plugin tag when the browser is IE. + */ + public String getIeClassId() { + return ieClassId; + } + + /** + * What is my scratch dir? + */ + public File getScratchDir() { + return scratchDir; + } + + /** + * What classpath should I use while compiling the servlets + * generated from JSP files? + */ + public String getClassPath() { + return classpath; + } + + /** + * Is generation of X-Powered-By response header enabled/disabled? + */ + public boolean isXpoweredBy() { + return xpoweredBy; + } + + /** + * Compiler to use. + */ + public String getCompiler() { + return compiler; + } + + /** + * @see Options#getCompilerTargetVM + */ + public String getCompilerTargetVM() { + return compilerTargetVM; + } + + /** + * @see Options#getCompilerSourceVM + */ + public String getCompilerSourceVM() { + return compilerSourceVM; + } + + /** + * Java compiler class to use. + */ + public String getCompilerClassName() { + return compilerClassName; + } + + public boolean getErrorOnUseBeanInvalidClassAttribute() { + return errorOnUseBeanInvalidClassAttribute; + } + + public void setErrorOnUseBeanInvalidClassAttribute(boolean b) { + errorOnUseBeanInvalidClassAttribute = b; + } + + public TldLocationsCache getTldLocationsCache() { + return tldLocationsCache; + } + + public void setTldLocationsCache( TldLocationsCache tldC ) { + tldLocationsCache = tldC; + } + + public String getJavaEncoding() { + return javaEncoding; + } + + public boolean getFork() { + return fork; + } + + public JspConfig getJspConfig() { + return jspConfig; + } + + public TagPluginManager getTagPluginManager() { + return tagPluginManager; + } + + public boolean isCaching() { + return false; + } + + public Map getCache() { + return null; + } + + /** + * Should we include a source fragment in exception messages, which could be displayed + * to the developer ? + */ + public boolean getDisplaySourceFragment() { + return displaySourceFragment; + } + + /** + * Create an EmbeddedServletOptions object using data available from + * ServletConfig and ServletContext. + */ + public EmbeddedServletOptions(ServletConfig config, + ServletContext context) { + + // JVM version numbers + try { + if (Float.parseFloat(System.getProperty("java.specification.version")) > 1.4) { + compilerSourceVM = compilerTargetVM = "1.5"; + } else { + compilerSourceVM = compilerTargetVM = "1.4"; + } + } catch (NumberFormatException e) { + // Ignore + } + + Enumeration enumeration=config.getInitParameterNames(); + while( enumeration.hasMoreElements() ) { + String k=(String)enumeration.nextElement(); + String v=config.getInitParameter( k ); + setProperty( k, v); + } + + // quick hack + String validating=config.getInitParameter( "validating"); + if( "false".equals( validating )) ParserUtils.validating=false; + + String keepgen = config.getInitParameter("keepgenerated"); + if (keepgen != null) { + if (keepgen.equalsIgnoreCase("true")) { + this.keepGenerated = true; + } else if (keepgen.equalsIgnoreCase("false")) { + this.keepGenerated = false; + } else { + if (log.isWarnEnabled()) { + log.warn(Localizer.getMessage("jsp.warning.keepgen")); + } + } + } + + + String trimsp = config.getInitParameter("trimSpaces"); + if (trimsp != null) { + if (trimsp.equalsIgnoreCase("true")) { + trimSpaces = true; + } else if (trimsp.equalsIgnoreCase("false")) { + trimSpaces = false; + } else { + if (log.isWarnEnabled()) { + log.warn(Localizer.getMessage("jsp.warning.trimspaces")); + } + } + } + + this.isPoolingEnabled = true; + String poolingEnabledParam + = config.getInitParameter("enablePooling"); + if (poolingEnabledParam != null + && !poolingEnabledParam.equalsIgnoreCase("true")) { + if (poolingEnabledParam.equalsIgnoreCase("false")) { + this.isPoolingEnabled = false; + } else { + if (log.isWarnEnabled()) { + log.warn(Localizer.getMessage("jsp.warning.enablePooling")); + } + } + } + + String mapFile = config.getInitParameter("mappedfile"); + if (mapFile != null) { + if (mapFile.equalsIgnoreCase("true")) { + this.mappedFile = true; + } else if (mapFile.equalsIgnoreCase("false")) { + this.mappedFile = false; + } else { + if (log.isWarnEnabled()) { + log.warn(Localizer.getMessage("jsp.warning.mappedFile")); + } + } + } + + String debugInfo = config.getInitParameter("classdebuginfo"); + if (debugInfo != null) { + if (debugInfo.equalsIgnoreCase("true")) { + this.classDebugInfo = true; + } else if (debugInfo.equalsIgnoreCase("false")) { + this.classDebugInfo = false; + } else { + if (log.isWarnEnabled()) { + log.warn(Localizer.getMessage("jsp.warning.classDebugInfo")); + } + } + } + + String checkInterval = config.getInitParameter("checkInterval"); + if (checkInterval != null) { + try { + this.checkInterval = Integer.parseInt(checkInterval); + } catch(NumberFormatException ex) { + if (log.isWarnEnabled()) { + log.warn(Localizer.getMessage("jsp.warning.checkInterval")); + } + } + } + + String modificationTestInterval = config.getInitParameter("modificationTestInterval"); + if (modificationTestInterval != null) { + try { + this.modificationTestInterval = Integer.parseInt(modificationTestInterval); + } catch(NumberFormatException ex) { + if (log.isWarnEnabled()) { + log.warn(Localizer.getMessage("jsp.warning.modificationTestInterval")); + } + } + } + + String development = config.getInitParameter("development"); + if (development != null) { + if (development.equalsIgnoreCase("true")) { + this.development = true; + } else if (development.equalsIgnoreCase("false")) { + this.development = false; + } else { + if (log.isWarnEnabled()) { + log.warn(Localizer.getMessage("jsp.warning.development")); + } + } + } + + String suppressSmap = config.getInitParameter("suppressSmap"); + if (suppressSmap != null) { + if (suppressSmap.equalsIgnoreCase("true")) { + isSmapSuppressed = true; + } else if (suppressSmap.equalsIgnoreCase("false")) { + isSmapSuppressed = false; + } else { + if (log.isWarnEnabled()) { + log.warn(Localizer.getMessage("jsp.warning.suppressSmap")); + } + } + } + + String dumpSmap = config.getInitParameter("dumpSmap"); + if (dumpSmap != null) { + if (dumpSmap.equalsIgnoreCase("true")) { + isSmapDumped = true; + } else if (dumpSmap.equalsIgnoreCase("false")) { + isSmapDumped = false; + } else { + if (log.isWarnEnabled()) { + log.warn(Localizer.getMessage("jsp.warning.dumpSmap")); + } + } + } + + String genCharArray = config.getInitParameter("genStrAsCharArray"); + if (genCharArray != null) { + if (genCharArray.equalsIgnoreCase("true")) { + genStringAsCharArray = true; + } else if (genCharArray.equalsIgnoreCase("false")) { + genStringAsCharArray = false; + } else { + if (log.isWarnEnabled()) { + log.warn(Localizer.getMessage("jsp.warning.genchararray")); + } + } + } + + String errBeanClass = + config.getInitParameter("errorOnUseBeanInvalidClassAttribute"); + if (errBeanClass != null) { + if (errBeanClass.equalsIgnoreCase("true")) { + errorOnUseBeanInvalidClassAttribute = true; + } else if (errBeanClass.equalsIgnoreCase("false")) { + errorOnUseBeanInvalidClassAttribute = false; + } else { + if (log.isWarnEnabled()) { + log.warn(Localizer.getMessage("jsp.warning.errBean")); + } + } + } + + String ieClassId = config.getInitParameter("ieClassId"); + if (ieClassId != null) + this.ieClassId = ieClassId; + + String classpath = config.getInitParameter("classpath"); + if (classpath != null) + this.classpath = classpath; + + /* + * scratchdir + */ + String dir = config.getInitParameter("scratchdir"); + if (dir != null) { + scratchDir = new File(dir); + } else { + // First try the Servlet 2.2 javax.servlet.context.tempdir property + scratchDir = (File) context.getAttribute(Constants.TMP_DIR); + if (scratchDir == null) { + // Not running in a Servlet 2.2 container. + // Try to get the JDK 1.2 java.io.tmpdir property + dir = System.getProperty("java.io.tmpdir"); + if (dir != null) + scratchDir = new File(dir); + } + } + if (this.scratchDir == null) { + log.fatal(Localizer.getMessage("jsp.error.no.scratch.dir")); + return; + } + + if (!(scratchDir.exists() && scratchDir.canRead() && + scratchDir.canWrite() && scratchDir.isDirectory())) + log.fatal(Localizer.getMessage("jsp.error.bad.scratch.dir", + scratchDir.getAbsolutePath())); + + this.compiler = config.getInitParameter("compiler"); + + String compilerTargetVM = config.getInitParameter("compilerTargetVM"); + if(compilerTargetVM != null) { + this.compilerTargetVM = compilerTargetVM; + } + + String compilerSourceVM = config.getInitParameter("compilerSourceVM"); + if(compilerSourceVM != null) { + this.compilerSourceVM = compilerSourceVM; + } + + String javaEncoding = config.getInitParameter("javaEncoding"); + if (javaEncoding != null) { + this.javaEncoding = javaEncoding; + } + + String compilerClassName = config.getInitParameter("compilerClassName"); + if (compilerClassName != null) { + this.compilerClassName = compilerClassName; + } + + String fork = config.getInitParameter("fork"); + if (fork != null) { + if (fork.equalsIgnoreCase("true")) { + this.fork = true; + } else if (fork.equalsIgnoreCase("false")) { + this.fork = false; + } else { + if (log.isWarnEnabled()) { + log.warn(Localizer.getMessage("jsp.warning.fork")); + } + } + } + + String xpoweredBy = config.getInitParameter("xpoweredBy"); + if (xpoweredBy != null) { + if (xpoweredBy.equalsIgnoreCase("true")) { + this.xpoweredBy = true; + } else if (xpoweredBy.equalsIgnoreCase("false")) { + this.xpoweredBy = false; + } else { + if (log.isWarnEnabled()) { + log.warn(Localizer.getMessage("jsp.warning.xpoweredBy")); + } + } + } + + String displaySourceFragment = config.getInitParameter("displaySourceFragment"); + if (displaySourceFragment != null) { + if (displaySourceFragment.equalsIgnoreCase("true")) { + this.displaySourceFragment = true; + } else if (displaySourceFragment.equalsIgnoreCase("false")) { + this.displaySourceFragment = false; + } else { + if (log.isWarnEnabled()) { + log.warn(Localizer.getMessage("jsp.warning.displaySourceFragment")); + } + } + } + + // Setup the global Tag Libraries location cache for this + // web-application. + tldLocationsCache = new TldLocationsCache(context); + + // Setup the jsp config info for this web app. + jspConfig = new JspConfig(context); + + // Create a Tag plugin instance + tagPluginManager = new TagPluginManager(context); + } + +} + Added: struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/JasperException.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/JasperException.java?rev=819435&view=auto ============================================================================== --- struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/JasperException.java (added) +++ struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/JasperException.java Mon Sep 28 00:43:34 2009 @@ -0,0 +1,46 @@ +/* + * 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; + +/** + * Base class for all exceptions generated by the JSP engine. Makes it + * convienient to catch just this at the top-level. + * + * @author Anil K. Vijendran + */ +public class JasperException extends javax.servlet.ServletException { + + public JasperException(String reason) { + super(reason); + } + + /** + * Creates a JasperException with the embedded exception and the reason for + * throwing a JasperException + */ + public JasperException (String reason, Throwable exception) { + super(reason, exception); + } + + /** + * Creates a JasperException with the embedded exception + */ + public JasperException (Throwable exception) { + super(exception); + } +}