所以我使用的是旧版本的 Mule ( 3.3.1 ) 和 Jersey ( 1.6 ) - 对两者都很新,无法升级 - 并且在 Jersey 中遇到与“charset=UTF-8”的 FormParam 中的“null”类似的问题2.0"中的 HTML 表单数据@POST
总是被编辑,null
但使用curl(强制非 UTF-8 字符集)没有区别,我@FormParam
的 s 仍然是null
.
<flow name="repo" doc:name="Repository application">
<inbound-endpoint ref="RepositoryInternalEndpoint">
<not-filter>
<wildcard-filter pattern="/favicon.ico"/>
</not-filter>
</inbound-endpoint>
<!-- All seems fine at this point -->
<!--<custom-interceptor class="TestInterceptor"/>-->
<!-- Inside the RepositoryService class, @FormParam args are null -->
<jersey:resources doc:name="Repository Service Component">
<component>
<spring-object bean="repositoryService"/>
</component>
</jersey:resources>
</flow>
似乎泽西岛只是在吃我的请求体。鉴于如果我插入TestInterceptor
(在上面的注释中)它只输出消息属性,包括消息正文和@FromParam
s,那么所有预期的数据都在那里。有没有办法阻止泽西岛这样做或事先获取数据?
预期的@FormParam
论点都是String
这样......
@POST
@Path("/my/url")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Produces(MediaType.TEXT_HTML)
public Response myMethod(@FormParam("o_serviceId") String serviceId){}
使用的curl命令是
curl -X POST -H "content-type: application/x-www-form-urlencoded" -d "o_serviceId=12345y" localhost:8889/my/url