Last active
March 4, 2017 11:25
-
-
Save albertoaflores/3bc4706e97c158e91117cef7ee13d9fe to your computer and use it in GitHub Desktop.
Sample REST endpoint with non 200 response and no Exception
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RequestMapping("/{surveyId}") | |
public Survey findSurvey(@PathVariable String surveyId, HttpServletResponse response) { | |
log.info("Querying survey {}", surveyId); | |
Survey survey = repository.get(surveyId); | |
if (survey == null) { | |
log.warn("Survey {} was not found!", surveyId); | |
response.setStatus(404); | |
} | |
return survey; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment