View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    * 
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  
18  package org.apache.struts2.jasper;
19  
20  
21  /***
22   * Some constants and other global data that are used by the compiler and the runtime.
23   *
24   * @author Anil K. Vijendran
25   * @author Harish Prabandham
26   * @author Shawn Bayern
27   * @author Mark Roth
28   */
29  public class Constants {
30      /***
31       * The base class of the generated servlets.
32       */
33      public static final String JSP_SERVLET_BASE = "org.apache.struts2.jasper.runtime.HttpJspBase";
34  
35      /***
36       * _jspService is the name of the method that is called by
37       * HttpJspBase.service(). This is where most of the code generated
38       * from JSPs go.
39       */
40      public static final String SERVICE_METHOD_NAME = "_jspService";
41  
42      /***
43       * Default servlet content type.
44       */
45      public static final String SERVLET_CONTENT_TYPE = "text/html";
46  
47      /***
48       * These classes/packages are automatically imported by the
49       * generated code.
50       */
51      public static final String[] STANDARD_IMPORTS = {
52              "javax.servlet.*",
53              "javax.servlet.http.*",
54              "javax.servlet.jsp.*"
55      };
56  
57      /***
58       * FIXME
59       * ServletContext attribute for classpath. This is tomcat specific.
60       * Other servlet engines may choose to support this attribute if they
61       * want to have this JSP engine running on them.
62       */
63      public static final String SERVLET_CLASSPATH = "org.apache.catalina.jsp_classpath";
64  
65      /***
66       * FIXME
67       * Request attribute for <code>&lt;jsp-file&gt;</code> element of a
68       * servlet definition.  If present on a request, this overrides the
69       * value returned by <code>request.getServletPath()</code> to select
70       * the JSP page to be executed.
71       */
72      public static final String JSP_FILE = "org.apache.catalina.jsp_file";
73  
74  
75      /***
76       * FIXME
77       * ServletContext attribute for class loader. This is tomcat specific.
78       * Other servlet engines can choose to have this attribute if they
79       * want to have this JSP engine running on them.
80       */
81      //public static final String SERVLET_CLASS_LOADER = "org.apache.tomcat.classloader";
82      public static final String SERVLET_CLASS_LOADER = "org.apache.catalina.classloader";
83  
84      /***
85       * Default size of the JSP buffer.
86       */
87      public static final int K = 1024;
88      public static final int DEFAULT_BUFFER_SIZE = 8 * K;
89  
90      /***
91       * Default size for the tag buffers.
92       */
93      public static final int DEFAULT_TAG_BUFFER_SIZE = 512;
94  
95      /***
96       * Default tag handler pool size.
97       */
98      public static final int MAX_POOL_SIZE = 5;
99  
100     /***
101      * The query parameter that causes the JSP engine to just
102      * pregenerated the servlet but not invoke it.
103      */
104     public static final String PRECOMPILE = "jsp_precompile";
105 
106     /***
107      * The default package name for compiled jsp pages.
108      */
109     public static final String JSP_PACKAGE_NAME = "org.apache.jsp";
110 
111     /***
112      * The default package name for tag handlers generated from tag files
113      */
114     public static final String TAG_FILE_PACKAGE_NAME = "org.apache.jsp.tag";
115 
116     /***
117      * Servlet context and request attributes that the JSP engine
118      * uses.
119      */
120     public static final String INC_REQUEST_URI = "javax.servlet.include.request_uri";
121     public static final String INC_SERVLET_PATH = "javax.servlet.include.servlet_path";
122     public static final String TMP_DIR = "javax.servlet.context.tempdir";
123     public static final String FORWARD_SEEN = "javax.servlet.forward.seen";
124 
125     // Must be kept in sync with org/apache/catalina/Globals.java
126     public static final String ALT_DD_ATTR = "org.apache.catalina.deploy.alt_dd";
127 
128     /***
129      * Public Id and the Resource path (of the cached copy)
130      * of the DTDs for tag library descriptors.
131      */
132     public static final String TAGLIB_DTD_PUBLIC_ID_11 =
133             "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN";
134     public static final String TAGLIB_DTD_RESOURCE_PATH_11 =
135             "/javax/servlet/jsp/resources/web-jsptaglibrary_1_1.dtd";
136     public static final String TAGLIB_DTD_PUBLIC_ID_12 =
137             "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN";
138     public static final String TAGLIB_DTD_RESOURCE_PATH_12 =
139             "/javax/servlet/jsp/resources/web-jsptaglibrary_1_2.dtd";
140 
141     /***
142      * Public Id and the Resource path (of the cached copy)
143      * of the DTDs for web application deployment descriptors
144      */
145     public static final String WEBAPP_DTD_PUBLIC_ID_22 =
146             "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN";
147     public static final String WEBAPP_DTD_RESOURCE_PATH_22 =
148             "/javax/servlet/resources/web-app_2_2.dtd";
149     public static final String WEBAPP_DTD_PUBLIC_ID_23 =
150             "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN";
151     public static final String WEBAPP_DTD_RESOURCE_PATH_23 =
152             "/javax/servlet/resources/web-app_2_3.dtd";
153 
154     /***
155      * List of the Public IDs that we cache, and their
156      * associated location. This is used by
157      * an EntityResolver to return the location of the
158      * cached copy of a DTD.
159      */
160     public static final String[] CACHED_DTD_PUBLIC_IDS = {
161             TAGLIB_DTD_PUBLIC_ID_11,
162             TAGLIB_DTD_PUBLIC_ID_12,
163             WEBAPP_DTD_PUBLIC_ID_22,
164             WEBAPP_DTD_PUBLIC_ID_23,
165     };
166     public static final String[] CACHED_DTD_RESOURCE_PATHS = {
167             TAGLIB_DTD_RESOURCE_PATH_11,
168             TAGLIB_DTD_RESOURCE_PATH_12,
169             WEBAPP_DTD_RESOURCE_PATH_22,
170             WEBAPP_DTD_RESOURCE_PATH_23,
171     };
172 
173     /***
174      * Default URLs to download the pluging for Netscape and IE.
175      */
176     public static final String NS_PLUGIN_URL =
177             "http://java.sun.com/products/plugin/";
178 
179     public static final String IE_PLUGIN_URL =
180             "http://java.sun.com/products/plugin/1.2.2/jinstall-1_2_2-win.cab#Version=1,2,2,0";
181 
182     /***
183      * Prefix to use for generated temporary variable names
184      */
185     public static final String TEMP_VARIABLE_NAME_PREFIX =
186             "_jspx_temp";
187 
188     /***
189      * Previous replacement char for "\$".
190      *
191      * @deprecated
192      */
193     public static final char ESC = '\u001b';
194 
195     /***
196      * Previous replacement char for "\$".
197      *
198      * @deprecated
199      */
200     public static final String ESCStr = "'//u001b'";
201 
202     /***
203      * Replacement char for "\$". This is the first unicode character in the
204      * private use area.
205      * XXX This is a hack to avoid changing EL interpreter to recognize "\$"
206      */
207     public static final char HACK_CHAR = '\ue000';
208 
209     /***
210      * Replacement string for "\$". This is the first unicode character in the
211      * private use area.
212      * XXX This is a hack to avoid changing EL interpreter to recognize "\$"
213      */
214     public static final String HACK_STR = "'//ue000'";
215 
216 }
217