2009/05/20 - Apache Shale has been retired.
For more information, please explore the Attic.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.shale.application;
19
20 import org.apache.shale.application.faces.ShaleWebContext;
21
22 /***
23 * <p>Command that filters incoming requests based on matching the
24 * context-relative portion of the request URI (in other words, servlet
25 * path plus path info) against regular expression patterns that are
26 * configured on this instance. See {@link AbstractRegExpFilter} for
27 * details of the matching algorithm.</p>
28 *
29 * <p><strong>USAGE NOTE:</strong> - This command will only be effective if
30 * used before the regular filter chain is processed. In other words, you
31 * should invoke it as part of a <code>preprocess</code> chain in the
32 * <code>shale</code> catalog.</p>
33 *
34 * $Id: ContextRelativePathFilter.java 464373 2006-10-16 04:21:54Z rahul $
35 *
36 * @see AbstractRegExpFilter
37 */
38 public class ContextRelativePathFilter extends AbstractRegExpFilter {
39
40
41
42
43
44 /***
45 * <p>Return the servlet path (if any) concatenated with the path info
46 * (if any) for this request.</p>
47 *
48 * @param context <code>Context</code> for the current request
49 */
50 protected String value(ShaleWebContext context) {
51
52 String servletPath = context.getRequest().getServletPath();
53 if (servletPath == null) {
54 servletPath = "";
55 }
56 String pathInfo = context.getRequest().getPathInfo();
57 if (pathInfo == null) {
58 pathInfo = "";
59 }
60 return servletPath + pathInfo;
61
62 }
63
64
65 }