@@ -53,11 +53,42 @@ public static Archive<?> createDeployment()
5353 .setWebXML ("jsf-web.xml" );
5454 }
5555
56+ /**
57+ * Test a rewrite rule using the 'substitute' attribute to
58+ * modify the URL.
59+ *
60+ * @see http://code.google.com/p/prettyfaces/issues/detail?id=76
61+ */
5662 @ Test
57- // http://code.google.com/p/prettyfaces/issues/detail?id=76
58- public void testRewriteEncoding () throws Exception
63+ public void testRewriteEncodingSubstitute () throws Exception
5964 {
60- String target = "/virtual" ;
65+ String target = "/virtual/rewrite/substitute" ;
66+ String expected = "/virtuální" ;
67+
68+ JSFSession jsfSession = new JSFSession (target );
69+ JSFServerSession server = jsfSession .getJSFServerSession ();
70+
71+ JSFClientSession client = jsfSession .getJSFClientSession ();
72+ String action = client .getElement ("form" ).getAttribute ("action" );
73+
74+ FacesContext context = server .getFacesContext ();
75+ PrettyContext prettyContext =
76+ PrettyContext .getCurrentInstance (context );
77+
78+ assertEquals (expected , prettyContext .getRequestURL ().toString ());
79+ assertEquals (prettyContext .getContextPath () + expected , action );
80+ }
81+
82+ /**
83+ * Test a rewrite rule using the 'url' attribute to
84+ * create a completely new URL.
85+ *
86+ * @see http://code.google.com/p/prettyfaces/issues/detail?id=76
87+ */
88+ @ Test
89+ public void testRewriteEncodingUrl () throws Exception
90+ {
91+ String target = "/virtual/rewrite/url" ;
6192 String expected = "/virtuální" ;
6293
6394 JSFSession jsfSession = new JSFSession (target );
0 commit comments