title: How to get Object from HttpResponse?
body: <p>I'm trying to send an object from server to client.  </p>
  
  <p>client side:  </p>
  
  <pre><code>HttpResponse response = client.execute(request);
  </code></pre>
  
  <p>server side:</p>
  
  <pre><code>protected void doPost(HttpServletRequest request, HttpServletResponse response) throws  IOException 
  {
      PrintWriter out = response.getWriter();
      out.print(new Object());
  }
  </code></pre>
  
  <p>How do I get the object from the response?<br>
  Do i need to use instead:</p>
  
  <pre><code>OutputStream out = response.getOutputStream();
  </code></pre>
  
  <p>if so which way is more efficient?<br>
  example code please :)<br>
  thanks. </p>