Add hook for error message

This commit is contained in:
jamesagnew 2018-08-08 15:14:39 -04:00
parent ec4604c498
commit d9296b8e42
1 changed files with 5 additions and 1 deletions

View File

@ -300,7 +300,7 @@ public class RestfulServer extends HttpServlet implements IRestfulServer<Servlet
} else {
resourceBinding = myResourceNameToBinding.get(resourceName);
if (resourceBinding == null) {
throw new ResourceNotFoundException("Unknown resource type '" + resourceName + "' - Server knows how to handle: " + myResourceNameToBinding.keySet());
throwUnknownResourceTypeException(resourceName);
}
}
@ -321,6 +321,10 @@ public class RestfulServer extends HttpServlet implements IRestfulServer<Servlet
return resourceMethod;
}
protected void throwUnknownResourceTypeException(String theResourceName) {
throw new ResourceNotFoundException("Unknown resource type '" + theResourceName + "' - Server knows how to handle: " + myResourceNameToBinding.keySet());
}
@Override
protected void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
handleRequest(RequestTypeEnum.DELETE, request, response);