布尔返回类型不与RestTemplate一起使用

时间:2010-10-21 14:52:48

标签: spring apache-servicemix

我正在使用Spring 3.0.3 RestTemplate对服务进行RESTfull调用,该服务部署在servicemix ESB中。 Service方法返回boolean值,并且无法在RestTemplate响应中接收到它。

String query = "?userId="+userId;
RestTemplate rest = new RestTemplate();
Map<String, String> params = new HashMap<String, String>();

boolean status = rest.getForObject(SERVICE_URL+query,boolean.class,params);

我的错误

WARN : org.springframework.web.client.RestTemplate - GET request for "http://localhost:818 1/cxf/monitoring/logclear?userId=admin" resulted in 406 (Not Acceptable); invoking error handler org.springframework.web.client.HttpClientErrorException: 406 Not Acceptable at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultR esponseErrorHandler.java:69) at org.springframework.web.client.RestTemplate.handleResponseError(RestTemplate.java:486)
    at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:443)
    at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:409)
    at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:206)

非常感谢任何帮助。谢谢!

0 个答案:

没有答案