【发布时间】:2014-12-30 21:53:07
【问题描述】:
如何不在 HTTP 标头中发送可选参数“;CHARSET=UTF-8”的 RESTLET POST 请求?
当我在 UNIX 中使用 WGET 为我的服务尝试这个概念证明时,我可以像这样在 HTTP 标头中指定可选的 Content-type: ...:
指定编码为 UTF-8:
wget --header="Content-Type: application/x-www-form-urlencoded; charset=UTF-8" --post-file=input_file.xml https://localhost/myservice
省略编码:
wget --header="Content-Type: application/x-www-form-urlencoded" --post-file=input_file.xml https://localhost/myservice
当我在 RESTLET 中做这样的事情时
Form form = new Form();
String accessToken = "Moroni123";
form.set("access_token", accessToken);
如果我这样做是为了查看表示:
Representation rep = form.getWebRepresentation();
我使用 rep.toString() 方法看到了这一点:
[application/x-www-form-urlencoded,UTF-8]
有没有办法让它看起来像这样? SoapUI 在没有“UTF-8”的情况下发送它,我如何在 RESTLET 中做到这一点?
[application/x-www-form-urlencoded]
【问题讨论】:
-
你能给我你使用的Restlet版本吗?谢谢!
标签: utf-8 soapui soap-client restlet