@@ -54,16 +54,16 @@ public class PrettyFilter implements Filter
5454 private ServletContext servletContext ;
5555
5656 /**
57- * Determine if the current request is mapped using PrettyFaces. If it is,
58- * process the pattern, storing parameters into the request map, then forward
59- * the request to the specified viewId.
57+ * Determine if the current request is mapped using PrettyFaces. If it is, process the pattern, storing parameters
58+ * into the request map, then forward the request to the specified viewId.
6059 */
6160 public void doFilter (final ServletRequest req , final ServletResponse resp , final FilterChain chain )
6261 throws IOException , ServletException
6362 {
6463 HttpServletRequest request = (HttpServletRequest ) req ;
6564
66- HttpServletResponse response = new PrettyFacesWrappedResponse (request .getContextPath (), (HttpServletResponse ) resp , getConfig ());
65+ HttpServletResponse response = new PrettyFacesWrappedResponse (request .getContextPath (), request ,
66+ (HttpServletResponse ) resp , getConfig ());
6767 req .setAttribute (PrettyContext .CONFIG_KEY , getConfig ());
6868
6969 PrettyContext context = PrettyContext .newDetachedInstance (request );
@@ -118,10 +118,9 @@ public void doFilter(final ServletRequest req, final ServletResponse resp, final
118118 }
119119
120120 /**
121- * Apply the given list of {@link RewriteRule}s to the URL (in order,)
122- * perform a redirect/forward if required. Canonicalization is only invoked
123- * if it has not previously been invoked on this request. This method
124- * operates on the requestUri, excluding contextPath.
121+ * Apply the given list of {@link RewriteRule}s to the URL (in order,) perform a redirect/forward if required.
122+ * Canonicalization is only invoked if it has not previously been invoked on this request. This method operates on
123+ * the requestUri, excluding contextPath.
125124 *
126125 * @return True if forward/redirect occurred, false if not.
127126 */
@@ -155,12 +154,12 @@ else if (queryString == null)
155154 {
156155 if (rule .matches (newUrl ))
157156 {
158- newUrl = rewriteEngine .processInbound (rule , newUrl );
157+ newUrl = rewriteEngine .processInbound (req , resp , rule , newUrl );
159158 if (!Redirect .CHAIN .equals (rule .getRedirect ()))
160159 {
161160 /*
162- * An HTTP redirect has been triggered; issue one if we
163- * have a url or if the current url has been modified.
161+ * An HTTP redirect has been triggered; issue one if we have a url or if the current url has been
162+ * modified.
164163 */
165164 String ruleUrl = rule .getUrl ();
166165 if (((ruleUrl == null ) || "" .equals (ruleUrl .trim ())) && !originalUrl .equals (newUrl ))
@@ -177,7 +176,7 @@ else if (queryString == null)
177176 encodedPath .setEncoding (url .getEncoding ());
178177
179178 // no query parameters, just a plain URL
180- if (parts .length < 2 || parts [1 ] == null || "" .equals (parts [1 ]))
179+ if (( parts .length < 2 ) || ( parts [1 ] == null ) || "" .equals (parts [1 ]))
181180 {
182181 newUrl = encodedPath .toURL ();
183182 }
@@ -197,8 +196,8 @@ else if (queryString == null)
197196 else if ((ruleUrl != null ) && !"" .equals (ruleUrl .trim ()))
198197 {
199198 /*
200- * This is a custom location - don't call encodeRedirectURL()
201- * and don't add context path, just redirect to the encoded URL
199+ * This is a custom location - don't call encodeRedirectURL() and don't add context path, just
200+ * redirect to the encoded URL
202201 */
203202 URL encodedNewUrl = new URL (newUrl ).encode ();
204203 resp .setHeader ("Location" , encodedNewUrl .toURL ());
@@ -214,8 +213,7 @@ else if ((ruleUrl != null) && !"".equals(ruleUrl.trim()))
214213 if (!originalUrl .equals (newUrl ) && !resp .isCommitted ())
215214 {
216215 /*
217- * The URL was modified, but no redirect occurred; forward
218- * instead.
216+ * The URL was modified, but no redirect occurred; forward instead.
219217 */
220218 req .getRequestDispatcher (newUrl ).forward (req , resp );
221219 }
0 commit comments