1
骆驼解码URL参数。 。有没有办法,我得到我发送的URL 我有以下情形(Spring的XML &骆驼):我可以阻止骆驼解码查询参数吗?
<route id="getDepResources">
<from uri="restlet:/dep/{depId}/resources?restletMethods=GET"/>
<bean ref="deptUtility" method="process" />
</route>
public void process(Exchange exchange) throws Exception {
Message message = exchange.getIn();
String body = message.getBody(String.class);
String uri = message.getHeader(Exchange.HTTP_URI, String.class);
......
}
curl -X GET 'http://localhost:8080/app1/dep/1/resources?resourceDesc=R%26B' --header "Content-Type:application/json"
所以对于resourceDesc = R%26B(R & B)我需要得到它为R %26B,而我得到的第3行的URI是http://localhost:8080/app1/dep/1/resources?resourceDesc=R&B
,而我认为它应该是http://localhost:8080/app1/dep/1/resources?resourceDesc=R%26B
。有没有我可以做相同或任何其他方式的配置?请建议。
对不起,但我附加&as%26我:e resourceDesc = R%26B(R&B是实际文本)。我希望将它作为%26而不是&(保持原样的URL) – JD7
message.getHeader(Exchange.HTTP_QUERY,String.class)也是这样做的。 – JD7
因为它与骆驼相关:之前解码了URI。如果您希望您的应用程序获得R%26B,则必须对%,'R%2526B'进行编码。 –