HTTP 400。错误的请求。上传带有特殊字符的xml文件时
也许你可以帮助我解决我的问题:)这是问题描述。
我的应用程序在 jboss 4.2.3 上运行。它具有一些通过休息端点上传内容的功能。当用户尝试发送带有特殊字符(如 )的内容时,我遇到问题。用户总是收到 400 错误响应。
这是运行正常的 PUT 请求正文的示例:
<content-list xmlns="http://www.test.com/pgp/1.0">
<content-record content-type="i_schema_2:ContentType2"
url-key="bla bla bla" created-by="test">
<field name="field1" type="string">Field3 Value</field>
<field name="field2" type="string">Field4 Value</field>
<field name="field3" type="string">Field4 Value</field>
</content-record>
</content-list>
这是运行时出现 400 错误的 PUT 请求正文的示例:
<content-list xmlns="http://www.test.com/pgp/1.0">
<content-record content-type="i_schema_2:ContentType2"
url-key="bla bla bla" created-by="test">
<field name="field1" type="string">Field3 Value</field>
<field name="field2" type="string">Field4 Value</field>
<field name="field3" type="string">Field4 Value</field>
</content-record>
</content-list>
这可以通过设置 jboss 的 tomcat 或某些 http 请求标头的一些选项来调整吗?
Maybe you can help me in my problem:) And here is the issue description.
My application is running on jboss 4.2.3. It has some functionality to upload content via rest endpoint. I have a problem when user tries to send content with special character like . User always get 400 bad response.
Here is as example of body of PUT request that run ok:
<content-list xmlns="http://www.test.com/pgp/1.0">
<content-record content-type="i_schema_2:ContentType2"
url-key="bla bla bla" created-by="test">
<field name="field1" type="string">Field3 Value</field>
<field name="field2" type="string">Field4 Value</field>
<field name="field3" type="string">Field4 Value</field>
</content-record>
</content-list>
And here is as example of body of PUT request that run with 400 error:
<content-list xmlns="http://www.test.com/pgp/1.0">
<content-record content-type="i_schema_2:ContentType2"
url-key="bla bla bla" created-by="test">
<field name="field1" type="string">Field3 Value</field>
<field name="field2" type="string">Field4 Value</field>
<field name="field3" type="string">Field4 Value</field>
</content-record>
</content-list>
Is this could be tuned by setting some options to tomcat of jboss or some http request header?
不是 XML 中的合法字符。听起来您的服务器在上传 XML 时正在解析该 XML,并且该 XML 的格式不正确。
is not a legal character in XML. It sounds like your server is parsing the XML when it is uploaded, and the XML is not well-formed.