eu.impress.impressplatform.Services.DHC.RESTManager.java Source code

Java tutorial

Introduction

Here is the source code for eu.impress.impressplatform.Services.DHC.RESTManager.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package eu.impress.impressplatform.Services.DHC;

import org.springframework.boot.*;
import org.springframework.boot.autoconfigure.*;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.*;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

/**
 *
 * @author danae
 */

@RestController
@EnableAutoConfiguration
public class RESTManager {

    /*@RequestMapping(    value="/beds/available", 
     method=RequestMethod.GET,
     produces=MediaType.APPLICATION_XML_VALUE)
    public ResponseEntity<String> postBedAvailablity(@RequestParam("hospital") String hospitalName) {
        
    } */

    @RequestMapping("/")
    String home() {
        return "Hello World!";
    }

    /*public static void main(String[] args) throws Exception {
    SpringApplication.run(RESTManager.class, args);
    }*/
    //rest client for Population
    public String consumePopulation() {

        RestTemplate restTemplate = new RestTemplate();
        String s = restTemplate.getForObject("http://192.168.3.27:8080/population/city/Abenbury", String.class);
        return s;
    }

}