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 8728745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:42:29+00:00 2026-06-13T08:42:29+00:00

Here is my Strifified json, { Request:{ Object1:{ Key1:Value1 }, Object2:{ Key2:Value2 } },

  • 0

Here is my Strifified json,

 {
       "Request":{
              "Object1":{
                 "Key1":"Value1"
              },
              "Object2":{
                  "Key2":"Value2"
              }
       },
       "Object3":{
                 "Key3":"Value3"
       }
}

I am forming this using Gson. String Stringifiedjson = new Gson().toJson(user);
Here is what i am trying to achive.

RestTemplate rest = new RestTemplate();
String url = "";
String event = rest.getForObject(url, Stringifiedjson);
  1. How would i send to my REST Service and get back my result in onEventHandler or onErrorHandler. I am basically from JavaScript background.
  2. Why does the method getForObject does not accept String, String as params.

Update:

AuthenticateUser user = new AuthenticateUser(credential, Header);       
HttpHeaders requestHeaders = new HttpHeaders();
requestHeaders.setContentType(new MediaType("application","json"));         
//HttpEntity<AuthenticateUser> requestEntity = new HttpEntity<AuthenticateUser>(user, requestHeaders);


RestTemplate restTemplate = new RestTemplate();
restTemplate.getMessageConverters().add(new MappingJacksonHttpMessageConverter());
restTemplate.getMessageConverters().add(new StringHttpMessageConverter());
String url = "url";             
String result = restTemplate.postForObject(url, AuthenticateUser.class, String.class);

Attached is the pastie of what exception i am getting.

http://pastie.org/private/efyfvvbxyxdsvm3lvv7q

  • 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-13T08:42:30+00:00Added an answer on June 13, 2026 at 8:42 am

    About the second question: I just found this example (you could take a look at the entire doc 😉 )

    2.7.1 Basic Usage Example
    The following example shows a query to google for the search term “SpringSource”.

    String url = "https://ajax.googleapis.com/ajax/services/search/web?v=1.0&q={query}";
    
    // Create a new RestTemplate instance
    RestTemplate restTemplate = new RestTemplate();
    
    // Add the String message converter
    restTemplate.getMessageConverters().add(new StringHttpMessageConverter());
    
    // Make the HTTP GET request, marshaling the response to a String
    String result = restTemplate.getForObject(url, String.class, "SpringSource");
    
    getForObject
    
    public <T> T getForObject(URI url,
                        Class<T> responseType)
              throws RestClientException
    Description copied from interface: RestOperations
    Retrieve a representation by doing a GET on the URL . The response (if any) is converted and returned.
    Specified by:
    getForObject in interface RestOperations
    Parameters:
    url - the URL
    responseType - the type of the return value
    Returns:
    the converted object
    Throws:
    RestClientException
    

    The exception in your stacktrace could be related to the same issue of this post. The problem occurs when your app tries to make a connection in the main thread.

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

Sidebar

Related Questions

Here is the code in a function I'm trying to revise. This example works
Here's what I'm trying to accomplish with this program: a recursive method that checks
Here is the css: #content ul { font-size: 12px; } I am trying this:
Here is an example. foreach (var doc in documents) { var processor = this.factory.Create();
Here's the two scenarios. We are using a manually built xml soap request with
Here's a coding problem for those that like this kind of thing. Let's see
Here is what I am trying to achieve in PHP: I have this string:
Here is my simplified data structure: Object1.h template <class T> class Object1 { private:
Here is my question. I am having this simple menu. <div id=menu> <ul> <li>
Here's the view: @if (stream.StreamSourceId == 1) { <img class=source src=@Url.Content(~/Public/assets/images/own3dlogo.png) alt= /> }

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.