PUT and DELETE Methods

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

PUT and DELETE Methods

Robert Greathouse
Hi,

I have not been able to find any examples that register handlers for the PUT and/or DELETE HTTP methods. Are these methods supported?  I looked at the API docs for org.ratpackframework.handling.Handlers and noticed that there is only the single, no-argument variants of the methods. How would one use these no-arg methods?

Thanks for the help.
Reply | Threaded
Open this post in threaded view
|

Re: PUT and DELETE Methods

Luke Daley
Administrator
These methods should be added. There's no good reason why they haven't been, just an omission.

You can simulate it easily though.

<code>
add(Handlers.path("some/path", Arrays.asList(Handlers.put(), yourHandlerImpl)));
</code>

Where add() is org.ratpackframework.handling.Chain#add(Handler).

Routing in Ratpack is unlike other frameworks, in that it's hierarchical.

This construct creates a routing branch:

path handler
  - method handler
    - handler impl

If the path handler or method handler don't “match” then that branch terminates and routing moves on to the next one. An impl of put(String, Handler) would be the code above.
Reply | Threaded
Open this post in threaded view
|

Re: PUT and DELETE Methods

Robert Greathouse
Thank you. I'll give it a try.
rus
Reply | Threaded
Open this post in threaded view
|

Re: PUT and DELETE Methods

rus
Created an issue for this too https://github.com/ratpack/ratpack/issues/154