View Javadoc

    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      protected boolean _sslSecure;
    26
    27      /* ------------------------------------------------------------ */
    28      public Ajp13Request()
    29      {
    30          super();
    31          _remoteAddr = null;
    32          _remoteHost = null;
    33          _remoteUser = null;
    34          _sslSecure = false;
    35      }
    36
    37      /* ------------------------------------------------------------ */
    38      protected void setConnection(HttpConnection connection)
    39      {
    40          super.setConnection(connection);
    41      }
    42
    43      /* ------------------------------------------------------------ */
    44      public void setRemoteUser(String remoteUser)
    45      {
    46          _remoteUser = remoteUser;
    47      }
    48
    49      /* ------------------------------------------------------------ */
    50      public String getRemoteUser()
    51      {
    52          if(_remoteUser != null)
    53              return _remoteUser;
    54          return super.getRemoteUser();
    55      }
    56
    57      /* ------------------------------------------------------------ */
    58      public String getRemoteAddr()
    59      {
    60          if (_remoteAddr != null)
    61              return _remoteAddr;
    62          if (_remoteHost != null)
    63              return _remoteHost;
    64          return super.getRemoteAddr();
    65      }
    66
    67
    68
    69      /* ------------------------------------------------------------ */
    70      public void setRemoteAddr(String remoteAddr)
    71      {
    72          _remoteAddr = remoteAddr;
    73      }
    74
    75      /* ------------------------------------------------------------ */
    76      public String getRemoteHost()
    77      {
    78          if (_remoteHost != null)
    79              return _remoteHost;
    80          if (_remoteAddr != null)
    81              return _remoteAddr;
    82          return super.getRemoteHost();
    83      }
    84
    85      /* ------------------------------------------------------------ */
    86      public void setRemoteHost(String remoteHost)
    87      {
    88          _remoteHost = remoteHost;
    89      }
    90
    91      /* ------------------------------------------------------------ */
    92      public boolean isSslSecure()
    93      {
    94          return _sslSecure;
    95      }
    96
    97      /* ------------------------------------------------------------ */
    98      public void setSslSecure(boolean sslSecure)
    99      {
    100         _sslSecure = sslSecure;
    101     }
    102
    103     /* ------------------------------------------------------------ */
    104     protected void recycle()
    105     {
    106         super.recycle();
    107         _remoteAddr = null;
    108         _remoteHost = null;
    109         _remoteUser = null;
    110         _sslSecure = false;
    111     }
    112
    113 }