dimanche 19 avril 2015

call url in service web java spring

I need call a web services in an url and later modify json that I recieve, but I dont obtain the result correct. I use spring mvc.


I have this code java:



@RequestMapping(value = "/test", produces = "application/json")
@ResponseBody
public String infoSist() throws Exception {
base = new URL("http://localhost:" + port + "/metrics");
template = new RestTemplate();
ResponseEntity<String> infoSist = template.getForEntity(base.toString(), String.class);
System.out.printf("Exit: \n\n %s",infoSist.getBody());
return infoSist.getBody();
}


I dont obtain infoSist the json of return the URL, this show the code html of login page. What is the problem?


thank you very much!


Aucun commentaire:

Enregistrer un commentaire