2

Lets say i have a Controller like this one :

@RequestMapping(method=RequestMethod.GET, value="/error")
    public  void getresponse(ModelMap modelMap) {

modelMap.addAttribute("categories", "");
}

Is it possible to send a 401 HTTP error when this controller is called? If yes, how ?

1

1 Answer 1

4

Yes its possible. Annotate it with:

@ResponseStatus(value=HttpStatus.UNAUTHORIZED)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.