1 //========================================================================
2 //Copyright 2004-2008 Mort Bay Consulting Pty. Ltd.
3 //------------------------------------------------------------------------
4 //Licensed under the Apache License, Version 2.0 (the "License");
5 //you may not use this file except in compliance with the License.
6 //You may obtain a copy of the License at
7 //http://www.apache.org/licenses/LICENSE-2.0
8 //Unless required by applicable law or agreed to in writing, software
9 //distributed under the License is distributed on an "AS IS" BASIS,
10 //WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 //See the License for the specific language governing permissions and
12 //limitations under the License.
13 //========================================================================
14
15 package org.mortbay.jetty.ajp;
16
17 import org.mortbay.jetty.HttpConnection;
18 import org.mortbay.jetty.Request;
19
20 public class Ajp13Request extends Request
21 {
22 protected String _remoteAddr;
23 protected String _remoteHost;
24 protected String _remoteUser;
25
26 /* ------------------------------------------------------------ */
27 public Ajp13Request()
28 {
29 super();
30 _remoteAddr = null;
31 _remoteHost = null;
32 _remoteUser = null;
33 }
34
35 /* ------------------------------------------------------------ */
36 protected void setConnection(HttpConnection connection)
37 {
38 super.setConnection(connection);
39 }
40
41 /* ------------------------------------------------------------ */
42 public void setRemoteUser(String remoteUser)
43 {
44 _remoteUser = remoteUser;
45 }
46
47 /* ------------------------------------------------------------ */
48 public String getRemoteUser()
49 {
50 if(_remoteUser != null)
51 return _remoteUser;
52 return super.getRemoteUser();
53 }
54
55 /* ------------------------------------------------------------ */
56 public String getRemoteAddr()
57 {
58 if (_remoteAddr != null)
59 return _remoteAddr;
60 if (_remoteHost != null)
61 return _remoteHost;
62 return super.getRemoteAddr();
63 }
64
65
66
67 /* ------------------------------------------------------------ */
68 public void setRemoteAddr(String remoteAddr)
69 {
70 _remoteAddr = remoteAddr;
71 }
72
73 /* ------------------------------------------------------------ */
74 public String getRemoteHost()
75 {
76 if (_remoteHost != null)
77 return _remoteHost;
78 if (_remoteAddr != null)
79 return _remoteAddr;
80 return super.getRemoteHost();
81 }
82
83 /* ------------------------------------------------------------ */
84 public void setRemoteHost(String remoteHost)
85 {
86 _remoteHost = remoteHost;
87 }
88
89 /* ------------------------------------------------------------ */
90 protected void recycle()
91 {
92 super.recycle();
93 _remoteAddr = null;
94 _remoteHost = null;
95 }
96
97 }