updated AuthenticationException to extend BaseServerResponseException

This commit is contained in:
Yogthos 2014-03-10 10:47:48 -04:00
parent daa5ed6ea8
commit 1adfa2a246
2 changed files with 13 additions and 2 deletions

View File

@ -181,7 +181,7 @@ public abstract class RestfulServer extends HttpServlet {
// resourceMethod.get
} catch (AuthenticationException e) {
response.setStatus(401);
response.setStatus(e.getStatusCode());
response.getWriter().write(e.getMessage());
}
catch (BaseServerResponseException e) {

View File

@ -5,8 +5,19 @@ import javax.servlet.ServletException;
/**
* Created by dsotnikov on 3/10/2014.
*/
public class AuthenticationException extends ServletException {
public class AuthenticationException extends BaseServerResponseException {
private static final long serialVersionUID = 1L;
public AuthenticationException() {
super(401, "Client unauthorized");
}
public AuthenticationException(String theMessage) {
super(401, theMessage);
}
public AuthenticationException(int theStatusCode, String theMessage) {
super(theStatusCode, theMessage);
}
}