Add hook for error message
@@ -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);
