Skip to content

Instantly share code, notes, and snippets.

@loind89
Created July 2, 2016 04:53
Show Gist options
  • Select an option

  • Save loind89/b03f5594f567a8ba65f04ea3c19f444e to your computer and use it in GitHub Desktop.

Select an option

Save loind89/b03f5594f567a8ba65f04ea3c19f444e to your computer and use it in GitHub Desktop.
Response Json from sprign boot exception handler for servelet exception
// this default json object that default spring boot have handling
// in @Controller ( java code )
throw new ServletException("Invalid login");
// response json
{
"data": {
"timestamp": 1467434876215,
"status": 500,
"error": "Internal Server Error",
"exception": "javax.servlet.ServletException",
"message": "Invalid login",
"path": "/user/login"
},
"status": 500,
"config": {
"method": "POST",
"transformRequest": [
null
],
"transformResponse": [
null
],
"url": "/user/login",
"data": {
"name": "sds"
},
"headers": {
"Accept": "application/json, text/plain, */*",
"Content-Type": "application/json;charset=utf-8"
}
},
"statusText": "Internal Server Error"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment