【问题标题】:Wildfly 13.0.0.Final error UT005014: Failed to parse request: io.undertow.util.BadRequestException: UT000165: Invalid character ä in request-targetWildfly 13.0.0.Final 错误 UT005014:无法解析请求:io.undertow.util.BadRequestException:UT000165:请求目标中的字符 ä 无效
【发布时间】: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


【解决方案1】:

我终于在 JBossDevelopers 社区的帮助下解决了这个问题

我认为问题不在于 SOAP 消息的内容,而是用于接触 Web 服务的 URI。可以使用以下任何选项解决问题。对于引入了 undertow 子系统的最新 Wildfly 版本,建议使用选项 2。

  1. 通过将以下 Java 选项添加到启动脚本:

-Dorg.wildfly.undertow.ALLOW_UNESCAPED_CHARACTERS_IN_URL=true

  1. 或者我们可以在standalone.xml 文件的undertow 子系统中设置allow-unescaped-characters-in-url="true" 和url-charset="windows-1252" 标志。

我认为这些选项是作为 undertow:6.0 模式的一部分添加的,作为 https-listener 和 http-listener 元素的属性。

看这里:

wildfly/wildfly-undertow_6_0.xsd at master·wildfly/wildfly·GitHub

一个示例配置:

wildfly/undertow-6.0.xml at master·wildfly/wildfly·GitHub

【讨论】:

    猜你喜欢
    • 2023-02-03
    • 2014-12-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多