View | Details | Raw Unified | Return to bug 45197
Collapse All | Expand All

(-)conf/c-1_1.tld (+563 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8" ?>
2
3
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
4
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
6
    version="2.0">
7
    
8
  <description>JSTL 1.1 core library</description>
9
  <display-name>JSTL core</display-name>
10
  <tlib-version>1.1</tlib-version>
11
  <short-name>c</short-name>
12
  <uri>http://java.sun.com/jsp/jstl/core_1_1</uri>
13
14
  <validator>
15
    <description>
16
        Provides core validation features for JSTL tags.
17
    </description>
18
    <validator-class>
19
        org.apache.taglibs.standard.tlv.JstlCoreTLV
20
    </validator-class>
21
  </validator>
22
23
  <tag>
24
    <description>
25
        Catches any Throwable that occurs in its body and optionally
26
        exposes it.
27
    </description>
28
    <name>catch</name>
29
    <tag-class>org.apache.taglibs.standard.tag.common.core.CatchTag</tag-class>
30
    <body-content>JSP</body-content>
31
    <attribute>
32
        <description>
33
Name of the exported scoped variable for the
34
exception thrown from a nested action. The type of the
35
scoped variable is the type of the exception thrown.
36
        </description>
37
        <name>var</name>
38
        <required>false</required>
39
        <rtexprvalue>false</rtexprvalue>
40
    </attribute>
41
  </tag>
42
43
  <tag>
44
    <description>
45
	Simple conditional tag that establishes a context for
46
	mutually exclusive conditional operations, marked by
47
	&lt;when&gt; and &lt;otherwise&gt;
48
    </description>
49
    <name>choose</name>
50
    <tag-class>org.apache.taglibs.standard.tag.common.core.ChooseTag</tag-class>
51
    <body-content>JSP</body-content>
52
  </tag>
53
54
  <tag>
55
    <description>
56
	Simple conditional tag, which evalutes its body if the
57
	supplied condition is true and optionally exposes a Boolean
58
	scripting variable representing the evaluation of this condition
59
    </description>
60
    <name>if</name>
61
    <tag-class>org.apache.taglibs.standard.tag.rt.core.IfTag</tag-class>
62
    <body-content>JSP</body-content>
63
    <attribute>
64
        <description>
65
The test condition that determines whether or
66
not the body content should be processed.
67
        </description>
68
        <name>test</name>
69
        <required>true</required>
70
        <rtexprvalue>true</rtexprvalue>
71
	<type>boolean</type>
72
    </attribute>
73
    <attribute>
74
        <description>
75
Name of the exported scoped variable for the
76
resulting value of the test condition. The type
77
of the scoped variable is Boolean.        
78
        </description>
79
        <name>var</name>
80
        <required>false</required>
81
        <rtexprvalue>false</rtexprvalue>
82
    </attribute>
83
    <attribute>
84
        <description>
85
Scope for var.
86
        </description>
87
        <name>scope</name>
88
        <required>false</required>
89
        <rtexprvalue>false</rtexprvalue>
90
    </attribute>
91
  </tag>
92
93
  <tag>
94
    <description>
95
        Retrieves an absolute or relative URL and exposes its contents
96
        to either the page, a String in 'var', or a Reader in 'varReader'.
97
    </description>
98
    <name>import</name>
99
    <tag-class>org.apache.taglibs.standard.tag.rt.core.ImportTag</tag-class>
100
    <tei-class>org.apache.taglibs.standard.tei.ImportTEI</tei-class>
101
    <body-content>JSP</body-content>
102
    <attribute>
103
        <description>
104
The URL of the resource to import.
105
        </description>
106
        <name>url</name>
107
        <required>true</required>
108
        <rtexprvalue>true</rtexprvalue>
109
    </attribute>
110
    <attribute>
111
        <description>
112
Name of the exported scoped variable for the
113
resource's content. The type of the scoped
114
variable is String.
115
        </description>
116
        <name>var</name>
117
        <required>false</required>
118
        <rtexprvalue>false</rtexprvalue>
119
    </attribute>
120
    <attribute>
121
        <description>
122
Scope for var.
123
        </description>
124
        <name>scope</name>
125
        <required>false</required>
126
        <rtexprvalue>false</rtexprvalue>
127
    </attribute>
128
    <attribute>
129
        <description>
130
Name of the exported scoped variable for the
131
resource's content. The type of the scoped
132
variable is Reader.
133
        </description>
134
        <name>varReader</name>
135
        <required>false</required>
136
        <rtexprvalue>false</rtexprvalue>
137
    </attribute>
138
    <attribute>
139
        <description>
140
Name of the context when accessing a relative
141
URL resource that belongs to a foreign
142
context.
143
        </description>
144
        <name>context</name>
145
        <required>false</required>
146
        <rtexprvalue>true</rtexprvalue>
147
    </attribute>
148
    <attribute>
149
        <description>
150
Character encoding of the content at the input
151
resource.
152
        </description>
153
        <name>charEncoding</name>
154
        <required>false</required>
155
        <rtexprvalue>true</rtexprvalue>
156
    </attribute>
157
  </tag>
158
159
  <tag>
160
    <description>
161
	The basic iteration tag, accepting many different
162
        collection types and supporting subsetting and other
163
        functionality
164
    </description>
165
    <name>forEach</name>
166
    <tag-class>org.apache.taglibs.standard.tag.rt.core.ForEachTag</tag-class>
167
    <tei-class>org.apache.taglibs.standard.tei.ForEachTEI</tei-class>
168
    <body-content>JSP</body-content>
169
    <attribute>
170
        <description>
171
Collection of items to iterate over.
172
        </description>
173
	<name>items</name>
174
	<required>false</required>
175
	<rtexprvalue>true</rtexprvalue>
176
	<type>java.lang.Object</type>
177
    </attribute>
178
    <attribute>
179
        <description>
180
If items specified:
181
Iteration begins at the item located at the
182
specified index. First item of the collection has
183
index 0.
184
If items not specified:
185
Iteration begins with index set at the value
186
specified.
187
        </description>
188
	<name>begin</name>
189
	<required>false</required>
190
	<rtexprvalue>true</rtexprvalue>
191
	<type>int</type>
192
    </attribute>
193
    <attribute>
194
        <description>
195
If items specified:
196
Iteration ends at the item located at the
197
specified index (inclusive).
198
If items not specified:
199
Iteration ends when index reaches the value
200
specified.
201
        </description>
202
	<name>end</name>
203
	<required>false</required>
204
	<rtexprvalue>true</rtexprvalue>
205
	<type>int</type>
206
    </attribute>
207
    <attribute>
208
        <description>
209
Iteration will only process every step items of
210
the collection, starting with the first one.
211
        </description>
212
	<name>step</name>
213
	<required>false</required>
214
	<rtexprvalue>true</rtexprvalue>
215
	<type>int</type>
216
    </attribute>
217
    <attribute>
218
        <description>
219
Name of the exported scoped variable for the
220
current item of the iteration. This scoped
221
variable has nested visibility. Its type depends
222
on the object of the underlying collection.
223
        </description>
224
	<name>var</name>
225
	<required>false</required>
226
	<rtexprvalue>false</rtexprvalue>
227
    </attribute>
228
    <attribute>
229
        <description>
230
Name of the exported scoped variable for the
231
status of the iteration. Object exported is of type
232
javax.servlet.jsp.jstl.core.LoopTagStatus. This scoped variable has nested
233
visibility.
234
        </description>
235
	<name>varStatus</name>
236
	<required>false</required>
237
	<rtexprvalue>false</rtexprvalue>
238
    </attribute>
239
  </tag>
240
241
  <tag>
242
    <description>
243
	Iterates over tokens, separated by the supplied delimeters
244
    </description>
245
    <name>forTokens</name>
246
    <tag-class>org.apache.taglibs.standard.tag.rt.core.ForTokensTag</tag-class>
247
    <body-content>JSP</body-content>
248
    <attribute>
249
        <description>
250
String of tokens to iterate over.
251
        </description>
252
	<name>items</name>
253
	<required>true</required>
254
	<rtexprvalue>true</rtexprvalue>
255
	<type>java.lang.String</type>
256
    </attribute>
257
    <attribute>
258
        <description>
259
The set of delimiters (the characters that
260
separate the tokens in the string).
261
        </description>
262
	<name>delims</name>
263
	<required>true</required>
264
	<rtexprvalue>true</rtexprvalue>
265
	<type>java.lang.String</type>
266
    </attribute>
267
    <attribute>
268
        <description>
269
Iteration begins at the token located at the
270
specified index. First token has index 0.
271
        </description>
272
	<name>begin</name>
273
	<required>false</required>
274
	<rtexprvalue>true</rtexprvalue>
275
	<type>int</type>
276
    </attribute>
277
    <attribute>
278
        <description>
279
Iteration ends at the token located at the
280
specified index (inclusive).
281
        </description>
282
	<name>end</name>
283
	<required>false</required>
284
	<rtexprvalue>true</rtexprvalue>
285
	<type>int</type>
286
    </attribute>
287
    <attribute>
288
        <description>
289
Iteration will only process every step tokens
290
of the string, starting with the first one.
291
        </description>
292
	<name>step</name>
293
	<required>false</required>
294
	<rtexprvalue>true</rtexprvalue>
295
	<type>int</type>
296
    </attribute>
297
    <attribute>
298
        <description>
299
Name of the exported scoped variable for the
300
current item of the iteration. This scoped
301
variable has nested visibility.
302
        </description>
303
	<name>var</name>
304
	<required>false</required>
305
	<rtexprvalue>false</rtexprvalue>
306
    </attribute>
307
    <attribute>
308
        <description>
309
Name of the exported scoped variable for the
310
status of the iteration. Object exported is of
311
type
312
javax.servlet.jsp.jstl.core.LoopTag
313
Status. This scoped variable has nested
314
visibility.
315
        </description>
316
	<name>varStatus</name>
317
	<required>false</required>
318
	<rtexprvalue>false</rtexprvalue>
319
    </attribute>
320
  </tag>
321
322
  <tag>
323
    <description>
324
        Like &lt;%= ... &gt;, but for expressions.
325
    </description> 
326
    <name>out</name>
327
    <tag-class>org.apache.taglibs.standard.tag.rt.core.OutTag</tag-class>
328
    <body-content>JSP</body-content>
329
    <attribute>
330
        <description>
331
Expression to be evaluated.
332
        </description>
333
        <name>value</name>
334
        <required>true</required>
335
        <rtexprvalue>true</rtexprvalue>
336
    </attribute>
337
    <attribute>
338
        <description>
339
Default value if the resulting value is null.
340
        </description>
341
        <name>default</name>
342
        <required>false</required>
343
        <rtexprvalue>true</rtexprvalue>
344
    </attribute>
345
    <attribute>
346
        <description>
347
Determines whether characters &lt;,&gt;,&amp;,'," in the
348
resulting string should be converted to their
349
corresponding character entity codes. Default value is
350
true.
351
        </description>
352
        <name>escapeXml</name>
353
        <required>false</required>
354
        <rtexprvalue>true</rtexprvalue>
355
    </attribute>
356
  </tag>
357
358
359
  <tag>
360
    <description>
361
        Subtag of &lt;choose&gt; that follows &lt;when&gt; tags
362
        and runs only if all of the prior conditions evaluated to
363
        'false'
364
    </description>
365
    <name>otherwise</name>
366
    <tag-class>org.apache.taglibs.standard.tag.common.core.OtherwiseTag</tag-class>
367
    <body-content>JSP</body-content>
368
  </tag>
369
370
  <tag>
371
    <description>
372
        Adds a parameter to a containing 'import' tag's URL.
373
    </description>
374
    <name>param</name>
375
    <tag-class>org.apache.taglibs.standard.tag.rt.core.ParamTag</tag-class>
376
    <body-content>JSP</body-content>
377
    <attribute>
378
        <description>
379
Name of the query string parameter.
380
        </description>
381
        <name>name</name>
382
        <required>true</required>
383
        <rtexprvalue>true</rtexprvalue>
384
    </attribute>
385
    <attribute>
386
        <description>
387
Value of the parameter.
388
        </description>
389
        <name>value</name>
390
        <required>false</required>
391
        <rtexprvalue>true</rtexprvalue>
392
    </attribute>
393
  </tag>
394
395
  <tag>
396
    <description>
397
        Redirects to a new URL.
398
    </description>
399
    <name>redirect</name>
400
    <tag-class>org.apache.taglibs.standard.tag.rt.core.RedirectTag</tag-class>
401
    <body-content>JSP</body-content>
402
    <attribute>
403
        <description>
404
The URL of the resource to redirect to.
405
        </description>
406
        <name>url</name>
407
        <required>false</required>
408
        <rtexprvalue>true</rtexprvalue>
409
    </attribute>
410
    <attribute>
411
        <description>
412
Name of the context when redirecting to a relative URL
413
resource that belongs to a foreign context.
414
        </description>
415
        <name>context</name>
416
        <required>false</required>
417
        <rtexprvalue>true</rtexprvalue>
418
    </attribute>
419
  </tag>
420
421
  <tag>
422
    <description>
423
        Removes a scoped variable (from a particular scope, if specified).
424
    </description>
425
    <name>remove</name>
426
    <tag-class>org.apache.taglibs.standard.tag.common.core.RemoveTag</tag-class>
427
    <body-content>empty</body-content>
428
    <attribute>
429
        <description>
430
Name of the scoped variable to be removed.
431
        </description>
432
        <name>var</name>
433
        <required>true</required>
434
        <rtexprvalue>false</rtexprvalue>
435
    </attribute>
436
    <attribute>
437
        <description>
438
Scope for var.
439
        </description>
440
        <name>scope</name>
441
        <required>false</required>
442
        <rtexprvalue>false</rtexprvalue>
443
    </attribute>
444
  </tag>
445
446
 <tag>
447
    <description>
448
        Sets the result of an expression evaluation in a 'scope'
449
    </description>
450
    <name>set</name>
451
    <tag-class>org.apache.taglibs.standard.tag.rt.core.SetTag</tag-class>
452
    <body-content>JSP</body-content>
453
    <attribute>
454
        <description>
455
Name of the exported scoped variable to hold the value
456
specified in the action. The type of the scoped variable is
457
whatever type the value expression evaluates to.
458
        </description>
459
        <name>var</name>
460
        <required>false</required>
461
        <rtexprvalue>false</rtexprvalue>
462
    </attribute>
463
    <attribute>
464
        <description>
465
Expression to be evaluated.
466
        </description>
467
        <name>value</name>
468
        <required>false</required>
469
        <rtexprvalue>true</rtexprvalue>
470
    </attribute>
471
    <attribute>
472
        <description>
473
Target object whose property will be set. Must evaluate to
474
a JavaBeans object with setter property property, or to a
475
java.util.Map object.
476
        </description>
477
        <name>target</name>
478
        <required>false</required>
479
        <rtexprvalue>true</rtexprvalue>
480
    </attribute>
481
    <attribute>
482
        <description>
483
Name of the property to be set in the target object.
484
        </description>
485
        <name>property</name>
486
        <required>false</required>
487
        <rtexprvalue>true</rtexprvalue>
488
    </attribute>
489
    <attribute>
490
        <description>
491
Scope for var.
492
        </description>
493
        <name>scope</name>
494
        <required>false</required>
495
        <rtexprvalue>false</rtexprvalue>
496
    </attribute>
497
  </tag>
498
499
  <tag>
500
    <description>
501
        Creates a URL with optional query parameters.
502
    </description>
503
    <name>url</name>
504
    <tag-class>org.apache.taglibs.standard.tag.rt.core.UrlTag</tag-class>
505
    <body-content>JSP</body-content>
506
    <attribute>
507
        <description>
508
Name of the exported scoped variable for the
509
processed url. The type of the scoped variable is
510
String.
511
        </description>
512
        <name>var</name>
513
        <required>false</required>
514
        <rtexprvalue>false</rtexprvalue>
515
    </attribute>
516
    <attribute>
517
        <description>
518
Scope for var.
519
        </description>
520
        <name>scope</name>
521
        <required>false</required>
522
        <rtexprvalue>false</rtexprvalue>
523
    </attribute>
524
    <attribute>
525
        <description>
526
URL to be processed.
527
        </description>
528
        <name>value</name>
529
        <required>false</required>
530
        <rtexprvalue>true</rtexprvalue>
531
    </attribute>
532
    <attribute>
533
        <description>
534
Name of the context when specifying a relative URL
535
resource that belongs to a foreign context.
536
        </description>
537
        <name>context</name>
538
        <required>false</required>
539
        <rtexprvalue>true</rtexprvalue>
540
    </attribute>
541
  </tag>
542
543
  <tag>
544
    <description>
545
	Subtag of &lt;choose&gt; that includes its body if its
546
	condition evalutes to 'true'
547
    </description>
548
    <name>when</name>
549
    <tag-class>org.apache.taglibs.standard.tag.rt.core.WhenTag</tag-class>
550
    <body-content>JSP</body-content>
551
    <attribute>
552
        <description>
553
The test condition that determines whether or not the
554
body content should be processed.
555
        </description>
556
        <name>test</name>
557
        <required>true</required>
558
        <rtexprvalue>true</rtexprvalue>
559
	<type>boolean</type>
560
    </attribute>
561
  </tag>
562
563
</taglib>
(-)conf/c.tld (-6 / +15 lines)
Lines 1-13 Link Here
1
<?xml version="1.0" encoding="UTF-8" ?>
1
<?xml version="1.0" encoding="UTF-8" ?>
2
2
3
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
3
<taglib xmlns="http://java.sun.com/xml/ns/javaee"
4
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
5
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
6
    version="2.0">
6
    version="2.1">
7
    
7
8
  <description>JSTL 1.1 core library</description>
8
  <description>JSTL 1.2 core library</description>
9
  <display-name>JSTL core</display-name>
9
  <display-name>JSTL core</display-name>
10
  <tlib-version>1.1</tlib-version>
10
  <tlib-version>1.2</tlib-version>
11
  <short-name>c</short-name>
11
  <short-name>c</short-name>
12
  <uri>http://java.sun.com/jsp/jstl/core</uri>
12
  <uri>http://java.sun.com/jsp/jstl/core</uri>
13
13
Lines 174-179 Link Here
174
	<required>false</required>
174
	<required>false</required>
175
	<rtexprvalue>true</rtexprvalue>
175
	<rtexprvalue>true</rtexprvalue>
176
	<type>java.lang.Object</type>
176
	<type>java.lang.Object</type>
177
	<deferred-value>
178
	    <type>java.lang.Object</type>
179
    </deferred-value>
177
    </attribute>
180
    </attribute>
178
    <attribute>
181
    <attribute>
179
        <description>
182
        <description>
Lines 253-258 Link Here
253
	<required>true</required>
256
	<required>true</required>
254
	<rtexprvalue>true</rtexprvalue>
257
	<rtexprvalue>true</rtexprvalue>
255
	<type>java.lang.String</type>
258
	<type>java.lang.String</type>
259
    <deferred-value>
260
	    <type>java.lang.String</type>
261
    </deferred-value>	
256
    </attribute>
262
    </attribute>
257
    <attribute>
263
    <attribute>
258
        <description>
264
        <description>
Lines 467-472 Link Here
467
        <name>value</name>
473
        <name>value</name>
468
        <required>false</required>
474
        <required>false</required>
469
        <rtexprvalue>true</rtexprvalue>
475
        <rtexprvalue>true</rtexprvalue>
476
        <deferred-value>
477
	        <type>java.lang.Object</type>
478
        </deferred-value>
470
    </attribute>
479
    </attribute>
471
    <attribute>
480
    <attribute>
472
        <description>
481
        <description>
(-)src/org/apache/taglibs/standard/lang/jstl/test/PageContextImpl.java (+2 lines)
Lines 31-36 Link Here
31
import javax.servlet.jsp.PageContext;
31
import javax.servlet.jsp.PageContext;
32
import javax.servlet.jsp.el.ExpressionEvaluator;
32
import javax.servlet.jsp.el.ExpressionEvaluator;
33
import javax.servlet.jsp.el.VariableResolver;
33
import javax.servlet.jsp.el.VariableResolver;
34
import javax.el.ELContext;
34
35
35
/**
36
/**
36
 *
37
 *
Lines 298-301 Link Here
298
  public ExpressionEvaluator getExpressionEvaluator() { return null; }
299
  public ExpressionEvaluator getExpressionEvaluator() { return null; }
299
  public VariableResolver getVariableResolver() { return null; }  
300
  public VariableResolver getVariableResolver() { return null; }  
300
  
301
  
302
  public ELContext getELContext() { return null; }
301
}
303
}
(-)src/org/apache/taglibs/standard/extra/spath/SPathFilter.java (-4 / +4 lines)
Lines 20-28 Link Here
20
import java.util.List;
20
import java.util.List;
21
import java.util.Stack;
21
import java.util.Stack;
22
22
23
import org.apache.xalan.serialize.Serializer;
23
import org.apache.xml.serializer.Serializer;
24
import org.apache.xalan.serialize.SerializerFactory;
24
import org.apache.xml.serializer.SerializerFactory;
25
import org.apache.xalan.templates.OutputProperties;
25
import org.apache.xml.serializer.OutputPropertiesFactory;
26
import org.xml.sax.Attributes;
26
import org.xml.sax.Attributes;
27
import org.xml.sax.InputSource;
27
import org.xml.sax.InputSource;
28
import org.xml.sax.SAXException;
28
import org.xml.sax.SAXException;
Lines 76-82 Link Here
76
	f1.setParent(r);
76
	f1.setParent(r);
77
	f2.setParent(f1);
77
	f2.setParent(f1);
78
	Serializer sz = SerializerFactory.getSerializer
78
	Serializer sz = SerializerFactory.getSerializer
79
	    (OutputProperties.getDefaultMethodProperties("xml"));
79
	    (OutputPropertiesFactory.getDefaultMethodProperties("xml"));
80
	sz.setOutputStream(System.out);
80
	sz.setOutputStream(System.out);
81
	f2.setContentHandler(sz.asContentHandler());
81
	f2.setContentHandler(sz.asContentHandler());
82
82
(-)src/org/apache/taglibs/standard/tag/rt/core/ForTokensTag.java (-2 / +2 lines)
Lines 58-65 Link Here
58
        validateStep();
58
        validateStep();
59
    }
59
    }
60
60
61
    // stores the 'items' String we're passed
61
    // stores the 'items' Object we're passed
62
    public void setItems(String s) throws JspTagException {
62
    public void setItems(Object s) throws JspTagException {
63
        items = s;
63
        items = s;
64
	// use the empty string to indicate "no iteration"
64
	// use the empty string to indicate "no iteration"
65
        if (s == null)
65
        if (s == null)
(-)src/org/apache/taglibs/standard/tag/common/sql/DataSourceWrapper.java (-5 / +24 lines)
Lines 39-50 Link Here
39
    private String password;
39
    private String password;
40
40
41
    public void setDriverClassName(String driverClassName) 
41
    public void setDriverClassName(String driverClassName) 
42
	throws ClassNotFoundException, InstantiationException, 
42
        throws ClassNotFoundException, InstantiationException, 
43
	       IllegalAccessException {
43
            IllegalAccessException {
44
44
45
	this.driverClassName = driverClassName;
45
        this.driverClassName = driverClassName;
46
        Class.forName(driverClassName, true, 
46
47
            Thread.currentThread().getContextClassLoader()).newInstance();
47
        //get the classloader
48
        ClassLoader cl;
49
        SecurityManager sm = System.getSecurityManager();
50
        if (sm == null) {
51
            cl = Thread.currentThread().getContextClassLoader();
52
        } else {
53
            cl = java.security.AccessController.doPrivileged(
54
                    new java.security.PrivilegedAction<ClassLoader>() 
55
                    {public ClassLoader run() {return Thread.currentThread().getContextClassLoader();}});
56
        }
57
        //done getting classloader
58
    
59
        Class.forName(driverClassName, true, cl).newInstance();
48
    }
60
    }
49
61
50
    public void setJdbcURL(String jdbcURL) {
62
    public void setJdbcURL(String jdbcURL) {
Lines 110-115 Link Here
110
    public synchronized void setLogWriter(PrintWriter out) throws SQLException {
122
    public synchronized void setLogWriter(PrintWriter out) throws SQLException {
111
        throw new SQLException(Resources.getMessage("NOT_SUPPORTED"));
123
        throw new SQLException(Resources.getMessage("NOT_SUPPORTED"));
112
    }
124
    }
125
    
126
    public synchronized boolean isWrapperFor(Class c) throws SQLException {
127
        throw new SQLException(Resources.getMessage("NOT_SUPPORTED"));
128
    }
113
129
130
    public synchronized Object unwrap(Class c) throws SQLException {
131
        throw new SQLException(Resources.getMessage("NOT_SUPPORTED"));
132
    }
114
133
115
}
134
}
(-)src/org/apache/taglibs/standard/tag/common/fmt/BundleSupport.java (-5 / +17 lines)
Lines 200-207 Link Here
200
	if (locCtxt == null) {
200
	if (locCtxt == null) {
201
	    // try using the root resource bundle with the given basename
201
	    // try using the root resource bundle with the given basename
202
	    try {
202
	    try {
203
		bundle = ResourceBundle.getBundle(basename, EMPTY_LOCALE,
203
	        ClassLoader cl = getClassLoaderCheckingPrivilege();
204
						  Thread.currentThread().getContextClassLoader());
204
            bundle = ResourceBundle.getBundle(basename, EMPTY_LOCALE, cl);
205
		if (bundle != null) {
205
		if (bundle != null) {
206
		    locCtxt = new LocalizationContext(bundle, null);
206
		    locCtxt = new LocalizationContext(bundle, null);
207
		}
207
		}
Lines 278-286 Link Here
278
	ResourceBundle match = null;
278
	ResourceBundle match = null;
279
279
280
	try {
280
	try {
281
	    ResourceBundle bundle =
281
	    ClassLoader cl = getClassLoaderCheckingPrivilege();
282
		ResourceBundle.getBundle(basename, pref,
282
        ResourceBundle bundle = ResourceBundle.getBundle(basename, pref, cl);
283
					 Thread.currentThread().getContextClassLoader());
284
	    Locale avail = bundle.getLocale();
283
	    Locale avail = bundle.getLocale();
285
	    if (pref.equals(avail)) {
284
	    if (pref.equals(avail)) {
286
		// Exact match
285
		// Exact match
Lines 325-328 Link Here
325
324
326
	return match;
325
	return match;
327
    }
326
    }
327
    
328
    private static ClassLoader getClassLoaderCheckingPrivilege() {
329
        ClassLoader cl;
330
        SecurityManager sm = System.getSecurityManager();
331
        if (sm == null) {
332
            cl = Thread.currentThread().getContextClassLoader();
333
        } else {
334
            cl = java.security.AccessController.doPrivileged(
335
                new java.security.PrivilegedAction<ClassLoader>() 
336
                {public ClassLoader run() {return Thread.currentThread().getContextClassLoader();}});
337
        }
338
        return cl;
339
    }
328
}
340
}
(-)src/org/apache/taglibs/standard/tag/common/core/ForEachSupport.java (-2 / +148 lines)
Lines 23-29 Link Here
23
import java.util.Map;
23
import java.util.Map;
24
import java.util.StringTokenizer;
24
import java.util.StringTokenizer;
25
25
26
import javax.el.ELContext;
27
import javax.el.ValueExpression;
28
import javax.el.VariableMapper;
26
import javax.servlet.jsp.JspTagException;
29
import javax.servlet.jsp.JspTagException;
30
import javax.servlet.jsp.jstl.core.IndexedValueExpression;
31
import javax.servlet.jsp.jstl.core.IteratedExpression;
32
import javax.servlet.jsp.jstl.core.IteratedValueExpression;
27
import javax.servlet.jsp.jstl.core.LoopTagSupport;
33
import javax.servlet.jsp.jstl.core.LoopTagSupport;
28
34
29
import org.apache.taglibs.standard.resources.Resources;
35
import org.apache.taglibs.standard.resources.Resources;
Lines 108-114 Link Here
108
            return i.next();
114
            return i.next();
109
        }
115
        }
110
    }
116
    }
117
    
118
    protected class DeferredForEachIterator implements ForEachIterator {
111
119
120
        private ValueExpression itemsValueExpression;
121
        private IteratedExpression itemsValueIteratedExpression;
122
        private int length = -1;
123
        private int currentIndex = 0;
124
        private boolean isIndexedValueExpression = false;
125
        private boolean anIterator = false;
126
        private Iterator myIterator;
127
        private boolean anEnumeration = false;
128
        private Enumeration myEnumeration;
129
        public DeferredForEachIterator(ValueExpression o) throws JspTagException {
130
            itemsValueExpression = o;
131
            determineLengthAndType();
132
        }
133
        public boolean hasNext() throws JspTagException {
134
            if (isIndexedValueExpression) {
135
                if (currentIndex<length) {
136
                    return true;
137
                } else {
138
                    return false;
139
                }                
140
            } else {
141
                if (length!=-1) {
142
                    //a Collection, Map, or StringTokenizer 
143
                    if (currentIndex<length) {
144
                        return true;
145
                    } else {
146
                        return false;
147
                    }
148
                } else {
149
                    if (anIterator) {
150
                        return myIterator.hasNext();
151
                    } else if (anEnumeration) {
152
                        return myEnumeration.hasMoreElements();
153
                    } else {
154
                        //don't know what this is
155
                        return false;
156
                    }
157
                }
158
            }
159
        }
160
        public Object next() throws JspTagException {
161
            ValueExpression nextValue = null;
162
            if (isIndexedValueExpression) {
163
                nextValue = new IndexedValueExpression(itemsValueExpression, currentIndex);
164
                currentIndex++;
165
            } else {
166
                if (itemsValueIteratedExpression==null) {
167
                    itemsValueIteratedExpression = new IteratedExpression(itemsValueExpression, getDelims());
168
                }
169
                nextValue = new IteratedValueExpression(itemsValueIteratedExpression, currentIndex);
170
                currentIndex++;
171
                if (length!=-1) {
172
                    //a Collection, Map, or StringTokenizer
173
                    //nothing else needed
174
                } else {
175
                    //need to increment these guys
176
                    if (anIterator) {
177
                        myIterator.next();
178
                    } else if (anEnumeration) {
179
                        myEnumeration.nextElement();
180
                    }
181
                }
182
            }
183
            return nextValue;
184
        }
185
        private void determineLengthAndType() throws JspTagException {
186
            ELContext myELContext = pageContext.getELContext();
187
            Object o = itemsValueExpression.getValue(myELContext);
188
            if (o instanceof Object[]) {
189
                length = ((Object[])o).length;
190
                isIndexedValueExpression = true;
191
            } else if (o instanceof boolean[]) {
192
                length = ((boolean[])o).length;
193
                isIndexedValueExpression = true;
194
            } else if (o instanceof byte[]) {
195
                length = ((byte[])o).length;
196
                isIndexedValueExpression = true;
197
            } else if (o instanceof char[]) {
198
                length = ((char[])o).length;
199
                isIndexedValueExpression = true;
200
            } else if (o instanceof short[]) {
201
                length = ((short[])o).length;
202
                isIndexedValueExpression = true;
203
            } else if (o instanceof int[]) {
204
                length = ((int[])o).length;
205
                isIndexedValueExpression = true;
206
            } else if (o instanceof long[]) {
207
                length = ((long[])o).length;
208
                isIndexedValueExpression = true;
209
            } else if (o instanceof float[]) {
210
                length = ((float[])o).length;
211
                isIndexedValueExpression = true;
212
            } else if (o instanceof double[]) {
213
                length = ((double[])o).length;
214
                isIndexedValueExpression = true;
215
            } else if (o instanceof Collection) {
216
                length = ((Collection)o).size();
217
                isIndexedValueExpression = false;
218
            } else if (o instanceof Iterator) {
219
                //have to reproduce iterator here so we can determine the size
220
                isIndexedValueExpression = false;
221
                anIterator = true;
222
                myIterator = (Iterator)o;
223
            } else if (o instanceof Enumeration) {
224
                isIndexedValueExpression = false;
225
                anEnumeration=true;
226
                myEnumeration = (Enumeration)o;
227
            } else if (o instanceof Map) {
228
                length = ((Map)o).size();
229
                isIndexedValueExpression = false;
230
            //
231
            //else if (o instanceof ResultSet)
232
            //    items = toForEachIterator((ResultSet) o);
233
            //
234
            } else if (o instanceof String) {
235
                StringTokenizer st = new StringTokenizer((String)o, ",");
236
                length = st.countTokens();
237
                isIndexedValueExpression = false;
238
            } else {
239
                //What does this mean if we get here???
240
                length=0;
241
            }
242
        }
243
    }
112
244
113
    //*********************************************************************
245
    //*********************************************************************
114
    // ForEach-specifc state (protected)
246
    // ForEach-specifc state (protected)
Lines 133-140 Link Here
133
    protected void prepare() throws JspTagException {
265
    protected void prepare() throws JspTagException {
134
        // produce the right sort of ForEachIterator
266
        // produce the right sort of ForEachIterator
135
        if (rawItems != null) {
267
        if (rawItems != null) {
136
            // extract an iterator over the 'items' we've got
268
            if (rawItems instanceof ValueExpression) {
137
            items = supportedTypeForEachIterator(rawItems);
269
                deferredExpression = (ValueExpression)rawItems;
270
                ELContext myELContext = pageContext.getELContext();
271
                VariableMapper vm = myELContext.getVariableMapper();
272
                //String itemsName=deferredExpression.getExpressionString();
273
                //vm.setVariable(itemsName, deferredExpression);
274
                items = toDeferredForEachIterator(deferredExpression);
275
            } else {
276
                // extract an iterator over the 'items' we've got
277
                items = supportedTypeForEachIterator(rawItems);
278
            }
138
        } else {
279
        } else {
139
            // no 'items', so use 'begin' and 'end'
280
            // no 'items', so use 'begin' and 'end'
140
            items = beginEndForEachIterator();
281
            items = beginEndForEachIterator();
Lines 164-169 Link Here
164
    // Private generation methods for the ForEachIterators we produce
305
    // Private generation methods for the ForEachIterators we produce
165
306
166
    /* Extracts a ForEachIterator given an object of a supported type. */
307
    /* Extracts a ForEachIterator given an object of a supported type. */
308
    //This should not be called for a deferred ValueExpression
167
    protected ForEachIterator supportedTypeForEachIterator(Object o)
309
    protected ForEachIterator supportedTypeForEachIterator(Object o)
168
            throws JspTagException {
310
            throws JspTagException {
169
311
Lines 249-254 Link Here
249
    //*********************************************************************
391
    //*********************************************************************
250
    // Private conversion methods to handle the various types we support
392
    // Private conversion methods to handle the various types we support
251
393
394
    protected ForEachIterator toDeferredForEachIterator(ValueExpression o) throws JspTagException {
395
        return new DeferredForEachIterator(o);
396
    }
397
    
252
    // catch-all method whose invocation currently signals a 'matching error'
398
    // catch-all method whose invocation currently signals a 'matching error'
253
    protected ForEachIterator toForEachIterator(Object o)
399
    protected ForEachIterator toForEachIterator(Object o)
254
            throws JspTagException {
400
            throws JspTagException {
(-)src/org/apache/taglibs/standard/tag/common/core/ForTokensSupport.java (-3 / +38 lines)
Lines 18-24 Link Here
18
18
19
import java.util.StringTokenizer;
19
import java.util.StringTokenizer;
20
20
21
import javax.el.ELContext;
22
import javax.el.ValueExpression;
23
import javax.el.VariableMapper;
21
import javax.servlet.jsp.JspTagException;
24
import javax.servlet.jsp.JspTagException;
25
import javax.servlet.jsp.jstl.core.IteratedExpression;
26
import javax.servlet.jsp.jstl.core.IteratedValueExpression;
22
import javax.servlet.jsp.jstl.core.LoopTagSupport;
27
import javax.servlet.jsp.jstl.core.LoopTagSupport;
23
28
24
/**
29
/**
Lines 49-57 Link Here
49
    //*********************************************************************
54
    //*********************************************************************
50
    // ForEachTokens-specific state (protected)
55
    // ForEachTokens-specific state (protected)
51
56
52
    protected String items;                       // 'items' attribute
57
    protected Object items;                       // 'items' attribute
53
    protected String delims;                      // 'delims' attribute
58
    protected String delims;                      // 'delims' attribute
54
    protected StringTokenizer st;                 // digested tokenizer
59
    protected StringTokenizer st;                 // digested tokenizer
60
    protected int currentIndex = 0;
61
    private IteratedExpression itemsValueIteratedExpression;
55
62
56
63
57
    //*********************************************************************
64
    //*********************************************************************
Lines 63-69 Link Here
63
     */
70
     */
64
71
65
    protected void prepare() throws JspTagException {
72
    protected void prepare() throws JspTagException {
66
      st = new StringTokenizer(items, delims);
73
        if (items instanceof ValueExpression) {
74
            deferredExpression = (ValueExpression) items;
75
            ELContext myELContext = pageContext.getELContext();
76
            Object originalValue = deferredExpression.getValue(myELContext);
77
            if (originalValue instanceof String) {
78
                st = new StringTokenizer((String)originalValue, delims);
79
            } else {
80
                throw new JspTagException();
81
            }
82
        } else {
83
            st = new StringTokenizer((String)items, delims);
84
        }
67
    }
85
    }
68
86
69
    protected boolean hasNext() throws JspTagException {
87
    protected boolean hasNext() throws JspTagException {
Lines 71-77 Link Here
71
    }
89
    }
72
90
73
    protected Object next() throws JspTagException {
91
    protected Object next() throws JspTagException {
74
        return st.nextElement();
92
        if (deferredExpression!=null) {
93
            st.nextElement();
94
            if (itemsValueIteratedExpression==null) {
95
                itemsValueIteratedExpression = new IteratedExpression(deferredExpression, getDelims());
96
            }
97
            ValueExpression nextValue = new IteratedValueExpression(itemsValueIteratedExpression, currentIndex);
98
            currentIndex++;
99
            return nextValue;
100
        } else {
101
            return st.nextElement();
102
        }
75
    }
103
    }
76
104
77
105
Lines 86-89 Link Here
86
        st = null;
114
        st = null;
87
    }
115
    }
88
116
117
    /**
118
     * Get the delimiter for string tokens. Used only for constructing
119
     * the deferred expression for it.
120
     */
121
    protected String getDelims() {
122
        return delims;
123
    }
89
}
124
}
(-)src/org/apache/taglibs/standard/tag/common/core/SetSupport.java (-38 / +55 lines)
Lines 24-34 Link Here
24
import java.util.Map;
24
import java.util.Map;
25
25
26
import javax.servlet.jsp.JspException;
26
import javax.servlet.jsp.JspException;
27
import javax.servlet.jsp.JspFactory;
27
import javax.servlet.jsp.JspTagException;
28
import javax.servlet.jsp.JspTagException;
28
import javax.servlet.jsp.PageContext;
29
import javax.servlet.jsp.PageContext;
29
import javax.servlet.jsp.el.ELException;
30
import javax.el.ELContext;
30
import javax.servlet.jsp.el.ExpressionEvaluator;
31
import javax.el.ValueExpression;
31
import javax.servlet.jsp.el.VariableResolver;
32
import javax.el.VariableMapper;
33
import javax.el.ExpressionFactory;
32
import javax.servlet.jsp.tagext.BodyTagSupport;
34
import javax.servlet.jsp.tagext.BodyTagSupport;
33
35
34
import org.apache.taglibs.standard.resources.Resources;
36
import org.apache.taglibs.standard.resources.Resources;
Lines 87-122 Link Here
87
89
88
        // determine the value by...
90
        // determine the value by...
89
        if (value != null) {
91
        if (value != null) {
90
	    // ... reading our attribute
92
            // ... reading our attribute
91
	    result = value;
93
            result = value;
92
  	} else if (valueSpecified) {
94
        } else if (valueSpecified) {
93
	    // ... accepting an explicit null
95
            // ... accepting an explicit null
94
	    result = null;
96
            result = null;
95
	} else {
97
        } else {
96
	    // ... retrieving and trimming our body
98
            // ... retrieving and trimming our body
97
	    if (bodyContent == null || bodyContent.getString() == null)
99
            if (bodyContent == null || bodyContent.getString() == null)
98
		result = "";
100
                result = "";
99
	    else
101
            else
100
	        result = bodyContent.getString().trim();
102
                result = bodyContent.getString().trim();
101
	}
103
        }
102
104
103
	// decide what to do with the result
105
        // decide what to do with the result
104
	if (var != null) {
106
        if (var != null) {
105
107
            /*
106
	    /*
107
             * Store the result, letting an IllegalArgumentException
108
             * Store the result, letting an IllegalArgumentException
108
             * propagate back if the scope is invalid (e.g., if an attempt
109
             * propagate back if the scope is invalid (e.g., if an attempt
109
             * is made to store something in the session without any
110
             * is made to store something in the session without any
110
	     * HttpSession existing).
111
             * HttpSession existing).
111
             */
112
             */
112
	    if (result != null) {
113
            ELContext myELContext = pageContext.getELContext();
113
	        pageContext.setAttribute(var, result, scope);
114
            VariableMapper vm = myELContext.getVariableMapper();
114
	    } else {
115
            if (result != null) {            
115
		if (scopeSpecified)
116
                //check for instanceof valueExpression
116
		    pageContext.removeAttribute(var, scope);
117
                if (result instanceof ValueExpression) {
117
		else
118
                    if (scope!=PageContext.PAGE_SCOPE) {
118
		    pageContext.removeAttribute(var);
119
                        throw new JspException("Incorrect scope for ValueExpression.  PageScope is required.");
119
	    }
120
                    }
121
                    //set variable in var Mapper
122
                    vm.setVariable(var, (ValueExpression)result);
123
                } else {
124
                    /*
125
                    //else if not valueExpression - make sure to remove it from the Var mapper
126
                    //if the scope is page, should I remove this?
127
                    if (vm.resolveVariable(var)!=null) {
128
                        vm.setVariable(var, null);
129
                    }*/
130
                    pageContext.setAttribute(var, result, scope);
131
                }
132
            } else {
133
                //make sure to remove it from the Var mapper
134
                if (vm.resolveVariable(var)!=null) {
135
                    vm.setVariable(var, null);
136
                }
137
                if (scopeSpecified)
138
                    pageContext.removeAttribute(var, scope);
139
                else
140
                    pageContext.removeAttribute(var);
141
            }
120
142
121
	} else if (target != null) {
143
	} else if (target != null) {
122
144
Lines 147-153 Link Here
147
			        m.invoke(target,
169
			        m.invoke(target,
148
			             new Object[] { 
170
			             new Object[] { 
149
                                         convertToExpectedType(result, m.getParameterTypes()[0])});
171
                                         convertToExpectedType(result, m.getParameterTypes()[0])});
150
                                } catch (javax.servlet.jsp.el.ELException ex) {
172
                                } catch (javax.el.ELException ex) {
151
                                    throw new JspTagException(ex);
173
                                    throw new JspTagException(ex);
152
                                }
174
                                }
153
			    } else {
175
			    } else {
Lines 183-197 Link Here
183
     */
205
     */
184
    private Object convertToExpectedType( final Object value,
206
    private Object convertToExpectedType( final Object value,
185
    Class expectedType )
207
    Class expectedType )
186
    throws javax.servlet.jsp.el.ELException {
208
    throws javax.el.ELException {
187
        ExpressionEvaluator evaluator = pageContext.getExpressionEvaluator();
209
        JspFactory jspFactory = JspFactory.getDefaultFactory();
188
        return evaluator.evaluate( "${result}", expectedType,
210
        ExpressionFactory expressionFactory = jspFactory.getJspApplicationContext(pageContext.getServletContext()).getExpressionFactory();
189
        new VariableResolver() {
211
        return expressionFactory.coerceToType(value, expectedType);
190
            public Object resolveVariable( String pName )
191
            throws ELException {
192
                return value;
193
            }
194
        }, null );
195
    }
212
    }
196
213
197
    //*********************************************************************
214
    //*********************************************************************
(-)src/javax/servlet/jsp/jstl/tlv/ScriptFreeTLV.java (-1 / +1 lines)
Lines 76-82 Link Here
76
   * @param initParms a mapping from the names of the initialization parameters
76
   * @param initParms a mapping from the names of the initialization parameters
77
   * to their values, as specified in the TLD.
77
   * to their values, as specified in the TLD.
78
   */
78
   */
79
  public void setInitParameters (Map initParms) {
79
  public void setInitParameters (Map<java.lang.String, java.lang.Object> initParms) {
80
    super.setInitParameters(initParms);
80
    super.setInitParameters(initParms);
81
    String declarationsParm = (String) initParms.get("allowDeclarations");
81
    String declarationsParm = (String) initParms.get("allowDeclarations");
82
    String scriptletsParm = (String) initParms.get("allowScriptlets");
82
    String scriptletsParm = (String) initParms.get("allowScriptlets");
(-)src/javax/servlet/jsp/jstl/core/IteratedExpression.java (+136 lines)
Line 0 Link Here
1
/**
2
 *  Licensed to the Apache Software Foundation (ASF) under one
3
 *  or more contributor license agreements.  See the NOTICE file
4
 *  distributed with this work for additional information
5
 *  regarding copyright ownership.  The ASF licenses this file
6
 *  to you under the Apache License, Version 2.0 (the
7
 *  "License"); you may not use this file except in compliance
8
 *  with the License.  You may obtain a copy of the License at
9
 *
10
 *    http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 *  Unless required by applicable law or agreed to in writing,
13
 *  software distributed under the License is distributed on an
14
 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
 *  KIND, either express or implied.  See the License for the
16
 *  specific language governing permissions and limitations
17
 *  under the License.
18
 */
19
20
package javax.servlet.jsp.jstl.core;
21
22
import java.util.Collection;
23
import java.util.Enumeration;
24
import java.util.Iterator;
25
import java.util.Map;
26
import java.util.Set;
27
import java.util.StringTokenizer;
28
import java.util.Vector;
29
30
import javax.el.ELContext;
31
import javax.el.ValueExpression;
32
33
public final class IteratedExpression {
34
    protected final ValueExpression orig;
35
    protected final String delims;
36
    private Object originalListObject = null;
37
    private Iterator currentListObject = null;
38
    private int currentIndex=0;
39
    private enum TypesEnum {Undefined, ACollection, AnIterator, AnEnumeration, AMap, AString};
40
    private TypesEnum type = TypesEnum.Undefined;
41
    
42
    public IteratedExpression(ValueExpression valueExpression, String stringTokenSeparator) {
43
        orig = valueExpression;
44
        delims = stringTokenSeparator;
45
    }
46
    
47
    public Object getItem(ELContext context, int i) {
48
        if (originalListObject == null) {
49
            originalListObject = orig.getValue(context);
50
            if (originalListObject instanceof Collection){
51
                type=TypesEnum.ACollection;
52
            } else if (originalListObject instanceof Iterator) {
53
                type=TypesEnum.AnIterator;
54
            } else if (originalListObject instanceof Enumeration) {
55
                type=TypesEnum.AnEnumeration;
56
            } else if (originalListObject instanceof Map) {
57
                type=TypesEnum.AMap;
58
            } else if (originalListObject instanceof String) { //StringTokens
59
                type=TypesEnum.AString;
60
            } else {
61
                //it's of some other type ... should never get here
62
                throw new RuntimeException("IteratedExpression.getItem: Object not of correct type.");
63
            }
64
            currentListObject = returnNewIterator(originalListObject, type);
65
        }
66
        Object currentObject=null;
67
        if (i<currentIndex) {
68
            currentListObject = returnNewIterator(originalListObject, type);
69
            currentIndex = 0;
70
        } 
71
        for (;currentIndex<=i;currentIndex++) {
72
            if (currentListObject.hasNext()) {
73
                currentObject= currentListObject.next();
74
            } else {
75
                throw new RuntimeException("IteratedExpression.getItem: Index out of Bounds");
76
            }
77
        }
78
        return currentObject;
79
    }
80
    
81
    public ValueExpression getValueExpression() {
82
        return orig;
83
    }
84
85
    private Iterator returnNewIterator(Object o, TypesEnum type) {
86
        Iterator i = null;
87
        switch (type) {
88
        case ACollection: 
89
            i = ((Collection)o).iterator();
90
            break;
91
        case AnIterator: 
92
            if (currentListObject==null) {
93
                //first time through ... need to create Vector for originalListObject
94
                Vector v = new Vector();
95
                Iterator myI = (Iterator)o;
96
                while (myI.hasNext()) {
97
                    v.add(myI.next());
98
                }
99
                originalListObject = v;
100
            }
101
            i = ((Vector)originalListObject).iterator();
102
            break;
103
        case AnEnumeration: 
104
            if (currentListObject==null) {
105
                //first time through ... need to create Vector for originalListObject
106
                Vector v = new Vector();
107
                Enumeration myE = (Enumeration)o;
108
                while (myE.hasMoreElements()) {
109
                    v.add(myE.nextElement());
110
                }
111
                originalListObject = v;
112
            }
113
            i = ((Vector)originalListObject).iterator();
114
            break;
115
        case AMap: 
116
            Set s = ((Map)o).entrySet();
117
            i = s.iterator();
118
            break;
119
        case AString: 
120
            if (currentListObject==null) {
121
                //first time through ... need to create Vector for originalListObject
122
                Vector v = new Vector();
123
                StringTokenizer st = new StringTokenizer((String)o, delims);
124
                while (st.hasMoreElements()) {
125
                    v.add(st.nextElement());
126
                }
127
                originalListObject = v;
128
            }
129
            i = ((Vector)originalListObject).iterator();
130
            break;
131
        default: //do Nothing ... this is not possible 
132
            break;
133
        }
134
        return i;        
135
    }
136
}
(-)src/javax/servlet/jsp/jstl/core/LoopTagSupport.java (-25 / +48 lines)
Lines 16-21 Link Here
16
16
17
package javax.servlet.jsp.jstl.core;
17
package javax.servlet.jsp.jstl.core;
18
18
19
import javax.el.ELContext;
20
import javax.el.ValueExpression;
21
import javax.el.VariableMapper;
19
import javax.servlet.jsp.JspException;
22
import javax.servlet.jsp.JspException;
20
import javax.servlet.jsp.JspTagException;
23
import javax.servlet.jsp.JspTagException;
21
import javax.servlet.jsp.PageContext;
24
import javax.servlet.jsp.PageContext;
Lines 104-109 Link Here
104
    /** Attribute-exposing control */
107
    /** Attribute-exposing control */
105
    protected String itemId, statusId;
108
    protected String itemId, statusId;
106
109
110
    protected ValueExpression deferredExpression=null;
107
111
108
    //*********************************************************************
112
    //*********************************************************************
109
    // 'Private' state (implementation details)
113
    // 'Private' state (implementation details)
Lines 500-527 Link Here
500
     */
504
     */
501
    private void exposeVariables() throws JspTagException {
505
    private void exposeVariables() throws JspTagException {
502
506
503
        /*
507
        if (deferredExpression==null) {
504
         * We need to support null items returned from next(); we
508
            /*
505
         * do this simply by passing such non-items through to the
509
             * We need to support null items returned from next(); we
506
         * scoped variable as effectively 'null' (that is, by calling
510
             * do this simply by passing such non-items through to the
507
         * removeAttribute()).
511
             * scoped variable as effectively 'null' (that is, by calling
508
         *
512
             * removeAttribute()).
509
         * Also, just to be defensive, we handle the case of a null
513
             *
510
         * 'status' object as well.
514
             * Also, just to be defensive, we handle the case of a null
511
         *
515
             * 'status' object as well.
512
         * We call getCurrent() and getLoopStatus() (instead of just using
516
             *
513
         * 'item' and 'status') to bridge to subclasses correctly.
517
             * We call getCurrent() and getLoopStatus() (instead of just using
514
         * A subclass can override getCurrent() or getLoopStatus() but still
518
             * 'item' and 'status') to bridge to subclasses correctly.
515
         * depend on our doStartTag() and doAfterBody(), which call this
519
             * A subclass can override getCurrent() or getLoopStatus() but still
516
         * method (exposeVariables()), to expose 'item' and 'status'
520
             * depend on our doStartTag() and doAfterBody(), which call this
517
         * correctly.
521
             * method (exposeVariables()), to expose 'item' and 'status'
518
         */
522
             * correctly.
519
523
             */
520
        if (itemId != null) {
524
            if (itemId != null) {
521
            if (getCurrent() == null)
525
                if (getCurrent() == null)
522
                pageContext.removeAttribute(itemId, PageContext.PAGE_SCOPE);
526
                    pageContext.removeAttribute(itemId, PageContext.PAGE_SCOPE);
523
            else
527
                else
524
                pageContext.setAttribute(itemId, getCurrent());
528
                    pageContext.setAttribute(itemId, getCurrent());
529
            }
530
        } else { //this is using a DeferredExpression
531
            ELContext myELContext = pageContext.getELContext();
532
            VariableMapper vm = myELContext.getVariableMapper();
533
            vm.setVariable(itemId, (ValueExpression)getCurrent());
525
        }
534
        }
526
        if (statusId != null) {
535
        if (statusId != null) {
527
            if (getLoopStatus() == null)
536
            if (getLoopStatus() == null)
Lines 537-545 Link Here
537
     * restores them to their prior values (and scopes).
546
     * restores them to their prior values (and scopes).
538
     */
547
     */
539
    private void unExposeVariables() {
548
    private void unExposeVariables() {
540
        // "nested" variables are now simply removed
549
        if (deferredExpression==null) {
541
	if (itemId != null)
550
            // "nested" variables are now simply removed
542
            pageContext.removeAttribute(itemId, PageContext.PAGE_SCOPE);
551
        	if (itemId != null)
552
                    pageContext.removeAttribute(itemId, PageContext.PAGE_SCOPE);
553
        } else {
554
            //we're deferred ... remove variable mapping
555
            ELContext myELContext = pageContext.getELContext();
556
            VariableMapper vm = myELContext.getVariableMapper();
557
            vm.setVariable(itemId, null);
558
        }
543
	if (statusId != null)
559
	if (statusId != null)
544
	    pageContext.removeAttribute(statusId, PageContext.PAGE_SCOPE);
560
	    pageContext.removeAttribute(statusId, PageContext.PAGE_SCOPE);
545
    }
561
    }
Lines 589-592 Link Here
589
    private boolean atEnd() {
605
    private boolean atEnd() {
590
        return ((end != -1) && (begin + index >= end));
606
        return ((end != -1) && (begin + index >= end));
591
    }
607
    }
608
    /**
609
     * Get the delimiter for string tokens. Used only for constructing
610
     * the deferred expression for it.
611
     */
612
    protected String getDelims() {
613
        return ",";
614
    }
592
}
615
}
(-)src/javax/servlet/jsp/jstl/core/IndexedValueExpression.java (+80 lines)
Line 0 Link Here
1
/**
2
 *  Licensed to the Apache Software Foundation (ASF) under one
3
 *  or more contributor license agreements.  See the NOTICE file
4
 *  distributed with this work for additional information
5
 *  regarding copyright ownership.  The ASF licenses this file
6
 *  to you under the Apache License, Version 2.0 (the
7
 *  "License"); you may not use this file except in compliance
8
 *  with the License.  You may obtain a copy of the License at
9
 *
10
 *    http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 *  Unless required by applicable law or agreed to in writing,
13
 *  software distributed under the License is distributed on an
14
 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
 *  KIND, either express or implied.  See the License for the
16
 *  specific language governing permissions and limitations
17
 *  under the License.
18
 */
19
20
package javax.servlet.jsp.jstl.core;
21
22
import java.io.Serializable;
23
24
import javax.el.ELContext;
25
import javax.el.ValueExpression;
26
27
public final class IndexedValueExpression extends ValueExpression implements Serializable {
28
29
    private static final long serialVersionUID = -7300711701036452952L;
30
    protected final Integer i;
31
    protected final ValueExpression orig;
32
    
33
    public IndexedValueExpression(ValueExpression valueExpression, int _i) {
34
        orig = valueExpression;
35
        i=_i;
36
    }
37
    
38
    public boolean equals(Object arg0) {
39
        boolean rc=false;
40
        if (arg0!=null) {
41
            if (arg0.equals(orig)) {
42
                rc = true;
43
            }
44
        }
45
        return rc;
46
    }
47
48
    public Class getExpectedType() {
49
        return orig.getExpectedType();
50
    }
51
52
    public String getExpressionString() {
53
        return orig.getExpressionString();
54
    }
55
56
    public Class getType(ELContext elContext) {
57
        return elContext.getELResolver().getType(elContext, orig.getValue(elContext), i);
58
    }
59
60
    public Object getValue(ELContext elContext) {
61
        return elContext.getELResolver().getValue(elContext, orig.getValue(elContext), i);
62
    }
63
64
    public int hashCode() {
65
        return orig.hashCode()+i;
66
    }
67
68
    public boolean isLiteralText() {
69
        return false;
70
    }
71
72
    public boolean isReadOnly(ELContext elContext) {
73
        return elContext.getELResolver().isReadOnly(elContext, orig.getValue(elContext), i);
74
    }
75
76
    public void setValue(ELContext elContext, Object arg1) {
77
        elContext.getELResolver().setValue(elContext, orig.getValue(elContext), i, arg1);
78
    }
79
80
}
(-)src/javax/servlet/jsp/jstl/core/IteratedValueExpression.java (+78 lines)
Line 0 Link Here
1
/**
2
 *  Licensed to the Apache Software Foundation (ASF) under one
3
 *  or more contributor license agreements.  See the NOTICE file
4
 *  distributed with this work for additional information
5
 *  regarding copyright ownership.  The ASF licenses this file
6
 *  to you under the Apache License, Version 2.0 (the
7
 *  "License"); you may not use this file except in compliance
8
 *  with the License.  You may obtain a copy of the License at
9
 *
10
 *    http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 *  Unless required by applicable law or agreed to in writing,
13
 *  software distributed under the License is distributed on an
14
 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
 *  KIND, either express or implied.  See the License for the
16
 *  specific language governing permissions and limitations
17
 *  under the License.
18
 */
19
20
package javax.servlet.jsp.jstl.core;
21
22
import javax.el.ELContext;
23
import javax.el.ValueExpression;
24
25
public final class IteratedValueExpression extends ValueExpression {
26
27
    private static final long serialVersionUID = 2771035360633553883L;
28
    //IteratedExpression is not serializable
29
    protected final IteratedExpression iteratedExpression;
30
    protected final int i;
31
    
32
    public IteratedValueExpression(IteratedExpression _iteratedExpression, int _i) {
33
        iteratedExpression = _iteratedExpression;
34
        i = _i;
35
    }
36
    
37
    public boolean equals(Object arg0) {
38
        if (arg0==null) {
39
            return false;
40
        }
41
        if (iteratedExpression.getValueExpression().equals(arg0)) {
42
            return true;
43
        }
44
        return false;
45
    }
46
47
    public Class getExpectedType() {
48
        return iteratedExpression.getValueExpression().getExpectedType();
49
    }
50
51
    public String getExpressionString() {
52
        return iteratedExpression.getValueExpression().getExpressionString();
53
    }
54
55
    public Class getType(ELContext elContext) {
56
        return iteratedExpression.getValueExpression().getType(elContext); 
57
    }
58
59
    public Object getValue(ELContext elContext) {
60
        return iteratedExpression.getItem(elContext, i); 
61
    }
62
63
    public int hashCode() {
64
        return iteratedExpression.hashCode()+i;
65
    }
66
67
    public boolean isLiteralText() {
68
        return false;
69
    }
70
71
    public boolean isReadOnly(ELContext elContext) {
72
        return true;
73
    }
74
75
    public void setValue(ELContext elContext, Object arg1) {
76
    }
77
78
}

Return to bug 45197