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=2427518

Reply via email to