Good points, Harry.  I can even implement the behavior I suggested in the 
rewrite script itself, i.e., search the modules path as specified in the 
request for the most "localized" rewriter script to invoke.  But was just 
curious as to how much built-in utility might be provided in the future.  
Thanks!
Paul Williams
From: [email protected] 
[mailto:[email protected]] On Behalf Of Harry Bakken
Sent: Thursday, May 26, 2011 10:43 AM
To: General MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] REST API


I am not totally sure what you mean by "subapps" but I assume it is one app 
server running on one port with code to support different code sets. Your 
rewrite.xqy can call functions from other files or route the request to another 
rewrite based on rules in your logic. So the main rewrite can examine the 
request path and if it starts with /app1/ it calls functions or routes the 
handling to app1-rewrite.xqy and /app2/ to app2-rewrite.xqy, etc. It can also 
have logic based on hostname or other parts of the request header.
On May 26, 2011 7:52 AM, "Williams, Paul" 
<[email protected]<mailto:[email protected]>>
 wrote:
> Thanks Eric -
>
> This lab code includes the module I was looking for. With some of the 
> marketing jargon I had seen about REST support, I thought maybe the rewriting 
> utility-level support had been built in. Is it ok to reuse parts of the lab 
> code?
>
> Also, do you know if there is an existing capability (or any plans to provide 
> one) to specify a relative rewriter path, e.g., "./rewriter.xqy" so that I 
> can have different rewriters in different subapps? Or maybe just let me 
> configure the rewriter script name (not the path) and let the server find the 
> most appropriate one to use by searching up the path tree. That would let me 
> keep my options specs simpler. (You know what they say, give 'em an 
> inch,...). As it is, I'm encouraged to break up my subapps into separate apps 
> with their own appservers - not necessarily a bad thing, but it's a less 
> direct port from eXist which I'm trying to do as painlessly as possible. 
> Thanks again!
> Paul Williams
>
> From: 
> [email protected]<mailto:[email protected]>
>  
> [mailto:[email protected]<mailto:[email protected]>]
>  On Behalf Of Eric Bloch
> Sent: Thursday, May 26, 2011 12:51 AM
> To: General MarkLogic Developer Discussion
> Subject: Re: [MarkLogic Dev General] REST API
>
> There is a copy of the lab data and code at 
> http://developer.marklogic.com/media/mluc11-labs/rest-rewriter/rewriter-lab.zip
>
> We do plan to host the code in a repo sometime soon. Norm has details.
>
> -Eric
>
> Eric Bloch
> [email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>
>
>
>
> On May 25, 2011, at 2:58 PM, Nuno Job wrote:
>
>
> Hi Paul,
>
> I might be wrong but I think the rest module that is defined in that lab is 
> still not in the product nor open-sourced.
>
> After reading what is suggested by Geert you can use rewrite 
> (http://github.com/dscape/rewrite) to handle your rules. It's an community 
> maintained open-source project based on the Ruby on Rails 3.0 routing. I can 
> give you some help if you like - there's plenty of customers using it 
> already. And if you feel like a feature is missing feel free to create an 
> issue report.
>
> Nuno
>
> On Wed, May 25, 2011 at 2:09 PM, Williams, Paul 
> <[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>>
>  wrote:
> Thanks Geert, I have a rewriter configured and working already in a simple 
> example app. But the apps we'll be porting are much more complex and I am 
> hoping to use the RESTful convention that is portrayed in this lab 
> (http://developer.marklogic.com/media/mluc11-labs/rest-rewriter/rewriter-lab.pdf).
>  Upon review, you'll see a reference to a rest.xqy module that does the 
> dispatching work. I cannot find it.
>
> Paul Williams
>
> From: 
> [email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>
>  
> [mailto:[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>]
>  On Behalf Of Geert Josten
> Sent: Wednesday, May 25, 2011 4:55 PM
> To: General MarkLogic Developer Discussion
> Subject: Re: [MarkLogic Dev General] REST API
>
> Hi Paul,
>
> Part of the solution is using the url rewriter option of http app servers. 
> That and more is explained in the application developer guide. Here a direct 
> link to the HTML section, the guide is also available as PDF:
>
> http://docs.marklogic.com/4.2doc/docapp.xqy#display.xqy?fname=http://pubs/4.2doc/xml/dev_guide/appserver-control.xml&query=rest+cat%3aguides%23pgfId-1059987
>
> Kind regards,
> Geert
>
> Van: 
> [email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>
>  
> [mailto:[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>]
>  Namens Williams, Paul
> Verzonden: woensdag 25 mei 2011 22:46
> Aan: 
> [email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>
> Onderwerp: [MarkLogic Dev General] REST API
>
> I'm researching options for implementing a URL rewriting pattern in a set of 
> applications being ported from eXist to MarkLogic. But I cannot find much in 
> the way of documentation on the native REST support that is now available. 
> I've read para 3.2 of the 4.1 Release Notes about URL Rewriting and JSON 
> support. But I cannot find a "REST API" module.
>
> I also saw a rewriting lab PDF from the User Conference that indicated the 
> existence of a rest.xqy module that defines rest:rewrite(). But I cannot find 
> any such module in my 4.2 installation. Can anyone point me to more 
> information about the "REST API".
>
> TIA!
>
> Paul Williams
>
> _______________________________________________
> General mailing list
> [email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>
> http://developer.marklogic.com/mailman/listinfo/general
>
> _______________________________________________
> General mailing list
> [email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>
> http://developer.marklogic.com/mailman/listinfo/general
>
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to