[Grok-dev] Is there an easy way to customize URL used for grok.REST (use suffix instead of prefix) ?

Craeg Strong cstrong at arielpartners.com
Sun Jun 1 21:51:05 EDT 2008


Using the excellent REST tutorial I was able to create a REST adapter 
that returns XML content in response to
an HTTP "GET" request at http://localhost:8080/++rest++xml/myapp/mycontainer

However, I would like to use simple relative URLs in my javascript like 
'xml'

Ext.onReady(function() {

    var proxy  = new Ext.data.HttpProxy({ url: 'xml', method:'GET'});

In my browser-side code, it seems to be much easier to construct a 
relative url simply by appending a suffix (such as 'xml') to the URL, 
rather than parsing the URL and inserting a prefix in between the 
host+port and path

The documentation provides a tantalizing hint: "As you can see, you need 
to use the ++rest++<protocolname> pattern somewhere in the URL in order 
to access the REST view for your objects. If you don't like the ++rest++ 
bit you can also provide (directlyProvides) the layer manually to the 
request during traversal"

But I am having trouble figuring out how to marry grok.Traverser with 
grok.REST.

Can anyone provide a bread crumb for me to follow?

Thanks!

--Craeg


More information about the Grok-dev mailing list