To translate an incoming http request to the specific method in Play! web framework is straight forward, which look like as follows:
GET /users/{userId} UserController.getUser
POST /users UserController.addUser
PUT /users UserController.updateUser
DELETE /users/{userId} UserController.deleteUser
But I find it hard to do this in Mule-Restlet.
<model name="userModel">
<service name="userService">
<inbound>
<inbound-endpoint address="http://localhost:63080"/>
</inbound>
<outbound>
<filtering-router>
<outbound-endpoint address="vm://userController"/>
<or>
<restlet:uri-template-filter pattern="/users/{userId}" verbs="GET"/>
<restlet:uri-template-filter pattern="/users" verbs="POST"/>
<restlet:uri-template-filter pattern="/users" verbs="PUT"/>
<restlet:uri-template-filter pattern="/users/{userId}" verbs="DELETE"/>
</or>
</filtering-router>
</outbound>
</service>
<service name="userController">
<inbound>
<inbound-endpoint address="vm://userController"/>
</inbound>
<!-- **TODO: How to implement UserController** -->
<component class="com.ggd543.mulerestletdemo.user.UserController"/>
</service>
</model>
According to the Restlet Transport doc, you should be able to shorten your routing map to:
Then to develop your UserController resource, refer to the Restlet’s user guide that is relevant to the version in use by the transport.