Java tutorial
/* * 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 hr.softwarecity.osijek.controllers; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController public class SessionController { /** * Method to send error if session is not present * @return HTTP 401 */ @RequestMapping(value = "/badrequest") public ResponseEntity returnUnauthorized() { return new ResponseEntity(HttpStatus.UNAUTHORIZED); } /** * Method to send HTTP ok if session is present * @return HTTP 200 */ @RequestMapping(value = "/goodrequest") public ResponseEntity returnOk() { return new ResponseEntity(HttpStatus.OK); } }