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
19 package org.apache.catalina.valves;
20
21
22 import java.io.IOException;
23 import javax.servlet.ServletException;
24 import org.apache.catalina.connector.Request;
25 import org.apache.catalina.connector.Response;
26
27
28 /**
29 * Concrete implementation of <code>RequestFilterValve</code> that filters
30 * based on the string representation of the remote client's IP address.
31 *
32 * @author Craig R. McClanahan
33 * @version $Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $
34 */
35
36 public final class RemoteAddrValve
37 extends RequestFilterValve {
38
39
40 // ----------------------------------------------------- Instance Variables
41
42
43 /**
44 * The descriptive information related to this implementation.
45 */
46 private static final String info =
47 "org.apache.catalina.valves.RemoteAddrValve/1.0";
48
49
50 // ------------------------------------------------------------- Properties
51
52
53 /**
54 * Return descriptive information about this Valve implementation.
55 */
56 public String getInfo() {
57
58 return (info);
59
60 }
61
62
63 // --------------------------------------------------------- Public Methods
64
65
66 /**
67 * Extract the desired request property, and pass it (along with the
68 * specified request and response objects) to the protected
69 * <code>process()</code> method to perform the actual filtering.
70 * This method must be implemented by a concrete subclass.
71 *
72 * @param request The servlet request to be processed
73 * @param response The servlet response to be created
74 *
75 * @exception IOException if an input/output error occurs
76 * @exception ServletException if a servlet error occurs
77 */
78 public void invoke(Request request, Response response)
79 throws IOException, ServletException {
80
81 process(request.getRequest().getRemoteAddr(), request, response);
82
83 }
84
85
86 }