【发布时间】:2018-07-13 14:45:59
【问题描述】:
我们最近在 Linux 环境中从 GlassFish 3 迁移并部署了我们的 application.EAR(API)包到 wildfly 13.0.0.Final。在测试应用程序 api 时,它不支持扫描字符并给出以下错误(从 Wildfly 的 server.log 复制的错误)。但同样的测试请求与部署在 GlassFish 服务器中的应用程序 api 一起正常工作。我尝试研究了很多与wildfly相关的博客,但没有得到任何解决方案。请有人帮忙。
我厌倦了在standalone.xml文件中设置更改以将字符集设置为UTF-8,但它没有帮助。
<http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true" url-charset="UTF-8"/>
<servlet-container name="default" default-encoding="UTF-8">
2018-07-13 17:06:45,189 调试 [io.undertow.request.io](默认 I/O-4)UT005014:无法解析请求:io.undertow.util.BadRequestException:UT000165 : 请求目标中的字符 ä 无效 在 io.undertow.server.protocol.http.HttpRequestParser.handleQueryParameters(HttpRequestParser.java:523) 在 io.undertow.server.protocol.http.HttpRequestParser.beginQueryParameters(HttpRequestParser.java:486) 在 io.undertow.server.protocol.http.HttpRequestParser.handlePath(HttpRequestParser.java:410) 在 io.undertow.server.protocol.http.HttpRequestParser.handle(HttpRequestParser.java:248) 在 io.undertow.server.protocol.http.HttpReadListener.handleEventWithNoRunningRequest(HttpReadListener.java:187) 在 io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:136) 在 io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:147) 在 io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:93) 在 io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:52) 在 org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) 在 org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:291) 在 org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:286) 在 org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) 在 org.xnio.nio.QueuedNioTcpServer$1.run(QueuedNioTcpServer.java:131) 在 org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:612) 在 org.xnio.nio.WorkerThread.run(WorkerThread.java:479)
下面是我们发送给在 Wildfly 和 GlassFish 中部署的应用程序的请求 XML
<SOAP-ENV:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
<StartHeader SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next" SOAP-ENV:mustUnderstand="0" xmlns="http://www.openuri.org/2002/04/soap/conversation/">
<callbackLocation>http://TESTUI</callbackLocation>
</StartHeader>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<ListAttributeValues xmlns="http://www.openuri.org/" xmlns:v001="http://xml.comptel.com/NIMS/address/listAttribteValuesRequest/v002" xmlns:v0011="http://xml.comptel.com/NIMS/address/v002">
<listAttributeValuesRequest xsi:schemaLocation="http://xml.comptel.com/NIMS/address/listAttributeValuesRequest/v002 http://xml.comptel.com/NIMS/address/listAttributeValuesRequest/v002" xmlns="http://xml.comptel.com/NIMS/address/listAttributeValuesRequest/v002" xmlns:spec="http://xml.comptel.com/NIMS/address/v002" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<spec:searchItemList>
<spec:attribute>
<spec:name>district</spec:name>
<spec:value>Jär</spec:value>
</spec:attribute>
</spec:searchItemList>
<spec:attributeName>district</spec:attributeName>
<spec:maxItems>100</spec:maxItems>
</listAttributeValuesRequest>
</ListAttributeValues>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
【问题讨论】:
-
我怀疑您需要告诉 wildfly 在 Unicode 上下文中工作。
-
您是否将该字符 - ä - 作为 URL 中的查询参数传递?
-
@stdunbar:在 wildfly 和 galssfish 中部署的应用程序是 Web 应用程序,因此我们将以下 XML 作为查询字符串发送。 spec:searchItemList>
区 Jär -
@Dragonthoughts:你的意思是我需要对 wildfly 配置进行更改,或者我需要在输入请求 xml 中发送一些参数来告诉 wildfly 在 Unicode 上下文中工作?
标签: unicode character-encoding internationalization wildfly