Uploaded image for project: 'Spring Web Services'
  1. Spring Web Services
  2. SWS-917

Spring MVC does not cope with unknown Accept-Charset strings

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Core
    • Labels:

      Description

      When HttpRequestHandlingEndpointSupport receives an HTTP request, it reads the Accept-Charset HTTP header and extracts all the charset strings the client submitted. These strings are then converted into associated java.nio.charset.Charset instances. This happens in the getAcceptCharset() in the class org.springframework.http.HttpHeaders.

      However, if the clients submits an accepted charset which does not have an associated Charset instance on the server, say "foobar", the getAcceptCharset() method fails miserably and throws a java.nio.charset.UnsupportedCharsetException.

      What the method should do instead is to handle this case gracefully. You cannot control the Accept-Charset header the client sends anyway and have do deal with broken stuff, too. A possible solution would be to simply ignore those particular accepted charsets. The server won't be able to create a response using one of them anyway.

        Attachments

          Activity

            People

            Assignee:
            rstoya05-aop Rossen Stoyanchev
            Reporter:
            rainer_klute Rainer Klute
            Votes:
            3 Vote for this issue
            Watchers:
            6 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: