Rakesh A
Rakesh A

Reputation: 229

best way to do a http request from a spring 3 controller

I've a Spring 3 Controller and it has to do a HTTP request [not a web service call] to another server which will give JSON response, controller then need to parse this JSON response and use it in JSP.

Upvotes: 1

Views: 475

Answers (2)

ramsinb
ramsinb

Reputation: 2005

HTTP client from apache is good, also look into jackson which will provide JSON parsing (https://github.com/FasterXML/jackson-core).

UPDATE: Something else you can look into is Spring's RestTemplate. This might be even easier to use than HTTP client.

Upvotes: 2

AlexR
AlexR

Reputation: 115418

If you want to perform HTTP request to another server I recommend you to user Apache HTTP client. You can configure it using Spring XML and inject into the context just as any other bean.

Upvotes: 0

Related Questions