Snippets tagged “responsebody”
2 snippets use this tag.
- How to respond with an HTTP 400 error in a Spring MVC @ResponseBody method returning StringJava
To respond with an HTTP 400 error in a Spring MVC controller method that returns a String, you can throw a ResponseStatusException with a status of BAD_REQUEST.
- Spring MVC - How to return simple String as JSON in Rest ControllerJava
To return a simple string as JSON in a Spring MVC Rest Controller, you can use the @ResponseBody annotation and return the string directly.