title: how to retrieve a XML from HttpRequest in Server
body: <p>I am trying to modify <a href="http://hc.apache.org/httpcomponents-core-ga/httpcore-nio/examples/org/apache/http/examples/nio/NHttpServer.java" rel="nofollow">this</a> code, which is an asynchronous server written in java using apache httpcomponents</p>
  
  <p>My client code is something like this...</p>
  
  <pre><code>HttpPost httpPost= new HttpPost("http://localhost:9090");
  HttpEntity se= new StringEntity(XMLSTRING);
  httpPost.setEntity(se);
  </code></pre>
  
  <p>My server handle is something like this </p>
  
  <pre><code>     public void handle(
              final HttpRequest request,
              final HttpAsyncExchange httpexchange,
              final HttpContext context) throws HttpException, IOException {
          HttpResponse response = httpexchange.getResponse();
          handleInternal(request, response, context);
          httpexchange.submitResponse(new BasicAsyncResponseProducer(response));
      }
  
  private void handleInternal(
              final HttpRequest request,
              final HttpResponse response,
              final HttpContext context) throws HttpException, IOException { need to get xml from response}
  </code></pre>
  
  <p>Any suggestions, pointer or hints on how to go about this is welcome. </p>
  
  <p>--edit--</p>
  
  <p>Well after much searching found one solution</p>
  
  <pre><code>HttpEntity entity1 = ((HttpEntityEnclosingRequest)request).getEntity();
          String str = EntityUtils.toString(entity1);
  </code></pre>
  
  <p>I am not sure if this is the most efficient way to go about it.</p>