Resteasy Service 中的类似参数列表
各位哀悼者好!
如何将像参数这样的列表发送到 Resteasy 服务?
当我执行时抛出异常如下:
java.lang.RuntimeException: could not find writer for content-type multipart/mixed type: java.util.ArrayList
at org.jboss.resteasy.client.ClientRequest.writeRequestBody(ClientRequest.java:474)
at org.jboss.resteasy.client.core.executors.ApacheHttpClientExecutor$ClientRequestEntity.<init>(ApacheHttpClientExecutor.java:154)
at org.jboss.resteasy.client.core.executors.ApacheHttpClientExecutor.loadHttpMethod(ApacheHttpClientExecutor.java:226)
at org.jboss.resteasy.client.core.executors.ApacheHttpClientExecutor.execute(ApacheHttpClientExecutor.java:78)
at org.jboss.resteasy.core.interception.ClientExecutionContextImpl.proceed(ClientExecutionContextImpl.java:39)
at org.jboss.resteasy.plugins.interceptors.encoding.AcceptEncodingGZIPInterceptor.execute(AcceptEncodingGZIPInterceptor.java:40)
at org.jboss.resteasy.core.interception.ClientExecutionContextImpl.proceed(ClientExecutionContextImpl.java:45)
at org.jboss.resteasy.client.ClientRequest.execute(ClientRequest.java:449)
at org.jboss.resteasy.client.ClientRequest.httpMethod(ClientRequest.java:679)
at org.jboss.resteasy.client.ClientRequest.put(ClientRequest.java:541)
at org.jboss.resteasy.client.ClientRequest.put(ClientRequest.java:546)
at Principal.main(Principal.java:74)
我的服务声明为这种形式:
@PUT
@Path("gravarBoletos")
@Consumes("multipart/mixed")
@Produces(MediaType.TEXT_PLAIN)
public Integer gravarBoletos(List<TituloTO> tituloTOs) throws ExcecaoSistema, ExcecaoNegocio;
我在我的客户端中调用这种形式:
ClientRequest request = new ClientRequest(urlWebService + "/mFinanceiroService/gravarBoletos");
request.accept("multipart/mixed");
request.body("multipart/mixed", tituloImport.getTituloTOs());
ClientResponse<Integer> response = request.put(Integer.class);
System.out.println(response.getEntity());
有人帮助我吗??? 谢谢!
Good mournig guys!
How to send a List like param to a Resteasy service?
When I'll execute throws the exception follow:
java.lang.RuntimeException: could not find writer for content-type multipart/mixed type: java.util.ArrayList
at org.jboss.resteasy.client.ClientRequest.writeRequestBody(ClientRequest.java:474)
at org.jboss.resteasy.client.core.executors.ApacheHttpClientExecutor$ClientRequestEntity.<init>(ApacheHttpClientExecutor.java:154)
at org.jboss.resteasy.client.core.executors.ApacheHttpClientExecutor.loadHttpMethod(ApacheHttpClientExecutor.java:226)
at org.jboss.resteasy.client.core.executors.ApacheHttpClientExecutor.execute(ApacheHttpClientExecutor.java:78)
at org.jboss.resteasy.core.interception.ClientExecutionContextImpl.proceed(ClientExecutionContextImpl.java:39)
at org.jboss.resteasy.plugins.interceptors.encoding.AcceptEncodingGZIPInterceptor.execute(AcceptEncodingGZIPInterceptor.java:40)
at org.jboss.resteasy.core.interception.ClientExecutionContextImpl.proceed(ClientExecutionContextImpl.java:45)
at org.jboss.resteasy.client.ClientRequest.execute(ClientRequest.java:449)
at org.jboss.resteasy.client.ClientRequest.httpMethod(ClientRequest.java:679)
at org.jboss.resteasy.client.ClientRequest.put(ClientRequest.java:541)
at org.jboss.resteasy.client.ClientRequest.put(ClientRequest.java:546)
at Principal.main(Principal.java:74)
My service is declared this form:
@PUT
@Path("gravarBoletos")
@Consumes("multipart/mixed")
@Produces(MediaType.TEXT_PLAIN)
public Integer gravarBoletos(List<TituloTO> tituloTOs) throws ExcecaoSistema, ExcecaoNegocio;
I call in my client this form:
ClientRequest request = new ClientRequest(urlWebService + "/mFinanceiroService/gravarBoletos");
request.accept("multipart/mixed");
request.body("multipart/mixed", tituloImport.getTituloTOs());
ClientResponse<Integer> response = request.put(Integer.class);
System.out.println(response.getEntity());
Anybody help me????
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用@Wrapped注释。
将返回此 xml:
Use the @Wrapped annotation.
Would return this xml: