1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
package org.apache.myfaces.el; |
20 | |
|
21 | |
import java.util.Iterator; |
22 | |
|
23 | |
import javax.faces.FactoryFinder; |
24 | |
import javax.faces.event.PhaseEvent; |
25 | |
import javax.faces.event.PhaseId; |
26 | |
import javax.faces.event.PhaseListener; |
27 | |
import javax.faces.lifecycle.LifecycleFactory; |
28 | |
|
29 | |
import org.apache.myfaces.el.unified.ELResolverBuilder; |
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
public final class ResolverForJSPInitializer implements PhaseListener |
38 | |
{ |
39 | |
private final ELResolverBuilder _resolverBuilder; |
40 | |
private boolean initialized; |
41 | |
private final javax.el.CompositeELResolver _resolverForJSP; |
42 | |
|
43 | |
public ResolverForJSPInitializer(final ELResolverBuilder resolverBuilder, final javax.el.CompositeELResolver resolverForJSP) |
44 | 0 | { |
45 | 0 | _resolverBuilder = resolverBuilder; |
46 | 0 | _resolverForJSP = resolverForJSP; |
47 | 0 | } |
48 | |
|
49 | |
public void beforePhase(final PhaseEvent event) |
50 | |
{ |
51 | 0 | if (!initialized) |
52 | |
{ |
53 | 0 | initialized = true; |
54 | 0 | _resolverBuilder.build(_resolverForJSP); |
55 | |
|
56 | 0 | LifecycleFactory factory = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY); |
57 | 0 | for (Iterator<String> iter = factory.getLifecycleIds(); iter.hasNext();) |
58 | |
{ |
59 | 0 | factory.getLifecycle(iter.next()).removePhaseListener(this); |
60 | |
} |
61 | |
} |
62 | 0 | } |
63 | |
|
64 | |
public void afterPhase(final PhaseEvent event) |
65 | |
{ |
66 | 0 | } |
67 | |
|
68 | |
public PhaseId getPhaseId() |
69 | |
{ |
70 | 0 | return PhaseId.ANY_PHASE; |
71 | |
} |
72 | |
|
73 | |
} |