title: Why HttpServletRequest object get changed when it is forwarded from one servlet to another?
body: <p>I am writing some simple code to forward an HTTP request from one servlet to another:</p>
  
  <p>From Servlet1:</p>
  
  <pre><code>public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 
      ...
      System.out.println("In Servlet1:");
      System.out.println("request: " + request.hashCode() + ", " + request.toString());
      request.getRequestDispatcher("/servlet/Servlet2").forward(request, response);       
  }
  </code></pre>
  
  <p>From Servlet2:</p>
  
  <pre><code>public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 
      ...
      System.out.println("In Servlet2:");
      System.out.println("request: " + request.hashCode() + ", " + request.toString());               
  }
  </code></pre>
  
  <p>As far as I can understand, the "forward" method just request the web server to send the same HTTP Request to another servlet. So the 2 request objects in Servlet1 and Servlet2 should be the same. However, I got following result:</p>
  
  <pre><code>In Servelt1: 
  request: 2106487657, org.apache.catalina.connector.RequestFacade@7d8e7369
  In Servlet2:
  request: 887057147, org.apache.catalina.core.ApplicationHttpRequest@34df6afb
  </code></pre>
  
  <p>It seems the request object get changed? Why?</p>
  
  <p>I am using servlet-api from Tomcat 7.0.50</p>