Hi Anthony, it's a long time ago, but if I remember right, your usecase is not planned in JAX-RS, so it is not implemented. I have the code not on the hand, and, I will not have time to look this week. The ExceptionHandler is a class of Restlet, and not implementing a JAX-RS interface, right? Than you could modify the JaxRsRestlet, so that you could give a subclass of ExceptionHandler (or change ExceptionHandler to an interface and use the logic as default implementation with the possibility to extend it.). Perhaps you need to extend the signature of method ExceptionHandler#methodNotAllowed() by addings the methods name. If you change it, it would be cool, if you could give the changes back to the community, see http://www.restlet.org/community and especially http://www.restlet.org/community/contribute.
If I remember right, the only sense of this class was to redude the number lines of code in the class JaxRsRestlet, and this was a meaningful own part of the logic. best regards Stephan webp...@tigris.org schrieb: > Hi, > > I have a resource say, GetOnlyResource which only supports the get GET method. > > When my client calls the GetOnlyResource with PUT method there's no hooks for > me to handle this Exception. > > I was under the impression that the above situation would be > resourceMethodNotFound and would subsequently calls > ExceptionHandler#resourceMethodNotFound() which then invoke the > noResMethodHandler hook. > > But my test reveals the above situation would end up calling > ExceptionHandler#methodNotAllowed() and there's no hook to handle this > exception. > > My assumption is, when the client tries to call a PUT method on the > GetOnlyResource but the PUT method is not found on the GetOnlyResource > therefore its resourceMethodNotFound. > > Could anyone please clarify my understanding. If my understanding was wrong > what is the alternative to hook into the methodNotAllowed(). > > My use case is when a client calls on any Unsupported method on any resource > (my example above) then I need to log it in our audit system. Currently we've > implemented this use case by; > > GetOnlyResource > #handleGet() -> do real work > #handlePut() -> audit log the Unsupported method > #handleDel() -> audit log the Unsupported > #handlePost() -> audit log the Unsupported > > We have a number of resource like the one above and I'm seeking an elegant > solution like using the noResMethodHandler. > > Thanks, > Anthony Xiao ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2427803