简体   繁体   English

Mule HTTP请求响应代码400,URL中带有@符号

[英]Mule HTTP Request Response Code 400 with @ symbol in URL

** Question taken back ** **问题取回**

I am using the HTTP:Request component in Mule 3.8 - 我在Mule 3.8中使用HTTP:Request组件-

<http:request config-ref="httpRequestConfig" host="hostname" port="8081" path="validate/john.doe@gmail.com" method="GET" doc:name="HTTP Request" />

The HTTP Request Config looks like this - HTTP请求配置看起来像这样-

<http:request-config name="httpRequestConfig" basePath="user" doc:name="HTTP Request Configuration" />

This results in a response code of 400 - 结果是响应代码为400-

Root Exception stack trace:
org.mule.module.http.internal.request.ResponseValidatorException: Response code 400 mapped as failure.
    at org.mule.module.http.internal.request.SuccessStatusCodeValidator.validate(SuccessStatusCodeValidator.java:37)
    at org.mule.module.http.internal.request.DefaultHttpRequester.validateResponse(DefaultHttpRequester.java:356)
    at org.mule.module.http.internal.request.DefaultHttpRequester.innerProcess(DefaultHttpRequester.java:344)
    at org.mule.module.http.internal.request.DefaultHttpRequester.processBlocking(DefaultHttpRequester.java:217)

If I access the URL ( http://hostname:8081/user/validate/john.doe@gmail.com ) from Chrome, it works fine. 如果我从Chrome访问URL( http:// hostname:8081/user/validate/john.doe@gmail.com ),则可以正常运行。

I know it is the @ symbol that is causing the issue. 我知道是导致问题的@符号。 For a value without the @ symbol, the Mule flow works fine. 对于没有@符号的值,Mule流工作正常。

What could I be missing on the request? 请求中可能缺少什么?

Thanks for the help 谢谢您的帮助

URL has to be encoded for special characters. URL必须编码为特殊字符。 For your case replace @ character with %40 like this http://hostname:8081/user/validate/john.doe%40gmail.com 对于您的情况,将@字符替换为%40,例如http:// hostname:8081 / user / validate / john.doe%40gmail.com

It works for me, here is my code. 它对我有用,这是我的代码。

<http:listener-config port="8081" name="config" host="0.0.0.0" />

<flow name="test">
    <http:listener path="/Test/{emailAddress}" config-ref="config" />
    <logger level="INFO" message="#[message.inboundProperties.'http.uri.params'.emailAddress]"/>
</flow>

URL to test - http://localhost:8081/Test/senthil.test%40gmail.com 要测试的网址-http:// localhost:8081 / Test / senthil.test%40gmail.com

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM