Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8821231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:48:05+00:00 2026-06-14T05:48:05+00:00

I have the following setup in my controller.. @RequestMapping(value=/security_param, method=RequestMethod.GET) public @ResponseBody BigInteger getSecurityParam(){

  • 0

I have the following setup in my controller..

@RequestMapping(value="/security_param", method=RequestMethod.GET)
    public @ResponseBody BigInteger getSecurityParam(){
        return result.getBigInteger();
    }

So, when I check my response by typing it in the browser, I got the following:

350094078853290372226929324000742644466642262681952226409886256271736198431807728267526406481556587992703721192341876290504971375383029475460844121232586227913173796191951197042895656298303777249177945550375699884594977303136892333029758596862673993846972456155271723432095094859391751714939658055297007851105568438549148984628844489662466256443824528144049402449678472642642...truncated

In my RestTemplate side, I had the JacksonMappingHttpMessageConverter setup like this:

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);

Somehow, the deserialization doesn’t work well and I got the following error.

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)

Trying to coerce the String object types also yield the same result. It seems like there is some kind of limit to the length.

Does anyone know what’s the reason for this? Have tried looking around but couldn’t find any answer.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T05:48:06+00:00Added an answer on June 14, 2026 at 5:48 am

    I believe the Jackson support for both RestTemplate and MVC (which use the same converter if I recall) will only work for Objects, Collections, and Maps.

    Thus you should probably do something like:

    @RequestMapping(value="/security_param", method=RequestMethod.GET)
    public @ResponseBody Map<String,Object> getSecurityParam(){
        Map<String,Object> m = new LinkedHashMap<String,Object>();
        m.put("token", result.getBigInteger().toString());
        return m;
    }
    

    Which will return a response like:

    {"token" : "350094078853290372226929324000...."}
    

    That is use objects, collections, and maps over literals like numbers, and strings. It also makes sense because:
    350094078853290372226929324000742644466642262681952226409886256271736198431807728267526406481556587992703721192341876290504971375383029475460844121232586227913173796191951197042895656298303777249177945550375699884594977303136892333029758596862673993846972456155271723432095094859391751714939658055297007851105568438549148984628844489662466256443824528144049402449678472642642

    Is not valid JSON. The reason it appears to work for MVC is that a different Converter than the Jackson one is doing the conversion.

    You should also know that BigInteger is not support in JSON in general (whether its in an Object or not). I am pretty sure Jackson will convert it to String but you should be aware of that also.

    I would’t use BigInteger for a token (if thats what your using it for) but instead use base64 encoded string which will be smaller and probably safer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using the ASP.NET Web-Api, I have the following POST setup in my controller. When
I have the following navigation setup on a grails controller is it possible for
I have the following form setup: <html> <head></head> <body> <form method=post enctype=multipart/form-data action=FileUpload> <table>
I have the following method: public void SetHttpStatusCode(HttpStatusCode httpStatusCode) { Response.StatusCode = (int)httpStatusCode; }
I have the following setup for my application: routes.MapRoute(Default, {controller}/{action}/{idt}, new { controller =
Following setup causes trouble: In my storyboard I have a standard table view controller,
I have following setup, but when I put 1024 and replace all 512 with
I have following models setup in my Django application class School(models.Model): name = models.TextField()
I have the following setup: Table: Question QuestionId Table: QuestionTag QuestionId TagId Table: Tag
I have the following setup, and I need to know how to persist state.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.