Jean-Francois Leveque

Enrichissement exemple et suppression configuration locale.

...@@ -18,4 +18,7 @@ And this is my string : #{testRouteView.foo} ...@@ -18,4 +18,7 @@ And this is my string : #{testRouteView.foo}
18 And this is another string : #{testRouteView.bar} 18 And this is another string : #{testRouteView.bar}
19 </p> 19 </p>
20 20
21 +<p>
22 + And a new information : ${testRouteView.tar}
23 +</p>
21 </body> 24 </body>
......
...@@ -3,15 +3,8 @@ package org.legrog.web.xyz; ...@@ -3,15 +3,8 @@ package org.legrog.web.xyz;
3 import org.ocpsoft.rewrite.annotation.Join; 3 import org.ocpsoft.rewrite.annotation.Join;
4 import org.ocpsoft.rewrite.annotation.Parameter; 4 import org.ocpsoft.rewrite.annotation.Parameter;
5 import org.ocpsoft.rewrite.annotation.RequestAction; 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; 6 import javax.enterprise.context.RequestScoped;
13 import javax.inject.Named; 7 import javax.inject.Named;
14 -import javax.servlet.ServletContext;
15 import java.io.Serializable; 8 import java.io.Serializable;
16 9
17 @Named 10 @Named
...@@ -20,6 +13,7 @@ import java.io.Serializable; ...@@ -20,6 +13,7 @@ import java.io.Serializable;
20 public class TestRouteView implements Serializable { 13 public class TestRouteView implements Serializable {
21 14
22 String foo = "my first String"; 15 String foo = "my first String";
16 + String tar = "It's a pit!";
23 17
24 @Parameter 18 @Parameter
25 String bar; 19 String bar;
...@@ -30,6 +24,13 @@ public class TestRouteView implements Serializable { ...@@ -30,6 +24,13 @@ public class TestRouteView implements Serializable {
30 foo = "my modified string without bar"; 24 foo = "my modified string without bar";
31 } else { 25 } else {
32 foo = "my string modified with "+ bar; 26 foo = "my string modified with "+ bar;
27 + try {
28 + Integer barnum = new Integer(bar);
29 + tar = "The value converts into an integer " + barnum;
30 + } catch (NumberFormatException ne) {
31 + tar = "The value "+ bar +" doesn't convert into an integer";
32 + }
33 +
33 } 34 }
34 35
35 } 36 }
...@@ -50,18 +51,11 @@ public class TestRouteView implements Serializable { ...@@ -50,18 +51,11 @@ public class TestRouteView implements Serializable {
50 this.bar = bar; 51 this.bar = bar;
51 } 52 }
52 53
53 - @RewriteConfiguration 54 + public String getTar() {
54 - public static class RewriteConfig extends HttpConfigurationProvider { 55 + return tar;
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 } 56 }
62 57
63 - public int priority() { 58 + public void setTar(String tar) {
64 - return 0; 59 + this.tar = tar;
65 - }
66 } 60 }
67 } 61 }
......