Skip to content

RestTemplate - postForObject() method [SPR-5836] #10506

Closed
@spring-projects-issues

Description

@spring-projects-issues

Graham Zabel opened SPR-5836 and commented

Hi,

Using RestTemplate, the only way to execute a POST and process the response is to use execute() providing custom Callback and Extractor classes, which seems to be very elaborate. Could we have a new convenience method, perhaps postForObject() that does something like this:

public <R> R postForObject(String url, Object request, Class<R> responseType) throws RestClientException {
	return execute(url, HttpMethod.POST, 
				new PostPutCallback(request), new HttpMessageConverterExtractor<R>(responseType));
}

thanks,
Graham


Affects: 3.0 M3

Referenced from: commits ddcd9f4

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions