Lines 17-30
Link Here
|
17 |
|
17 |
|
18 |
package org.apache.jasper.compiler; |
18 |
package org.apache.jasper.compiler; |
19 |
|
19 |
|
20 |
import java.util.Iterator; |
20 |
import java.util.ArrayList; |
|
|
21 |
import java.util.Collection; |
22 |
import java.util.List; |
21 |
import java.util.Vector; |
23 |
import java.util.Vector; |
22 |
|
24 |
|
23 |
import javax.servlet.ServletContext; |
25 |
import javax.servlet.ServletContext; |
|
|
26 |
import javax.servlet.descriptor.JspConfigDescriptor; |
27 |
import javax.servlet.descriptor.JspPropertyGroupDescriptor; |
24 |
|
28 |
|
25 |
import org.apache.jasper.JasperException; |
|
|
26 |
import org.apache.jasper.xmlparser.ParserUtils; |
27 |
import org.apache.jasper.xmlparser.TreeNode; |
28 |
import org.apache.juli.logging.Log; |
29 |
import org.apache.juli.logging.Log; |
29 |
import org.apache.juli.logging.LogFactory; |
30 |
import org.apache.juli.logging.LogFactory; |
30 |
|
31 |
|
Lines 41-249
Link Here
|
41 |
// Logger |
42 |
// Logger |
42 |
private final Log log = LogFactory.getLog(JspConfig.class); |
43 |
private final Log log = LogFactory.getLog(JspConfig.class); |
43 |
|
44 |
|
44 |
private Vector<JspPropertyGroup> jspProperties = null; |
45 |
private final JspProperty defaultJspProperty; |
45 |
private final ServletContext ctxt; |
46 |
private final List<JspPropertyGroup> jspProperties; |
46 |
private volatile boolean initialized = false; |
|
|
47 |
|
47 |
|
48 |
private static final String defaultIsXml = null; // unspecified |
|
|
49 |
private String defaultIsELIgnored = null; // unspecified |
50 |
private static final String defaultIsScriptingInvalid = null; |
51 |
private String defaultDeferedSyntaxAllowedAsLiteral = null; |
52 |
private static final String defaultTrimDirectiveWhitespaces = null; |
53 |
private static final String defaultDefaultContentType = null; |
54 |
private static final String defaultBuffer = null; |
55 |
private static final String defaultErrorOnUndeclaredNamespace = "false"; |
56 |
private JspProperty defaultJspProperty; |
57 |
|
58 |
public JspConfig(ServletContext ctxt) { |
48 |
public JspConfig(ServletContext ctxt) { |
59 |
this.ctxt = ctxt; |
49 |
// set up default behaviour based on effective Servlet specification version |
60 |
} |
50 |
int major = ctxt.getEffectiveMajorVersion(); |
|
|
51 |
int minor = ctxt.getEffectiveMinorVersion(); |
61 |
|
52 |
|
62 |
private double getVersion(TreeNode webApp) { |
53 |
if (major < 2 || major == 2 && minor < 4) { |
63 |
String v = webApp.findAttribute("version"); |
54 |
// < 2.4 : elIgnored, deferedSyntaxAllowedAsLiteral, and no jsp-config |
64 |
if (v != null) { |
55 |
defaultJspProperty = new JspProperty("true", "true"); |
65 |
try { |
56 |
jspProperties = null; |
66 |
return Double.parseDouble(v); |
57 |
return; |
67 |
} catch (NumberFormatException e) { |
58 |
} else if (major == 2 && minor == 4) { |
68 |
} |
59 |
// 2.4 : deferedSyntaxAllowedAsLiteral |
|
|
60 |
defaultJspProperty = new JspProperty(null, "true"); |
61 |
} else { |
62 |
defaultJspProperty = new JspProperty(null, null); |
69 |
} |
63 |
} |
70 |
return 2.3; |
64 |
jspProperties = processJspConfig(ctxt); |
71 |
} |
65 |
} |
72 |
|
66 |
|
73 |
private void processWebDotXml() throws JasperException { |
67 |
private List<JspPropertyGroup> processJspConfig(ServletContext ctxt) { |
|
|
68 |
JspConfigDescriptor jspConfig = ctxt.getJspConfigDescriptor(); |
69 |
if (jspConfig == null) { |
70 |
// no jsp-config for this application |
71 |
return null; |
72 |
} |
74 |
|
73 |
|
75 |
WebXml webXml = null; |
74 |
Collection<JspPropertyGroupDescriptor> jspPropertyGroups = jspConfig.getJspPropertyGroups(); |
|
|
75 |
List<JspPropertyGroup> jspProperties = new ArrayList<>(); |
76 |
for (JspPropertyGroupDescriptor jspPropertyGroup : jspPropertyGroups) { |
76 |
|
77 |
|
77 |
try { |
78 |
Collection<String> urlPatterns = jspPropertyGroup.getUrlPatterns(); |
78 |
webXml = new WebXml(ctxt); |
79 |
if (urlPatterns.isEmpty()) { |
79 |
|
80 |
continue; |
80 |
TreeNode webApp = null; |
|
|
81 |
if (webXml.getInputSource() != null) { |
82 |
ParserUtils pu = new ParserUtils(); |
83 |
webApp = pu.parseXMLDocument(webXml.getSystemId(), |
84 |
webXml.getInputSource()); |
85 |
} |
81 |
} |
86 |
|
82 |
|
87 |
if (webApp == null |
83 |
JspProperty property = new JspProperty(jspPropertyGroup.getIsXml(), |
88 |
|| getVersion(webApp) < 2.4) { |
84 |
jspPropertyGroup.getElIgnored(), |
89 |
defaultIsELIgnored = "true"; |
85 |
jspPropertyGroup.getScriptingInvalid(), |
90 |
defaultDeferedSyntaxAllowedAsLiteral = "true"; |
86 |
jspPropertyGroup.getPageEncoding(), |
91 |
return; |
87 |
new Vector<>(jspPropertyGroup.getIncludePreludes()), |
92 |
} |
88 |
new Vector<>(jspPropertyGroup.getIncludeCodas()), |
93 |
if (getVersion(webApp) < 2.5) { |
89 |
jspPropertyGroup.getDeferredSyntaxAllowedAsLiteral(), |
94 |
defaultDeferedSyntaxAllowedAsLiteral = "true"; |
90 |
jspPropertyGroup.getTrimDirectiveWhitespaces(), |
95 |
} |
91 |
jspPropertyGroup.getDefaultContentType(), |
96 |
TreeNode jspConfig = webApp.findChild("jsp-config"); |
92 |
jspPropertyGroup.getBuffer(), |
97 |
if (jspConfig == null) { |
93 |
jspPropertyGroup.getErrorOnUndeclaredNamespace()); |
98 |
return; |
|
|
99 |
} |
100 |
|
94 |
|
101 |
jspProperties = new Vector<>(); |
95 |
// Add one JspPropertyGroup for each URL Pattern. This makes |
102 |
Iterator<TreeNode> jspPropertyList = |
96 |
// the matching logic easier. |
103 |
jspConfig.findChildren("jsp-property-group"); |
97 |
for (String urlPattern : urlPatterns) { |
104 |
while (jspPropertyList.hasNext()) { |
98 |
String path = null; |
|
|
99 |
String extension = null; |
105 |
|
100 |
|
106 |
TreeNode element = jspPropertyList.next(); |
101 |
if (urlPattern.indexOf('*') < 0) { |
107 |
Iterator<TreeNode> list = element.findChildren(); |
102 |
// Exact match |
108 |
|
103 |
path = urlPattern; |
109 |
Vector<String> urlPatterns = new Vector<>(); |
104 |
} else { |
110 |
String pageEncoding = null; |
105 |
int i = urlPattern.lastIndexOf('/'); |
111 |
String scriptingInvalid = null; |
106 |
String file; |
112 |
String elIgnored = null; |
107 |
if (i >= 0) { |
113 |
String isXml = null; |
108 |
path = urlPattern.substring(0, i + 1); |
114 |
Vector<String> includePrelude = new Vector<>(); |
109 |
file = urlPattern.substring(i + 1); |
115 |
Vector<String> includeCoda = new Vector<>(); |
|
|
116 |
String deferredSyntaxAllowedAsLiteral = null; |
117 |
String trimDirectiveWhitespaces = null; |
118 |
String defaultContentType = null; |
119 |
String buffer = null; |
120 |
String errorOnUndeclaredNamespace = null; |
121 |
|
122 |
while (list.hasNext()) { |
123 |
|
124 |
element = list.next(); |
125 |
String tname = element.getName(); |
126 |
|
127 |
if ("url-pattern".equals(tname)) |
128 |
urlPatterns.addElement( element.getBody() ); |
129 |
else if ("page-encoding".equals(tname)) |
130 |
pageEncoding = element.getBody(); |
131 |
else if ("is-xml".equals(tname)) |
132 |
isXml = element.getBody(); |
133 |
else if ("el-ignored".equals(tname)) |
134 |
elIgnored = element.getBody(); |
135 |
else if ("scripting-invalid".equals(tname)) |
136 |
scriptingInvalid = element.getBody(); |
137 |
else if ("include-prelude".equals(tname)) |
138 |
includePrelude.addElement(element.getBody()); |
139 |
else if ("include-coda".equals(tname)) |
140 |
includeCoda.addElement(element.getBody()); |
141 |
else if ("deferred-syntax-allowed-as-literal".equals(tname)) |
142 |
deferredSyntaxAllowedAsLiteral = element.getBody(); |
143 |
else if ("trim-directive-whitespaces".equals(tname)) |
144 |
trimDirectiveWhitespaces = element.getBody(); |
145 |
else if ("default-content-type".equals(tname)) |
146 |
defaultContentType = element.getBody(); |
147 |
else if ("buffer".equals(tname)) |
148 |
buffer = element.getBody(); |
149 |
else if ("error-on-undeclared-namespace".equals(tname)) |
150 |
errorOnUndeclaredNamespace = element.getBody(); |
151 |
} |
152 |
|
153 |
if (urlPatterns.size() == 0) { |
154 |
continue; |
155 |
} |
156 |
|
157 |
// Add one JspPropertyGroup for each URL Pattern. This makes |
158 |
// the matching logic easier. |
159 |
for( int p = 0; p < urlPatterns.size(); p++ ) { |
160 |
String urlPattern = urlPatterns.elementAt( p ); |
161 |
String path = null; |
162 |
String extension = null; |
163 |
|
164 |
if (urlPattern.indexOf('*') < 0) { |
165 |
// Exact match |
166 |
path = urlPattern; |
167 |
} else { |
110 |
} else { |
168 |
int i = urlPattern.lastIndexOf('/'); |
111 |
file = urlPattern; |
169 |
String file; |
112 |
} |
170 |
if (i >= 0) { |
|
|
171 |
path = urlPattern.substring(0,i+1); |
172 |
file = urlPattern.substring(i+1); |
173 |
} else { |
174 |
file = urlPattern; |
175 |
} |
176 |
|
113 |
|
177 |
// pattern must be "*", or of the form "*.jsp" |
114 |
// pattern must be "*", or of the form "*.jsp" |
178 |
if (file.equals("*")) { |
115 |
if (file.equals("*")) { |
179 |
extension = "*"; |
116 |
extension = "*"; |
180 |
} else if (file.startsWith("*.")) { |
117 |
} else if (file.startsWith("*.")) { |
181 |
extension = file.substring(file.indexOf('.')+1); |
118 |
extension = file.substring(file.indexOf('.') + 1); |
182 |
} |
119 |
} |
183 |
|
120 |
|
184 |
// The url patterns are reconstructed as the following: |
121 |
// The url patterns are reconstructed as the following: |
185 |
// path != null, extension == null: / or /foo/bar.ext |
122 |
// path != null, extension == null: / or /foo/bar.ext |
186 |
// path == null, extension != null: *.ext |
123 |
// path == null, extension != null: *.ext |
187 |
// path != null, extension == "*": /foo/* |
124 |
// path != null, extension == "*": /foo/* |
188 |
boolean isStar = "*".equals(extension); |
125 |
boolean isStar = "*".equals(extension); |
189 |
if ((path == null && (extension == null || isStar)) |
126 |
if ((path == null && (extension == null || isStar)) |
190 |
|| (path != null && !isStar)) { |
127 |
|| (path != null && !isStar)) { |
191 |
if (log.isWarnEnabled()) { |
128 |
if (log.isWarnEnabled()) { |
192 |
log.warn(Localizer.getMessage( |
129 |
log.warn(Localizer.getMessage( |
193 |
"jsp.warning.bad.urlpattern.propertygroup", |
130 |
"jsp.warning.bad.urlpattern.propertygroup", |
194 |
urlPattern)); |
131 |
urlPattern)); |
195 |
} |
|
|
196 |
continue; |
197 |
} |
132 |
} |
|
|
133 |
continue; |
198 |
} |
134 |
} |
|
|
135 |
} |
199 |
|
136 |
|
200 |
JspProperty property = new JspProperty(isXml, |
137 |
JspPropertyGroup propertyGroup = |
201 |
elIgnored, |
|
|
202 |
scriptingInvalid, |
203 |
pageEncoding, |
204 |
includePrelude, |
205 |
includeCoda, |
206 |
deferredSyntaxAllowedAsLiteral, |
207 |
trimDirectiveWhitespaces, |
208 |
defaultContentType, |
209 |
buffer, |
210 |
errorOnUndeclaredNamespace); |
211 |
JspPropertyGroup propertyGroup = |
212 |
new JspPropertyGroup(path, extension, property); |
138 |
new JspPropertyGroup(path, extension, property); |
213 |
|
139 |
|
214 |
jspProperties.addElement(propertyGroup); |
140 |
jspProperties.add(propertyGroup); |
215 |
} |
|
|
216 |
} |
141 |
} |
217 |
} catch (Exception ex) { |
|
|
218 |
throw new JasperException(ex); |
219 |
} finally { |
220 |
if (webXml != null) { |
221 |
webXml.close(); |
222 |
} |
223 |
} |
142 |
} |
|
|
143 |
return jspProperties; |
224 |
} |
144 |
} |
225 |
|
145 |
|
226 |
private void init() throws JasperException { |
|
|
227 |
|
228 |
if (!initialized) { |
229 |
synchronized (this) { |
230 |
if (!initialized) { |
231 |
processWebDotXml(); |
232 |
defaultJspProperty = new JspProperty(defaultIsXml, |
233 |
defaultIsELIgnored, |
234 |
defaultIsScriptingInvalid, |
235 |
null, null, null, |
236 |
defaultDeferedSyntaxAllowedAsLiteral, |
237 |
defaultTrimDirectiveWhitespaces, |
238 |
defaultDefaultContentType, |
239 |
defaultBuffer, |
240 |
defaultErrorOnUndeclaredNamespace); |
241 |
initialized = true; |
242 |
} |
243 |
} |
244 |
} |
245 |
} |
246 |
|
247 |
/** |
146 |
/** |
248 |
* Select the property group that has more restrictive url-pattern. |
147 |
* Select the property group that has more restrictive url-pattern. |
249 |
* In case of tie, select the first. |
148 |
* In case of tie, select the first. |
Lines 268-277
Link Here
|
268 |
// Both specifies a *.ext, keep the first one |
167 |
// Both specifies a *.ext, keep the first one |
269 |
return prev; |
168 |
return prev; |
270 |
} |
169 |
} |
271 |
if (prevPath == null && currPath != null) { |
170 |
if (prevPath == null) { |
272 |
return curr; |
171 |
return curr; |
273 |
} |
172 |
} |
274 |
if (prevPath != null && currPath == null) { |
173 |
if (currPath == null) { |
275 |
return prev; |
174 |
return prev; |
276 |
} |
175 |
} |
277 |
if (prevPath.length() >= currPath.length()) { |
176 |
if (prevPath.length() >= currPath.length()) { |
Lines 286-295
Link Here
|
286 |
* @param uri the resource supplied. |
185 |
* @param uri the resource supplied. |
287 |
* @return a JspProperty indicating the best match, or some default. |
186 |
* @return a JspProperty indicating the best match, or some default. |
288 |
*/ |
187 |
*/ |
289 |
public JspProperty findJspProperty(String uri) throws JasperException { |
188 |
public JspProperty findJspProperty(String uri) { |
290 |
|
189 |
|
291 |
init(); |
|
|
292 |
|
293 |
// JSP Configuration settings do not apply to tag files |
190 |
// JSP Configuration settings do not apply to tag files |
294 |
if (jspProperties == null || uri.endsWith(".tag") |
191 |
if (jspProperties == null || uri.endsWith(".tag") |
295 |
|| uri.endsWith(".tagx")) { |
192 |
|| uri.endsWith(".tagx")) { |
Lines 320-329
Link Here
|
320 |
JspPropertyGroup bufferMatch = null; |
217 |
JspPropertyGroup bufferMatch = null; |
321 |
JspPropertyGroup errorOnUndeclaredNamespaceMatch = null; |
218 |
JspPropertyGroup errorOnUndeclaredNamespaceMatch = null; |
322 |
|
219 |
|
323 |
Iterator<JspPropertyGroup> iter = jspProperties.iterator(); |
220 |
for (JspPropertyGroup jpg : jspProperties) { |
324 |
while (iter.hasNext()) { |
|
|
325 |
|
221 |
|
326 |
JspPropertyGroup jpg = iter.next(); |
|
|
327 |
JspProperty jp = jpg.getJspProperty(); |
222 |
JspProperty jp = jpg.getJspProperty(); |
328 |
|
223 |
|
329 |
// (arrays will be the same length) |
224 |
// (arrays will be the same length) |
Lines 339-345
Link Here
|
339 |
} else { |
234 |
} else { |
340 |
// Matching patterns *.ext or /p/* |
235 |
// Matching patterns *.ext or /p/* |
341 |
if (path != null && uriPath != null && |
236 |
if (path != null && uriPath != null && |
342 |
! uriPath.startsWith(path)) { |
237 |
!uriPath.startsWith(path)) { |
343 |
// not matched |
238 |
// not matched |
344 |
continue; |
239 |
continue; |
345 |
} |
240 |
} |
Lines 368-457
Link Here
|
368 |
} |
263 |
} |
369 |
if (jp.isScriptingInvalid() != null) { |
264 |
if (jp.isScriptingInvalid() != null) { |
370 |
scriptingInvalidMatch = |
265 |
scriptingInvalidMatch = |
371 |
selectProperty(scriptingInvalidMatch, jpg); |
266 |
selectProperty(scriptingInvalidMatch, jpg); |
372 |
} |
267 |
} |
373 |
if (jp.getPageEncoding() != null) { |
268 |
if (jp.getPageEncoding() != null) { |
374 |
pageEncodingMatch = selectProperty(pageEncodingMatch, jpg); |
269 |
pageEncodingMatch = selectProperty(pageEncodingMatch, jpg); |
375 |
} |
270 |
} |
376 |
if (jp.isDeferedSyntaxAllowedAsLiteral() != null) { |
271 |
if (jp.isDeferedSyntaxAllowedAsLiteral() != null) { |
377 |
deferedSyntaxAllowedAsLiteralMatch = |
272 |
deferedSyntaxAllowedAsLiteralMatch = |
378 |
selectProperty(deferedSyntaxAllowedAsLiteralMatch, jpg); |
273 |
selectProperty(deferedSyntaxAllowedAsLiteralMatch, jpg); |
379 |
} |
274 |
} |
380 |
if (jp.isTrimDirectiveWhitespaces() != null) { |
275 |
if (jp.isTrimDirectiveWhitespaces() != null) { |
381 |
trimDirectiveWhitespacesMatch = |
276 |
trimDirectiveWhitespacesMatch = |
382 |
selectProperty(trimDirectiveWhitespacesMatch, jpg); |
277 |
selectProperty(trimDirectiveWhitespacesMatch, jpg); |
383 |
} |
278 |
} |
384 |
if (jp.getDefaultContentType() != null) { |
279 |
if (jp.getDefaultContentType() != null) { |
385 |
defaultContentTypeMatch = |
280 |
defaultContentTypeMatch = |
386 |
selectProperty(defaultContentTypeMatch, jpg); |
281 |
selectProperty(defaultContentTypeMatch, jpg); |
387 |
} |
282 |
} |
388 |
if (jp.getBuffer() != null) { |
283 |
if (jp.getBuffer() != null) { |
389 |
bufferMatch = selectProperty(bufferMatch, jpg); |
284 |
bufferMatch = selectProperty(bufferMatch, jpg); |
390 |
} |
285 |
} |
391 |
if (jp.isErrorOnUndeclaredNamespace() != null) { |
286 |
if (jp.isErrorOnUndeclaredNamespace() != null) { |
392 |
errorOnUndeclaredNamespaceMatch = |
287 |
errorOnUndeclaredNamespaceMatch = |
393 |
selectProperty(errorOnUndeclaredNamespaceMatch, jpg); |
288 |
selectProperty(errorOnUndeclaredNamespaceMatch, jpg); |
394 |
} |
289 |
} |
395 |
} |
290 |
} |
396 |
|
291 |
|
397 |
|
292 |
|
398 |
String isXml = defaultIsXml; |
293 |
String isXml = defaultProperty(isXmlMatch).isXml(); |
399 |
String isELIgnored = defaultIsELIgnored; |
294 |
String isELIgnored = defaultProperty(elIgnoredMatch).isELIgnored(); |
400 |
String isScriptingInvalid = defaultIsScriptingInvalid; |
295 |
String isScriptingInvalid = defaultProperty(scriptingInvalidMatch).isScriptingInvalid(); |
401 |
String pageEncoding = null; |
296 |
String pageEncoding = defaultProperty(pageEncodingMatch).getPageEncoding(); |
402 |
String isDeferedSyntaxAllowedAsLiteral = |
297 |
String isDeferedSyntaxAllowedAsLiteral = defaultProperty(defaultContentTypeMatch).isDeferedSyntaxAllowedAsLiteral(); |
403 |
defaultDeferedSyntaxAllowedAsLiteral; |
298 |
String isTrimDirectiveWhitespaces = defaultProperty(trimDirectiveWhitespacesMatch).isTrimDirectiveWhitespaces(); |
404 |
String isTrimDirectiveWhitespaces = defaultTrimDirectiveWhitespaces; |
299 |
String defaultContentType = defaultProperty(defaultContentTypeMatch).getDefaultContentType(); |
405 |
String defaultContentType = defaultDefaultContentType; |
300 |
String buffer = defaultProperty(bufferMatch).getBuffer(); |
406 |
String buffer = defaultBuffer; |
301 |
String errorOnUndeclaredNamespace = defaultProperty(errorOnUndeclaredNamespaceMatch).isErrorOnUndeclaredNamespace(); |
407 |
String errorOnUndelcaredNamespace = defaultErrorOnUndeclaredNamespace; |
|
|
408 |
|
302 |
|
409 |
if (isXmlMatch != null) { |
|
|
410 |
isXml = isXmlMatch.getJspProperty().isXml(); |
411 |
} |
412 |
if (elIgnoredMatch != null) { |
413 |
isELIgnored = elIgnoredMatch.getJspProperty().isELIgnored(); |
414 |
} |
415 |
if (scriptingInvalidMatch != null) { |
416 |
isScriptingInvalid = |
417 |
scriptingInvalidMatch.getJspProperty().isScriptingInvalid(); |
418 |
} |
419 |
if (pageEncodingMatch != null) { |
420 |
pageEncoding = pageEncodingMatch.getJspProperty().getPageEncoding(); |
421 |
} |
422 |
if (deferedSyntaxAllowedAsLiteralMatch != null) { |
423 |
isDeferedSyntaxAllowedAsLiteral = |
424 |
deferedSyntaxAllowedAsLiteralMatch.getJspProperty().isDeferedSyntaxAllowedAsLiteral(); |
425 |
} |
426 |
if (trimDirectiveWhitespacesMatch != null) { |
427 |
isTrimDirectiveWhitespaces = |
428 |
trimDirectiveWhitespacesMatch.getJspProperty().isTrimDirectiveWhitespaces(); |
429 |
} |
430 |
if (defaultContentTypeMatch != null) { |
431 |
defaultContentType = |
432 |
defaultContentTypeMatch.getJspProperty().getDefaultContentType(); |
433 |
} |
434 |
if (bufferMatch != null) { |
435 |
buffer = bufferMatch.getJspProperty().getBuffer(); |
436 |
} |
437 |
if (errorOnUndeclaredNamespaceMatch != null) { |
438 |
errorOnUndelcaredNamespace = |
439 |
errorOnUndeclaredNamespaceMatch.getJspProperty().isErrorOnUndeclaredNamespace(); |
440 |
} |
441 |
|
442 |
return new JspProperty(isXml, isELIgnored, isScriptingInvalid, |
303 |
return new JspProperty(isXml, isELIgnored, isScriptingInvalid, |
443 |
pageEncoding, includePreludes, includeCodas, |
304 |
pageEncoding, includePreludes, includeCodas, |
444 |
isDeferedSyntaxAllowedAsLiteral, isTrimDirectiveWhitespaces, |
305 |
isDeferedSyntaxAllowedAsLiteral, isTrimDirectiveWhitespaces, |
445 |
defaultContentType, buffer, errorOnUndelcaredNamespace); |
306 |
defaultContentType, buffer, errorOnUndeclaredNamespace); |
446 |
} |
307 |
} |
447 |
|
308 |
|
|
|
309 |
private JspProperty defaultProperty(JspPropertyGroup match) { |
310 |
if (match == null) { |
311 |
return defaultJspProperty; |
312 |
} else { |
313 |
return match.getJspProperty(); |
314 |
} |
315 |
} |
316 |
|
448 |
/** |
317 |
/** |
449 |
* To find out if an uri matches an url pattern in jsp config. If so, |
318 |
* To find out if an uri matches an url pattern in jsp config. If so, |
450 |
* then the uri is a JSP page. This is used primarily for jspc. |
319 |
* then the uri is a JSP page. This is used primarily for jspc. |
451 |
*/ |
320 |
*/ |
452 |
public boolean isJspPage(String uri) throws JasperException { |
321 |
public boolean isJspPage(String uri) { |
453 |
|
322 |
|
454 |
init(); |
|
|
455 |
if (jspProperties == null) { |
323 |
if (jspProperties == null) { |
456 |
return false; |
324 |
return false; |
457 |
} |
325 |
} |
Lines 467-477
Link Here
|
467 |
uriExtension = uri.substring(index+1); |
335 |
uriExtension = uri.substring(index+1); |
468 |
} |
336 |
} |
469 |
|
337 |
|
470 |
Iterator<JspPropertyGroup> iter = jspProperties.iterator(); |
338 |
for (JspPropertyGroup jpg : jspProperties) { |
471 |
while (iter.hasNext()) { |
|
|
472 |
|
339 |
|
473 |
JspPropertyGroup jpg = iter.next(); |
|
|
474 |
|
475 |
String extension = jpg.getExtension(); |
340 |
String extension = jpg.getExtension(); |
476 |
String path = jpg.getPath(); |
341 |
String path = jpg.getPath(); |
477 |
|
342 |
|
Lines 530-535
Link Here
|
530 |
private final String buffer; |
395 |
private final String buffer; |
531 |
private final String errorOnUndeclaredNamespace; |
396 |
private final String errorOnUndeclaredNamespace; |
532 |
|
397 |
|
|
|
398 |
private JspProperty(String elIgnored, String deferedSyntaxAllowedAsLiteral) { |
399 |
this(null, elIgnored, null, null, null, null, deferedSyntaxAllowedAsLiteral, null, null, null, null); |
400 |
} |
401 |
|
533 |
public JspProperty(String isXml, String elIgnored, |
402 |
public JspProperty(String isXml, String elIgnored, |
534 |
String scriptingInvalid, String pageEncoding, |
403 |
String scriptingInvalid, String pageEncoding, |
535 |
Vector<String> includePrelude, Vector<String> includeCoda, |
404 |
Vector<String> includePrelude, Vector<String> includeCoda, |