Announcement Announcement Module
Collapse
No announcement yet.
Content-Type parsing error when RestTemplate response is "text/html;charset=utf-8" Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Content-Type parsing error when RestTemplate response is "text/html;charset=utf-8"

    I have an implementation of ResponseErrorHandler that attempts to parse errors that come back from an internal service we are calling using RestTemplate. In the handleError method I attempt to examine the content-type of the response. When the content-type of the response is "text/html;charset=utf-8" the call on the ClientHttpResponse class getHeaders().getContentType() throws an IllegalArgumentException "java.lang.IllegalArgumentException: ";charset=utf-8" does not contain '/'"

    And when I inspect the headers array while in debug mode I can see that the Content-Type value is a org.apache.commons.httpclient.Header and the value is ";charset=utf-8" so clearly there is a parsing issue somewhere deep within the RestTemplate error handling code.

    Any ideas?

  • #2
    BUMP. Anyone help with this?

    Comment

    Working...
    X