Showing
4 changed files
with
144 additions
and
92 deletions
... | @@ -81,18 +81,40 @@ | ... | @@ -81,18 +81,40 @@ |
81 | </dependency> | 81 | </dependency> |
82 | 82 | ||
83 | 83 | ||
84 | + <!-- Rewriting tool --> | ||
84 | 85 | ||
86 | + <dependency> | ||
87 | + <groupId>org.ocpsoft.rewrite</groupId> | ||
88 | + <artifactId>rewrite-servlet</artifactId> | ||
89 | + <version>${rewrite.version}</version> | ||
90 | + </dependency> | ||
85 | 91 | ||
86 | - <!-- Rewriting tool --> | 92 | + <dependency> |
93 | + <groupId>org.ocpsoft.rewrite</groupId> | ||
94 | + <artifactId>rewrite-integration-faces</artifactId> | ||
95 | + <version>${rewrite.version}</version> | ||
96 | + </dependency> | ||
97 | + | ||
98 | + <dependency> | ||
99 | + <groupId>org.ocpsoft.rewrite</groupId> | ||
100 | + <artifactId>rewrite-integration-cdi</artifactId> | ||
101 | + <version>${rewrite.version}</version> | ||
102 | + </dependency> | ||
87 | 103 | ||
88 | <!--<dependency>--> | 104 | <!--<dependency>--> |
89 | - <!--<groupId>com.ocpsoft</groupId>--> | 105 | + <!--<groupId>com.ocpsoft</groupId>--> |
90 | - <!--<artifactId>prettyfaces-jsf2</artifactId>--> | 106 | + <!--<artifactId>prettyfaces-jsf2</artifactId>--> |
91 | - <!--<version>3.3.3</version>--> | 107 | + <!--<version>3.3.3</version>--> |
92 | <!--</dependency>--> | 108 | <!--</dependency>--> |
93 | - <!-- --> | 109 | + <!--<dependency>--> |
110 | + <!--<groupId>org.ocpsoft.rewrite</groupId>--> | ||
111 | + <!--<artifactId>rewrite-config-prettyfaces</artifactId>--> | ||
112 | + <!--<version>${rewrite.version}</version>--> | ||
113 | + <!--</dependency> --> | ||
94 | 114 | ||
95 | -<!-- **** TOOLS : LOGS + UTILS **** --> | 115 | + |
116 | + | ||
117 | + <!-- **** TOOLS : LOGS + UTILS **** --> | ||
96 | 118 | ||
97 | <dependency> | 119 | <dependency> |
98 | <groupId>org.slf4j</groupId> | 120 | <groupId>org.slf4j</groupId> |
... | @@ -117,9 +139,54 @@ | ... | @@ -117,9 +139,54 @@ |
117 | <artifactId>spring-data-jpa</artifactId> | 139 | <artifactId>spring-data-jpa</artifactId> |
118 | </dependency> | 140 | </dependency> |
119 | 141 | ||
142 | + <!-- ** Hibernate deps ** --> | ||
143 | + <dependency> | ||
144 | + <groupId>antlr</groupId> | ||
145 | + <artifactId>antlr</artifactId> | ||
146 | + </dependency> | ||
147 | + <dependency> | ||
148 | + <groupId>dom4j</groupId> | ||
149 | + <artifactId>dom4j</artifactId> | ||
150 | + </dependency> | ||
151 | + <dependency> | ||
152 | + <groupId>org.hibernate.common</groupId> | ||
153 | + <artifactId>hibernate-commons-annotations</artifactId> | ||
154 | + <version>${hibernate-commons-annotations.version}</version> | ||
155 | + </dependency> | ||
156 | + <dependency> | ||
157 | + <groupId>org.hibernate.javax.persistence</groupId> | ||
158 | + <artifactId>hibernate-jpa-2.1-api</artifactId> | ||
159 | + <version>${hibernate-jpa-2.1-api.version}</version> | ||
160 | + </dependency> | ||
161 | + <dependency> | ||
162 | + <groupId>org.hibernate</groupId> | ||
163 | + <artifactId>hibernate-core</artifactId> | ||
164 | + </dependency> | ||
165 | + <dependency> | ||
166 | + <groupId>org.hibernate</groupId> | ||
167 | + <artifactId>hibernate-ehcache</artifactId> | ||
168 | + </dependency> | ||
169 | + <dependency> | ||
170 | + <groupId>org.hibernate</groupId> | ||
171 | + <artifactId>hibernate-entitymanager</artifactId> | ||
172 | + </dependency> | ||
173 | + <dependency> | ||
174 | + <groupId>org.hibernate</groupId> | ||
175 | + <artifactId>hibernate-validator</artifactId> | ||
176 | + </dependency> | ||
177 | + <dependency> | ||
178 | + <groupId>org.jboss.logging</groupId> | ||
179 | + <artifactId>jboss-logging</artifactId> | ||
180 | + </dependency> | ||
181 | + <dependency> | ||
182 | + <groupId>org.javassist</groupId> | ||
183 | + <artifactId>javassist</artifactId> | ||
184 | + </dependency> | ||
185 | + <!-- ** Hibernate deps ** --> | ||
186 | + | ||
120 | 187 | ||
121 | - <!-- **** TEST SCOPE **** --> | ||
122 | 188 | ||
189 | + <!-- **** TEST SCOPE **** --> | ||
123 | 190 | ||
124 | <dependency> | 191 | <dependency> |
125 | <groupId>junit</groupId> | 192 | <groupId>junit</groupId> |
... | @@ -188,49 +255,7 @@ | ... | @@ -188,49 +255,7 @@ |
188 | <scope>test</scope> | 255 | <scope>test</scope> |
189 | </dependency> | 256 | </dependency> |
190 | --> | 257 | --> |
191 | - <!-- Hibernate --> | 258 | + |
192 | - <dependency> | ||
193 | - <groupId>antlr</groupId> | ||
194 | - <artifactId>antlr</artifactId> | ||
195 | - </dependency> | ||
196 | - <dependency> | ||
197 | - <groupId>dom4j</groupId> | ||
198 | - <artifactId>dom4j</artifactId> | ||
199 | - </dependency> | ||
200 | - <dependency> | ||
201 | - <groupId>org.hibernate.common</groupId> | ||
202 | - <artifactId>hibernate-commons-annotations</artifactId> | ||
203 | - <version>${hibernate-commons-annotations.version}</version> | ||
204 | - </dependency> | ||
205 | - <dependency> | ||
206 | - <groupId>org.hibernate.javax.persistence</groupId> | ||
207 | - <artifactId>hibernate-jpa-2.1-api</artifactId> | ||
208 | - <version>${hibernate-jpa-2.1-api.version}</version> | ||
209 | - </dependency> | ||
210 | - <dependency> | ||
211 | - <groupId>org.hibernate</groupId> | ||
212 | - <artifactId>hibernate-core</artifactId> | ||
213 | - </dependency> | ||
214 | - <dependency> | ||
215 | - <groupId>org.hibernate</groupId> | ||
216 | - <artifactId>hibernate-ehcache</artifactId> | ||
217 | - </dependency> | ||
218 | - <dependency> | ||
219 | - <groupId>org.hibernate</groupId> | ||
220 | - <artifactId>hibernate-entitymanager</artifactId> | ||
221 | - </dependency> | ||
222 | - <dependency> | ||
223 | - <groupId>org.hibernate</groupId> | ||
224 | - <artifactId>hibernate-validator</artifactId> | ||
225 | - </dependency> | ||
226 | - <dependency> | ||
227 | - <groupId>org.jboss.logging</groupId> | ||
228 | - <artifactId>jboss-logging</artifactId> | ||
229 | - </dependency> | ||
230 | - <dependency> | ||
231 | - <groupId>org.javassist</groupId> | ||
232 | - <artifactId>javassist</artifactId> | ||
233 | - </dependency> | ||
234 | </dependencies> | 259 | </dependencies> |
235 | 260 | ||
236 | <build> | 261 | <build> | ... | ... |
1 | -package org.legrog.web.xyz; | ||
2 | - | ||
3 | -import javax.inject.Named; | ||
4 | -import java.io.Serializable; | ||
5 | - | ||
6 | -@Named | ||
7 | -@javax.enterprise.context.RequestScoped | ||
8 | -//@URLMapping(id = "testroot", pattern = "/testRoot/#{bar : testRootView.bar}", viewId = "xyz/TestRoot.jsf") | ||
9 | -public class TestRootView implements Serializable { | ||
10 | - | ||
11 | - String foo = "my first String"; | ||
12 | - | ||
13 | - String bar =""; | ||
14 | - | ||
15 | -// | ||
16 | -// public void init() { | ||
17 | -// if (number == null) { | ||
18 | -// foo = "my second String"; | ||
19 | -// } else { | ||
20 | -// foo = "my string #"+number; | ||
21 | -// } | ||
22 | -// | ||
23 | -// } | ||
24 | - | ||
25 | - public String getFoo() { | ||
26 | - return foo; | ||
27 | - } | ||
28 | - | ||
29 | - public void setFoo(String foo) { | ||
30 | - this.foo = foo; | ||
31 | - } | ||
32 | - | ||
33 | - public String getBar() { | ||
34 | - return bar; | ||
35 | - } | ||
36 | - | ||
37 | - public void setBar(String bar) { | ||
38 | - this.bar = bar; | ||
39 | - } | ||
40 | -} |
... | @@ -10,12 +10,12 @@ | ... | @@ -10,12 +10,12 @@ |
10 | </p> | 10 | </p> |
11 | 11 | ||
12 | <p> | 12 | <p> |
13 | -And this is my string : #{testRootView.foo} | 13 | +And this is my string : #{testRouteView.foo} |
14 | </p> | 14 | </p> |
15 | 15 | ||
16 | 16 | ||
17 | <p> | 17 | <p> |
18 | - And this is another string : #{testRootView.bar} | 18 | + And this is another string : #{testRouteView.bar} |
19 | </p> | 19 | </p> |
20 | 20 | ||
21 | </body> | 21 | </body> | ... | ... |
1 | +package org.legrog.web.xyz; | ||
2 | + | ||
3 | +import org.ocpsoft.rewrite.annotation.Join; | ||
4 | +import org.ocpsoft.rewrite.annotation.Parameter; | ||
5 | +import org.ocpsoft.rewrite.annotation.RequestAction; | ||
6 | +import org.ocpsoft.rewrite.annotation.RewriteConfiguration; | ||
7 | +import org.ocpsoft.rewrite.config.Configuration; | ||
8 | +import org.ocpsoft.rewrite.config.ConfigurationBuilder; | ||
9 | +import org.ocpsoft.rewrite.el.El; | ||
10 | +import org.ocpsoft.rewrite.servlet.config.HttpConfigurationProvider; | ||
11 | + | ||
12 | +import javax.enterprise.context.RequestScoped; | ||
13 | +import javax.inject.Named; | ||
14 | +import javax.servlet.ServletContext; | ||
15 | +import java.io.Serializable; | ||
16 | + | ||
17 | +@Named | ||
18 | +@RequestScoped | ||
19 | +@Join(path = "/TestRoute/{bar}", to = "/xyz/TestRoute.jsf") | ||
20 | +public class TestRouteView implements Serializable { | ||
21 | + | ||
22 | + String foo = "my first String"; | ||
23 | + | ||
24 | + @Parameter | ||
25 | + String bar; | ||
26 | + | ||
27 | + @RequestAction | ||
28 | + public void init() { | ||
29 | + if (bar == null) { | ||
30 | + foo = "my modified string without bar"; | ||
31 | + } else { | ||
32 | + foo = "my string modified with "+ bar; | ||
33 | + } | ||
34 | + | ||
35 | + } | ||
36 | + | ||
37 | + public String getFoo() { | ||
38 | + return foo; | ||
39 | + } | ||
40 | + | ||
41 | + public void setFoo(String foo) { | ||
42 | + this.foo = foo; | ||
43 | + } | ||
44 | + | ||
45 | + public String getBar() { | ||
46 | + return bar; | ||
47 | + } | ||
48 | + | ||
49 | + public void setBar(String bar) { | ||
50 | + this.bar = bar; | ||
51 | + } | ||
52 | + | ||
53 | + @RewriteConfiguration | ||
54 | + public static class RewriteConfig extends HttpConfigurationProvider { | ||
55 | + | ||
56 | + public Configuration getConfiguration(ServletContext context) { | ||
57 | + return ConfigurationBuilder.begin() | ||
58 | + .addRule(org.ocpsoft.rewrite.servlet.config.rule.Join.path("/TestRoute2/{bar}").to("/xyz/TestRoute.jsf")) | ||
59 | + .where("bar").bindsTo(El.property("testRouteView.bar")) | ||
60 | + ; | ||
61 | + } | ||
62 | + | ||
63 | + public int priority() { | ||
64 | + return 0; | ||
65 | + } | ||
66 | + } | ||
67 | +} |
-
Please register or login to post a comment