Spring 4 REST Exception Handling

JAX-RS Exception Handling Options 

  • Option #1: Set Response status with error code 
  • Option #2: Use WebApplicationException built-in generic unchecked exception class 
  • Option #3: Use JAX-RS built-in (yet more specific) exception class 
    • JAX-RS provides a set of built-in exception classes 
    • These exception classes are child classes of WebApplicationException class 
  • Option #4: Use Exception Mapping scheme

HTTP Response Codes 

  • 2xx: Success 
  • 3xx: Redirection 
  • 4xx: Client error 
  • 5xx: Server error

You must have an active subscription to download PDF and Lab Zip of this course topic.Please click the "Subscribe" button or the "Login" button if you already have an account.