WebLogic 10gR3 - 解析多部分/表单数据的 Content-Type 标头时出现 UnsupportedEncodingException
我的应用程序在 WebLogic 10gR3 上通过 HTTP POST 接收多部分内容。每当客户端在 Content-Type 标头上的其他属性之前指定 charset
属性时(例如 Content-Type: multipart/form-data; charset=utf-8; boundary=a_random_boundary
),WebLogic 抛出以下异常(在我的托管服务器的日志中捕获):
不支持的编码:指定“utf-8;boundary=a_random_boundary”。
java.io.UnsupportedEncodingException:不支持的编码 utf-8;边界=a_random_boundary
在 weblogic.servlet.internal.ServletRequestImpl.setCharacterEncoding(ServletRequestImpl.java:428)
在 weblogic.servlet.internal.ServletRequestImpl.initRequestEncoding(ServletRequestImpl.java:1115)
在 weblogic.servlet.internal.ServletRequestImpl.getCharacterEncoding(ServletRequestImpl.java:451)
在 javax.servlet.ServletRequestWrapper.getCharacterEncoding(ServletRequestWrapper.java:115)
在 com.MyClass.myMethod(MyClass.java:100)
仅供参考,我正在第 100 行对 HttpServletRequest
实例进行 getCharacterEncoding()
调用。
但是,如果客户端在标头末尾指定字符集(例如 Content-Type:multipart/form-data;boundary=a_random_boundary;charset=utf-8),应用程序和 WebLogic 执行优雅地。
根据 RFC2045,参数的顺序并不重要:
Content-Type 标头字段指定了数据的性质 通过给出媒体类型和子类型标识符来识别实体的主体,以及 通过提供某些可能需要的辅助信息 媒体类型。在媒体类型和子类型名称之后,其余部分 标头字段只是一组参数,在 属性=值符号。 参数的顺序不是 意义重大。
我四处搜索,越接近类似的问题,就越接近以下 thread< /a> 在 OTN。
我假设这是 WebLogic 中的一个错误,但我想在联系支持和/或制定解决方法之前我应该寻求一些见解。
感谢您对这个问题的任何见解。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论