5

My application is receiving multi-part content through an HTTP POST, on WebLogic 10gR3. Whenever clients specify the charset attribute before other attributes on the Content-Type header (e.g. Content-Type: multipart/form-data; charset=utf-8; boundary=a_random_boundary), WebLogic is throwing the following exception (caught in my managed server's log):

Unsupported encoding: "utf-8; boundary=a_random_boundary" specified.
java.io.UnsupportedEncodingException: Unsupported Encoding utf-8; boundary=a_random_boundary
at weblogic.servlet.internal.ServletRequestImpl.setCharacterEncoding(ServletRequestImpl.java:428)
at weblogic.servlet.internal.ServletRequestImpl.initRequestEncoding(ServletRequestImpl.java:1115)
at weblogic.servlet.internal.ServletRequestImpl.getCharacterEncoding(ServletRequestImpl.java:451)
at javax.servlet.ServletRequestWrapper.getCharacterEncoding(ServletRequestWrapper.java:115)
at com.MyClass.myMethod(MyClass.java:100)

Just for information, I am doing a getCharacterEncoding() call to an HttpServletRequest instance at line 100.

However, if clients specify the charset at the end of the header (e.g. Content-Type: multipart/form-data; boundary=a_random_boundary; charset=utf-8), the application and WebLogic perform gracefully.

According to RFC2045, the order of the parameters is not significant:

The Content-Type header field specifies the nature of the data in the body of an entity by giving media type and subtype identifiers, and by providing auxiliary information that may be required for certain media types. After the media type and subtype names, the remainder of the header field is simply a set of parameters, specified in an attribute=value notation. The ordering of parameters is not significant.

I have searched around, and the closer I got to a similar problem was the following thread at OTN.

I am assuming this is a bug in WebLogic, but I thought I would look for some insight before contacting support and/or making a workaround.

Thanks for any insight into this issue.

5
  • Has this issue been resolved? I'm not sure that there's any useful answer that could be given at this point.
    – Cel Skeggs
    Mar 29, 2015 at 1:38
  • @col6y I didn't find any answers for this issue. I think there is value in leaving the question open, so others with the same problem can at least benefit of the initial investigation. Why the downvote, anyway?
    – Viccari
    Mar 30, 2015 at 15:09
  • Oops. I interpreted the last part of this post as "I'm going to contact support, so this will quickly become irrelevant once this gets fixed, but before I do is there anything that I'm missing?" (I'd remove the downvote, but it won't let me unless the post gets edited. If you wanted to make a meaningful edit, the line with Content-Type could be in backquotes to be formatted properly.)
    – Cel Skeggs
    Mar 30, 2015 at 18:12
  • I have done it, but if you feel it is a poor question, nevermind about the downvote. Thanks!
    – Viccari
    Mar 30, 2015 at 19:35
  • My previous interpretation was incorrect and don't think this deserves a downvote anymore. I've removed the downvote. Sorry about that.
    – Cel Skeggs
    Mar 30, 2015 at 21:10

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.