public final String post()

in java/java-guestbook/frontend/src/main/java/cloudcode/guestbook/frontend/FrontendController.java [54:71]


    public final String post(final GuestBookEntry formMessage)
            throws URISyntaxException {
        URI url = new URI(backendUri);

        HttpHeaders httpHeaders = new HttpHeaders();
        httpHeaders.set("Content-Type", "application/json");
        HttpEntity<GuestBookEntry> httpEntity =
            new HttpEntity<GuestBookEntry>(formMessage, httpHeaders);
        RestTemplate restTemplate = new RestTemplate();
        try {
            restTemplate.postForObject(url, httpEntity, String.class);
        } catch(Exception e) {
            e.printStackTrace();
            System.out.println("Error posting message to backend.");
        }

        return "redirect:/";
    }