Add hook for error message
This commit is contained in:
parent
ec4604c498
commit
d9296b8e42
|
@ -300,7 +300,7 @@ public class RestfulServer extends HttpServlet implements IRestfulServer<Servlet
|
||||||
} else {
|
} else {
|
||||||
resourceBinding = myResourceNameToBinding.get(resourceName);
|
resourceBinding = myResourceNameToBinding.get(resourceName);
|
||||||
if (resourceBinding == null) {
|
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;
|
return resourceMethod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void throwUnknownResourceTypeException(String theResourceName) {
|
||||||
|
throw new ResourceNotFoundException("Unknown resource type '" + theResourceName + "' - Server knows how to handle: " + myResourceNameToBinding.keySet());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
protected void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
handleRequest(RequestTypeEnum.DELETE, request, response);
|
handleRequest(RequestTypeEnum.DELETE, request, response);
|
||||||
|
|
Loading…
Reference in New Issue