Skip to content
Skip to breadcrumbs
Skip to header menu
Skip to action menu
Skip to quick search
Quick Search
Browse
Pages
Blog
Labels
Attachments
Mail
Advanced
What’s New
Space Directory
Feed Builder
Keyboard Shortcuts
Confluence Gadgets
Log In
Sign Up
Dashboard
Groovy
Copy Page
You are not logged in. Any changes you make will be marked as
anonymous
. You may want to
Log In
if you already have an account. You can also
Sign Up
for a new account.
This page is being edited by
.
Paragraph
Paragraph
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Preformatted
Quote
Bold
Italic
Underline
More colours
Strikethrough
Subscript
Superscript
Monospace
Clear Formatting
Bullet list
Numbered list
Outdent
Indent
Align left
Align center
Align right
Link
Table
Insert
Insert Content
Image
Link
Attachment
Symbol
Emoticon
Wiki Markup
Horizontal rule
tinymce.confluence.insert_menu.macro_desc
Info
JIRA Issue
Status
Gallery
Tasklist
Table of Contents
Other Macros
Page Layout
No Layout
Two column (simple)
Two column (simple, left sidebar)
Two column (simple, right sidebar)
Three column (simple)
Two column
Two column (left sidebar)
Two column (right sidebar)
Three column
Three column (left and right sidebars)
Undo
Redo
Find/Replace
Keyboard Shortcuts Help
<h2>Module Overview</h2> <p><table class="wysiwyg-macro" data-macro-name="excerpt" data-macro-parameters="atlassian-macro-output-type=BLOCK|hidden=true" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2V4Y2VycHQ6aGlkZGVuPXRydWV8YXRsYXNzaWFuLW1hY3JvLW91dHB1dC10eXBlPUJMT0NLfQ&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="RICH_TEXT"><tr><td class="wysiwyg-macro-body"><p>Groovy DSL for constructing Restlet application</p></td></tr></table><br /> GroovyRestlet is a simple DSL for constructing <a href="http://www.restlet.org">Restlet</a> application in a simple, shortcuting syntax.</p> <h2>Download</h2> <h3>Distributions</h3> <p>GroovyRestlet is distributed as a single jar.</p> <h4>Current release</h4> <p>GroovyRestlet 0.3-SNAPSHOT, donwload <a href="http://groovy-restlet.googlecode.com/files/groovy-restlet-0.3-SNAPSHOT.jar">here</a><br /> <strong>Changes</strong></p> <ul> <li>Upgrade to Restlet 1.1 M3</li> <li>Upgrade to Spring 2.5.2</li> <li><code>directory</code> constructor now only accept <code>root</code> attribute as valid <code>URI</code>.</li> <li>Bug fixes</li> </ul> <h4>Old releases</h4> <ul> <li>GroovyRestlet 0.2, download from <a href="http://groovy-restlet.googlecode.com/files/groovy-restlet-0.2-SNAPSHOT.jar">here</a></li> <li>GroovyRestlet 0.1, download from <a href="http://groovy-restlet.googlecode.com/files/groovy-restlet-0.1.jar">here</a> for Restlet 1.1-SNAPSHOT</li> </ul> <h3>Pre-requisites</h3> <p>At current moment, GroovyRestlet depends following:</p> <ul> <li>Groovy 1.5</li> <li>Java 1.5</li> <li>Restlet 1.1-SNAPSHOT</li> <li>SLF4J 1.4.3 as logging tool</li> <li>Spring 2.5 if spring integration is required</li> <li>commons-lang 2.3</li> </ul> <h3>Installing</h3> <p>Drop GroovyRestlet and all dependencies in your Java classpath.</p> <h2>Documentation</h2> <h3>Quick start</h3> <p>First, create an instance of <code>GroovyRestlet</code> first.</p> <table class="wysiwyg-macro" data-macro-name="code" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGV9&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> GroovyRestlet gr = new GroovyRestlet() </pre></td></tr></table> <table class="wysiwyg-macro" data-macro-name="info" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2luZm99&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="RICH_TEXT"><tr><td class="wysiwyg-macro-body"> <p>If you want Spring support, provide an instance of <code>ApplicationContext</code> as the constructor parameter.</p></td></tr></table> <table class="wysiwyg-macro" data-macro-name="code" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGV9&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> GroovyRestlet gr = new GroovyRestlet(appCtx); </pre></td></tr></table> <p>Then, prepare your Restlet building script using simple GroovyRestlet DSL syntax.<br /> Calling <code>GroovyRestlet.build(URI)</code> then done.</p> <p>Check <a class="confluence-link" href="/display/GROOVY/GroovyRestlet+User+Guide" data-linked-resource-id="73793942" data-linked-resource-type="page" data-linked-resource-default-alias="GroovyRestlet User Guide" data-base-url="http://docs.codehaus.org">GroovyRestlet User Guide</a> for detail user information.</p> <h4>Examples</h4> <p>Here is one GroovyRestlet DSL example, inspired from <a href="http://www.restlet.org/documentation/1.1/tutorial#part11">Restlet tutorial 11</a>.</p> <table class="wysiwyg-macro" data-macro-name="code" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGV9&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> 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() </pre></td></tr></table> <p>For more examples:</p> <ul> <li><a class="confluence-link" href="/display/GROOVY/RestletTutorialExamples" data-linked-resource-id="73793899" data-linked-resource-type="page" data-linked-resource-default-alias="RestletTutorialExamples" data-base-url="http://docs.codehaus.org">Complete examples</a> for <a href="http://www.restlet.org/documentation/1.1/tutorial">Restlet tutorial</a></li> <li><a class="confluence-link" href="/display/GROOVY/SpringIntegrationExamples" data-linked-resource-id="73793901" data-linked-resource-type="page" data-linked-resource-default-alias="SpringIntegrationExamples" data-base-url="http://docs.codehaus.org">SpringIntegrationExamples</a></li> </ul> <h2>Developers</h2> <h3>Source Control</h3> <p><a href="http://svn.codehaus.org/groovy-contrib/groovyrestlet/trunk">http://svn.codehaus.org/groovy-contrib/groovyrestlet/trunk</a></p> <h3>Building</h3> <p>GroovyRestlet uses Maven 2 as its building tool.</p> <h3>Contributing</h3> <p>Feel free to contribute.</p> <h3>Mailing List(s)</h3> <p><a href="http://groovy.codehaus.org/Mailing+Lists">http://groovy.codehaus.org/Mailing+Lists</a></p> <h3>Issue tracker</h3> <p><a href="http://code.google.com/p/groovy-restlet/issues/">http://code.google.com/p/groovy-restlet/issues/</a></p>
Please type the word appearing in the picture.
Attachments
Labels
Location
Watch this page
< Edit
Preview >
Loading…
Save
Cancel
Next hint
search
attachments
weblink
advanced