exchange
Execute the HTTP method to the given URI template, writing the given request entity to the request, and returns the response as ResponseEntity.
URI Template variables are expanded using the given URI variables, if any.
Return
the response as entity
Parameters
the URL
the HTTP method (GET, POST, etc.)
the entity (headers and/or body) to write to the request, maybe null
the type of the return value
the variables to expand in the template
the type of the return value
See also
Execute the HTTP method to the given URI template, writing the given request entity to the request, and returns the response as ResponseEntity.
URI Template variables are expanded using the given URI variables, if any.
Return
the response as entity
Parameters
the URL
the HTTP method (GET, POST, etc.)
the entity (headers and/or body) to write to the request, maybe null
the type of the return value
the variables to expand in the template
the type of the return value
See also
Execute the HTTP method to the given URI template, writing the given request entity to the request, and returns the response as ResponseEntity.
Return
the response as entity
Parameters
the URL
the HTTP method (GET, POST, etc.)
the entity (headers and/or body) to write to the request, maybe null
the type of the return value
the type of the return value
See also
Execute the HTTP method to the given URI template, writing the given request entity to the request, and returns the response as ResponseEntity. The given ParameterizedTypeReference is used to pass generic type information:
ParameterizedTypeReference<List<MyBean>> myBean = new ParameterizedTypeReference<List<MyBean>>() {};
ResponseEntity<List<MyBean>> response = template.exchange("https://example.com",HttpMethod.GET, null, myBean);
Return
the response as entity
Parameters
the URL
the HTTP method (GET, POST, etc.)
the entity (headers and/or body) to write to the request, maybe null
the type of the return value
the variables to expand in the template
the type of the return value
See also
Execute the HTTP method to the given URI template, writing the given request entity to the request, and returns the response as ResponseEntity. The given ParameterizedTypeReference is used to pass generic type information:
ParameterizedTypeReference<List<MyBean>> myBean = new ParameterizedTypeReference<List<MyBean>>() {};
ResponseEntity<List<MyBean>> response = template.exchange("https://example.com",HttpMethod.GET, null, myBean);
Return
the response as entity
Parameters
the URL
the HTTP method (GET, POST, etc.)
the entity (headers and/or body) to write to the request, maybe null
the type of the return value
the variables to expand in the template
the type of the return value
See also
Execute the HTTP method to the given URI template, writing the given request entity to the request, and returns the response as ResponseEntity. The given ParameterizedTypeReference is used to pass generic type information:
ParameterizedTypeReference<List<MyBean>> myBean = new ParameterizedTypeReference<List<MyBean>>() {};
ResponseEntity<List<MyBean>> response = template.exchange("https://example.com",HttpMethod.GET, null, myBean);
Return
the response as entity
Parameters
the URL
the HTTP method (GET, POST, etc.)
the entity (headers and/or body) to write to the request, maybe null
the type of the return value
the type of the return value
See also
Execute the request specified in the given RequestEntity and return the response as ResponseEntity. Typically used in combination with the static builder methods on RequestEntity
, for instance:
MyRequest body = ...
RequestEntity request = RequestEntity.post(new URI("https://example.com/foo")).accept(MediaType.APPLICATION_JSON).body(body);
ResponseEntity<MyResponse> response = template.exchange(request, MyResponse.class);
Return
the response as entity
Parameters
the entity to write to the request
the type of the return value
the type of the return value
See also
Execute the request specified in the given RequestEntity and return the response as ResponseEntity. The given ParameterizedTypeReference is used to pass generic type information:
MyRequest body = ...
RequestEntity request = RequestEntity.post(new URI("https://example.com/foo")).accept(MediaType.APPLICATION_JSON).body(body);
ParameterizedTypeReference<List<MyResponse>> myBean = new ParameterizedTypeReference<List<MyResponse>>() {};
ResponseEntity<List<MyResponse>> response = template.exchange(request, myBean);
Return
the response as entity
Parameters
the entity to write to the request
the type of the return value
the type of the return value