title: java.lang.IllegalStateException: getInputStream() has already been called for this request
body: <p>I have a Jersey Web-Service that I need to parse some json data that was send along with a request.</p>
  
  <pre><code>@POST
  @Path ("/authenticate")
  @Produces (MediaType.APPLICATION_JSON)
  public Response authenticate (@Context HttpServletRequest request)
  {
  
      try {
          StringBuffer json = new StringBuffer ();
          BufferedReader reader = request.getReader();
          int line;
          while ((line = reader.readLine()) != null)
          {
              json.append(line);
          }
              System.out.prinln (json);
      } catch (IOException e1) {
          // TODO Auto-generated catch block
          e1.printStackTrace();
      }
  
      return Response.ok().entity(json).build();
  }//end authenticate method
  </code></pre>
  
  <p>This service generates the following Exception:</p>
  
  <p><code>java.lang.IllegalStateException: getInputStream() has already been called for this request</code></p>
  
  <p>I did some research that suggests a <code>getReader</code> and <code>getInputStream</code> cannot be called on the same request. Therefore, it seemed like a <code>getInputStream</code> instance is already called. How is this possible if I haven't made a explicit call to it? To solve this problem, I used the <code>getInputStream</code> method instead</p>
  
  <pre><code>    try {
          ServletInputStream reader = request.getInputStream();
          int line;
          while ((line = reader.read()) != -1)
          {
  
          }
  
      } catch (IOException e1) {
          // TODO Auto-generated catch block
          e1.printStackTrace();
      }
  
      return Response.ok().entity().build();
  </code></pre>
  
  <p>With this approach, how can I use the int of bytes to get the json?</p>