Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-317

HTTP Internal Server Error when Content-Type header is a space for HTTP PUT method

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 1.2.1.GA
    • 1.1.GA
    • None
    • None
    • Hide

      Prevent customer from sending CONTENT_TYPE=" "

      Show
      Prevent customer from sending CONTENT_TYPE=" "

    Description

      HTTP Internal Server Error when Content-Type header is a space for HTTP PUT method.

      To reproduce.
      1. Implement a PUT REST resource i.e. from you example: https://resteasy.svn.sourceforge.net/svnroot/resteasy/tags/RESTEASY_JAXRS_1_1_GA/examples/simple/src/main/java/com/restfully/shop/services/CustomerResource.java,

      • updateCustomer
        2. Start up a server with this resource

      3. Send a HTTP POST request with all data to create a customer
      4. Send a HTTP PUT request with all data to update except for the header "Content-Type". Set this header to be a single space (" ")

      Result:
      HTTP 500 Internal Server error

      java.lang.IllegalArgumentException: Failure parsing MediaType string:
      at org.jboss.resteasy.plugins.delegates.MediaTypeHeaderDelegate.parse(MediaTypeHeaderDelegate.java:116)
      at org.jboss.resteasy.plugins.delegates.MediaTypeHeaderDelegate.fromString(MediaTypeHeaderDelegate.java:16)
      at javax.ws.rs.core.MediaType.valueOf(MediaType.java:191)
      at org.jboss.resteasy.plugins.server.servlet.ServletUtil.extractHttpHeaders(ServletUtil.java:89)
      at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:84)
      at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:70)

      Remarks:
      It should be 400 Bad request response. I am not sure if the same bug occurs for a POST method.

      Attachments

        Activity

          People

            patriot1burke@gmail.com Bill Burke (Inactive)
            agnieszka.michalik Agnieszka Michalik (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: