Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
RemoteAddrFilter |
|
| 1.0;1 |
1 | /* | |
2 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
3 | * contributor license agreements. See the NOTICE file distributed with | |
4 | * this work for additional information regarding copyright ownership. | |
5 | * The ASF licenses this file to you under the Apache License, Version 2.0 | |
6 | * (the "License"); you may not use this file except in compliance with | |
7 | * the License. You may obtain a copy of the License at | |
8 | * | |
9 | * http://www.apache.org/licenses/LICENSE-2.0 | |
10 | * | |
11 | * Unless required by applicable law or agreed to in writing, software | |
12 | * distributed under the License is distributed on an "AS IS" BASIS, | |
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | * See the License for the specific language governing permissions and | |
15 | * limitations under the License. | |
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 remote | |
24 | * address against regular expression patterns that are configured on | |
25 | * this instance. See {@link AbstractRegExpFilter} for details of the | |
26 | * matching algorithm.</p> | |
27 | * | |
28 | * <p><strong>USAGE NOTE:</strong> - This command will only be effective if | |
29 | * used before the regular filter chain is processed. In other words, you | |
30 | * should invoke it as part of a <code>preprocess</code> chain in the | |
31 | * <code>shale</code> catalog.</p> | |
32 | * | |
33 | * $Id: RemoteAddrFilter.java 464373 2006-10-16 04:21:54Z rahul $ | |
34 | * | |
35 | * @see AbstractRegExpFilter | |
36 | */ | |
37 | 0 | public class RemoteAddrFilter extends AbstractRegExpFilter { |
38 | ||
39 | ||
40 | // ------------------------------------------------------- Protected Methods | |
41 | ||
42 | ||
43 | /** | |
44 | * <p>Return the value to be tested against exclude and include patterns. | |
45 | * This will be the value of the <code>remoteAddr</code> property.</p> | |
46 | * | |
47 | * @param context <code>Context</code> for the current request | |
48 | */ | |
49 | protected String value(ShaleWebContext context) { | |
50 | ||
51 | 0 | return context.getRequest().getRemoteAddr(); |
52 | ||
53 | } | |
54 | ||
55 | ||
56 | } |