Uploaded image for project: 'HttpComponents HttpCore'
  1. HttpComponents HttpCore
  2. HTTPCORE-137

Problem handling HTTP PUT requests

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 4.0-alpha6
    • 4.0-beta1
    • HttpCore
    • None
    • Java JDK 1.6.0_03 on Windows XP Service Pack 2

    Description

      I have a Java Swing application with an HttpServer() instance running in a SwingWorker thread. I'm able to get at the HTTP GET requests by casting the request as follows:

      if (request instanceof HttpEntityEnclosingRequest) {
      HttpEntity entity = ((HttpEntityEnclosingRequest) request).getEntity();
      byte[] entityContent = EntityUtils.toByteArray(entity);
      logger.info("Incoming entity content (bytes): " + entityContent.length);
      }

      However this does not work for PUT requests. In fact printing out the request line of a PUT request appears as: "HEAD /test.txt HTTP/1.1", and I don't see PUT in the request line at all. Attempting to cast this as an HttpEntityEnclosingRequest fails, and thus I'm not able to get at the HttpEntity. Is this functionality supported?

      Attachments

        1. DefaultHttpRequestFactory.java
          3 kB
          Ronald E Johnson
        2. TestHTTPServer.java
          13 kB
          Ronald E Johnson

        Activity

          People

            rolandw Roland Weber
            rejohnson Ronald E Johnson
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: