我的控制器中有以下设置..
@RequestMapping(value="/security_param", method=RequestMethod.GET)
public @ResponseBody BigInteger getSecurityParam(){
return result.getBigInteger();
}
所以,当我通过在浏览器中输入来检查我的回复时,我得到了以下信息:
350094078853290372226929324000742644466642262681952226409886256271736198431807728267526406481556587992703721192341876290504971375383029475460844121232586227913173796191951197042895656298303777249177945550375699884594977303136892333029758596862673993846972456155271723432095094859391751714939658055297007851105568438549148984628844489662466256443824528144049402449678472642642...truncated
在我RestTemplate
这边,我有这样的JacksonMappingHttpMessageConverter
设置:
CommonsClientHttpRequestFactory factory = new CommonsClientHttpRequestFactory(commonsClient);
RestTemplate httpClient2 = new RestTemplate(factory);
List<HttpMessageConverter<?>> converters = new ArrayList();
converters.add(new MappingJacksonHttpMessageConverter());
httpClient2.setMessageConverters(converters);
URL serverDomainUrl = new URL("http://127.0.0.1:8080");
String urlPath = new URL(serverDomainUrl, "/trusted_server/security_param").toString();
BigInteger xx = httpClient2.getForObject(urlPath, BigInteger.class);
不知何故,反序列化效果不佳,我收到以下错误。
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 200
at org.codehaus.jackson.impl.Utf8StreamParser.parseNumberText(Utf8StreamParser.java:531)
at org.codehaus.jackson.impl.Utf8StreamParser._nextTokenNotInObject(Utf8StreamParser.java:435)
at org.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:323)
at org.codehaus.jackson.map.ObjectMapper._initForReading(ObjectMapper.java:2439)
at org.codehaus.jackson.map.ObjectMapper._readMapAndClose(ObjectMapper.java:2396)
at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1662)
at org.springframework.http.converter.json.MappingJacksonHttpMessageConverter.readInternal(MappingJacksonHttpMessageConverter.java:135)
at org.springframework.http.converter.AbstractHttpMessageConverter.read(AbstractHttpMessageConverter.java:154)
at org.springframework.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConverterExtractor.java:74)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:446)
尝试强制 String 对象类型也会产生相同的结果。似乎对长度有某种限制。
有谁知道这是什么原因?试过环顾四周,但找不到任何答案。