Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have to call a REST web-service and I am planning to use Rest Template.

I looked at examples on how to make a GET request but I don't really understand how to use

the getForObjectmethod

In my case

request is a string

response=is an arraylist<URI>

I have create a class named ObjectExchanged

   public class ObjectExchanged {
@JsonProperty
String request;
ArrayList<URI> response;
  }

Then

    getRestTemplate()).getForObject(URL, ObjectExchanged.class, ??);

What Should I put in the third field

share|improve this question
add comment

1 Answer

Why you want 3rd field??

getForObject(uri,ObjectExchanged.class); will work

getForObject(java.lang.String s, java.lang.Class<T> tClass, java.lang.Object... objects) throws org.springframework.web.client.RestClientException; 
getForObject(java.lang.String s, java.lang.Class<T> tClass, java.util.Map<java.lang.String,?> stringMap) throws org.springframework.web.client.RestClientException; 
getForObject(java.net.URI uri, java.lang.Class<T> tClass) throws org.springframework.web.client.RestClientException; 

these are the 3 type of implementation

share|improve this answer
 
I thins it depend from the URL format as they said the third field is to expand the template –  nawara Jun 13 at 10:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.