Hi All,
I am working a simple Groovy
Builder<http://groovy.codehaus.org/GroovyMarkup>for Restlet, which
intends to create a complex Restlet application using a
simple shortcutting syntax. Also this builder is trying to support smooth
Spring integration.
Here is a short example
> builder.component{
> current.servers.add(protocol.HTTP, 8182)
>
>
> application(uri:""){
> router{
>
> def guard = guard(uri:"/docs", scheme:challengeScheme.HTTP_BASIC,
>
> realm:"Restlet Tutorials")
> guard.secrets.put("scott", "tiger".toCharArray())
>
> guard.next = directory(root:"", autoAttach:false)
>
>
> restlet(uri:"/users/{user}", handle:{req,resp->
>
> resp.setEntity("Account of user
> \"${req.attributes.get('user')}\"",
>
> mediaType.TEXT_PLAIN)
> })
>
>
> restlet(uri:"/users/{user}/orders", handle:{req, resp->
>
> resp.setEntity("Orders or user
> \"${req.attributes.get('user')}\"",
>
> mediaType.TEXT_PLAIN)
> })
>
>
> restlet(uri:"/users/{user}/orders/{order}", handle:{req, resp->
>
> def attrs = req.attributes
> def message = "Order \"${attrs.get('order')}\" for User
> \"${attrs.get('user')}\""
>
> resp.setEntity(message, mediaType.TEXT_PLAIN)
>
> })
> }
> }
> }.start()
>
> For more detail, please visit project site
http://code.google.com/p/groovy-restlet/. More examples are provided.
I am not sure whether this would be a nice idea, any comments and
suggestions are highly appreciated.
--
We paranoid love life