Fold - HTTP routing library

Tuesday, 25 November 2014 · 8 messages · last reply 1 Dec 2014
MG
Marc van Grootel25 Nov 2014 23:28 #
Hi, I would like to announce a new library (very alpha) called Fold. https://github.com/xokomola/fold It is a an HTTP routing library which provides an alternative way to map HTTP requests to XQuery functions. In future I hope to use this together with Origami to build REST services and small web apps. My main goal of announcing this is to get feedback on how to improve this. Currently it is defined on top of RESTXQ but in future this might be handled by a Java extension. There are parts missing still and I strongly advise you not to use this for a serious project. Performance gets bad quite quickly. Performance gains may very well be possible by XQuery refactorings. I basically wrote this as a port from a couple of Clojure libraries. A bit of documentation for this library and for Origami can be found in each project's wiki. Note that I only just started these and they are not complete. I'll be working on this library over the next month to get it into a more usable shape. Happy to receive comments and improvements. --Marc
MG
Maximilian Gärber26 Nov 2014 21:49 #
+1 I'd keep using restxq - maybe without the need for servlets sometime but it is the closest to a xquery webapp standard we've got
Quoted text · Marc van Grootel · 31 lines
Am 25.11.2014 23:28 schrieb "Marc van Grootel" <marc.van.grootel at gmail.com>: > Hi, > > I would like to announce a new library (very alpha) called Fold. > > https://github.com/xokomola/fold > > It is a an HTTP routing library which provides an alternative way to > map HTTP requests to XQuery functions. In future I hope to use this > together with Origami to build REST services and small web apps. > > My main goal of announcing this is to get feedback on how to improve > this. Currently it is defined on top of RESTXQ but in future this > might be handled by a Java extension. There are parts missing still > and I strongly advise you not to use this for a serious project. > > Performance gets bad quite quickly. Performance gains may very well be > possible by XQuery refactorings. I basically wrote this as a port from > a couple of Clojure libraries. > > A bit of documentation for this library and for Origami can be found > in each project's wiki. Note that I only just started these and they > are not complete. > > I'll be working on this library over the next month to get it into a > more usable shape. > > Happy to receive comments and improvements. > > --Marc >
MG
Marc van Grootel26 Nov 2014 22:12 #
I agree. I'm not using Fold at work either ;-) and I'm also not knocking RESTXQ in any way as, yes, it's the closest to a standard and has many implementations. I do think that experimenting with other approaches is good. Some languages use something like Fold with great success and uptake. Often as a base library on top of which other routing libraries/DSL's are created fostering even more diverse approaches. For the time being this will stay based on RESTXQ and stay away from Java but it does feel clumsy and duplicating basic HTTP request plumbing. ah well.... we'll see ... --Marc
Quoted text · Maximilian Gärber · 37 lines
On Wed, Nov 26, 2014 at 9:49 PM, Maximilian Gärber <mgaerber at arcor.de> wrote: > +1 > > I'd keep using restxq - maybe without the need for servlets sometime but it > is the closest to a xquery webapp standard we've got > > Am 25.11.2014 23:28 schrieb "Marc van Grootel" <marc.van.grootel at gmail.com>: > >> Hi, >> >> I would like to announce a new library (very alpha) called Fold. >> >> https://github.com/xokomola/fold >> >> It is a an HTTP routing library which provides an alternative way to >> map HTTP requests to XQuery functions. In future I hope to use this >> together with Origami to build REST services and small web apps. >> >> My main goal of announcing this is to get feedback on how to improve >> this. Currently it is defined on top of RESTXQ but in future this >> might be handled by a Java extension. There are parts missing still >> and I strongly advise you not to use this for a serious project. >> >> Performance gets bad quite quickly. Performance gains may very well be >> possible by XQuery refactorings. I basically wrote this as a port from >> a couple of Clojure libraries. >> >> A bit of documentation for this library and for Origami can be found >> in each project's wiki. Note that I only just started these and they >> are not complete. >> >> I'll be working on this library over the next month to get it into a >> more usable shape. >> >> Happy to receive comments and improvements. >> >> --Marc
-- --Marc
MG
Maximilian Gärber1 Dec 2014 15:51 #
I guess this request is reasonable: https://github.com/xokomola/fold/blob/master/webapp/fold/adapter/basex-restxq.xqm#L152 @Christian: would %rest:ANY or some sort of wildcard notion be possible? Regards, Maxi 2014-11-26 22:12 GMT+01:00 Marc van Grootel <marc.van.grootel at gmail.com>:
Quoted text · Marc van Grootel · 60 lines
> I agree. I'm not using Fold at work either ;-) and I'm also not > knocking RESTXQ in any way as, yes, it's the closest to a standard and > has many implementations. > > I do think that experimenting with other approaches is good. Some > languages use something like Fold with great success and uptake. Often > as a base library on top of which other routing libraries/DSL's are > created fostering even more diverse approaches. > > For the time being this will stay based on RESTXQ and stay away from > Java but it does feel clumsy and duplicating basic HTTP request > plumbing. > > ah well.... we'll see ... > > --Marc > > > On Wed, Nov 26, 2014 at 9:49 PM, Maximilian Gärber <mgaerber at arcor.de> wrote: >> +1 >> >> I'd keep using restxq - maybe without the need for servlets sometime but it >> is the closest to a xquery webapp standard we've got >> >> Am 25.11.2014 23:28 schrieb "Marc van Grootel" <marc.van.grootel at gmail.com>: >> >>> Hi, >>> >>> I would like to announce a new library (very alpha) called Fold. >>> >>> https://github.com/xokomola/fold >>> >>> It is a an HTTP routing library which provides an alternative way to >>> map HTTP requests to XQuery functions. In future I hope to use this >>> together with Origami to build REST services and small web apps. >>> >>> My main goal of announcing this is to get feedback on how to improve >>> this. Currently it is defined on top of RESTXQ but in future this >>> might be handled by a Java extension. There are parts missing still >>> and I strongly advise you not to use this for a serious project. >>> >>> Performance gets bad quite quickly. Performance gains may very well be >>> possible by XQuery refactorings. I basically wrote this as a port from >>> a couple of Clojure libraries. >>> >>> A bit of documentation for this library and for Origami can be found >>> in each project's wiki. Note that I only just started these and they >>> are not complete. >>> >>> I'll be working on this library over the next month to get it into a >>> more usable shape. >>> >>> Happy to receive comments and improvements. >>> >>> --Marc > > > > -- > --Marc
CG
Christian Grün1 Dec 2014 16:52 #
Hi Max, hi Marc, The %rest:path annotation in BaseX 8.0 allows regular expressions [1]; I guess this is what you need? Best, Christian [1] http://docs.basex.org/wiki/RESTXQ#Paths
Quoted text · Maximilian Gärber · 75 lines
On Mon, Dec 1, 2014 at 3:51 PM, Maximilian Gärber <mgaerber at arcor.de> wrote: > I guess this request is reasonable: > > https://github.com/xokomola/fold/blob/master/webapp/fold/adapter/basex-restxq.xqm#L152 > > @Christian: would %rest:ANY or some sort of wildcard notion be possible? > > Regards, > > Maxi > > > > > 2014-11-26 22:12 GMT+01:00 Marc van Grootel <marc.van.grootel at gmail.com>: >> I agree. I'm not using Fold at work either ;-) and I'm also not >> knocking RESTXQ in any way as, yes, it's the closest to a standard and >> has many implementations. >> >> I do think that experimenting with other approaches is good. Some >> languages use something like Fold with great success and uptake. Often >> as a base library on top of which other routing libraries/DSL's are >> created fostering even more diverse approaches. >> >> For the time being this will stay based on RESTXQ and stay away from >> Java but it does feel clumsy and duplicating basic HTTP request >> plumbing. >> >> ah well.... we'll see ... >> >> --Marc >> >> >> On Wed, Nov 26, 2014 at 9:49 PM, Maximilian Gärber <mgaerber at arcor.de> wrote: >>> +1 >>> >>> I'd keep using restxq - maybe without the need for servlets sometime but it >>> is the closest to a xquery webapp standard we've got >>> >>> Am 25.11.2014 23:28 schrieb "Marc van Grootel" <marc.van.grootel at gmail.com>: >>> >>>> Hi, >>>> >>>> I would like to announce a new library (very alpha) called Fold. >>>> >>>> https://github.com/xokomola/fold >>>> >>>> It is a an HTTP routing library which provides an alternative way to >>>> map HTTP requests to XQuery functions. In future I hope to use this >>>> together with Origami to build REST services and small web apps. >>>> >>>> My main goal of announcing this is to get feedback on how to improve >>>> this. Currently it is defined on top of RESTXQ but in future this >>>> might be handled by a Java extension. There are parts missing still >>>> and I strongly advise you not to use this for a serious project. >>>> >>>> Performance gets bad quite quickly. Performance gains may very well be >>>> possible by XQuery refactorings. I basically wrote this as a port from >>>> a couple of Clojure libraries. >>>> >>>> A bit of documentation for this library and for Origami can be found >>>> in each project's wiki. Note that I only just started these and they >>>> are not complete. >>>> >>>> I'll be working on this library over the next month to get it into a >>>> more usable shape. >>>> >>>> Happy to receive comments and improvements. >>>> >>>> --Marc >> >> >> >> -- >> --Marc
MG
Marc van Grootel1 Dec 2014 17:24 #
Hi Christian, %rest:ANY would route all HTTP methods through that function. Basically saying I don't care which method you call me with. So it has nothing to do with the paths. Hth --Marc
Quoted text · Christian Grün · 89 lines
On Mon, Dec 1, 2014 at 4:52 PM, Christian Grün <christian.gruen at gmail.com> wrote: > Hi Max, hi Marc, > > The %rest:path annotation in BaseX 8.0 allows regular expressions [1]; > I guess this is what you need? > > Best, > Christian > > [1] http://docs.basex.org/wiki/RESTXQ#Paths > > > > On Mon, Dec 1, 2014 at 3:51 PM, Maximilian Gärber <mgaerber at arcor.de> wrote: >> I guess this request is reasonable: >> >> https://github.com/xokomola/fold/blob/master/webapp/fold/adapter/basex-restxq.xqm#L152 >> >> @Christian: would %rest:ANY or some sort of wildcard notion be possible? >> >> Regards, >> >> Maxi >> >> >> >> >> 2014-11-26 22:12 GMT+01:00 Marc van Grootel <marc.van.grootel at gmail.com>: >>> I agree. I'm not using Fold at work either ;-) and I'm also not >>> knocking RESTXQ in any way as, yes, it's the closest to a standard and >>> has many implementations. >>> >>> I do think that experimenting with other approaches is good. Some >>> languages use something like Fold with great success and uptake. Often >>> as a base library on top of which other routing libraries/DSL's are >>> created fostering even more diverse approaches. >>> >>> For the time being this will stay based on RESTXQ and stay away from >>> Java but it does feel clumsy and duplicating basic HTTP request >>> plumbing. >>> >>> ah well.... we'll see ... >>> >>> --Marc >>> >>> >>> On Wed, Nov 26, 2014 at 9:49 PM, Maximilian Gärber <mgaerber at arcor.de> wrote: >>>> +1 >>>> >>>> I'd keep using restxq - maybe without the need for servlets sometime but it >>>> is the closest to a xquery webapp standard we've got >>>> >>>> Am 25.11.2014 23:28 schrieb "Marc van Grootel" <marc.van.grootel at gmail.com>: >>>> >>>>> Hi, >>>>> >>>>> I would like to announce a new library (very alpha) called Fold. >>>>> >>>>> https://github.com/xokomola/fold >>>>> >>>>> It is a an HTTP routing library which provides an alternative way to >>>>> map HTTP requests to XQuery functions. In future I hope to use this >>>>> together with Origami to build REST services and small web apps. >>>>> >>>>> My main goal of announcing this is to get feedback on how to improve >>>>> this. Currently it is defined on top of RESTXQ but in future this >>>>> might be handled by a Java extension. There are parts missing still >>>>> and I strongly advise you not to use this for a serious project. >>>>> >>>>> Performance gets bad quite quickly. Performance gains may very well be >>>>> possible by XQuery refactorings. I basically wrote this as a port from >>>>> a couple of Clojure libraries. >>>>> >>>>> A bit of documentation for this library and for Origami can be found >>>>> in each project's wiki. Note that I only just started these and they >>>>> are not complete. >>>>> >>>>> I'll be working on this library over the next month to get it into a >>>>> more usable shape. >>>>> >>>>> Happy to receive comments and improvements. >>>>> >>>>> --Marc >>> >>> >>> >>> -- >>> --Marc
-- --Marc
CG
Christian Grün1 Dec 2014 17:34 #
Maybe we could check out what's the JAX-RS way of doing this. So far, it has always been a good advice to do it the same way.
Quoted text · Marc van Grootel · 106 lines
On Mon, Dec 1, 2014 at 5:24 PM, Marc van Grootel <marc.van.grootel at gmail.com> wrote: > Hi Christian, > > %rest:ANY would route all HTTP methods through that function. > Basically saying I don't care which method you call me with. So it has > nothing to do with the paths. > > Hth > > --Marc > > On Mon, Dec 1, 2014 at 4:52 PM, Christian Grün > <christian.gruen at gmail.com> wrote: >> Hi Max, hi Marc, >> >> The %rest:path annotation in BaseX 8.0 allows regular expressions [1]; >> I guess this is what you need? >> >> Best, >> Christian >> >> [1] http://docs.basex.org/wiki/RESTXQ#Paths >> >> >> >> On Mon, Dec 1, 2014 at 3:51 PM, Maximilian Gärber <mgaerber at arcor.de> wrote: >>> I guess this request is reasonable: >>> >>> https://github.com/xokomola/fold/blob/master/webapp/fold/adapter/basex-restxq.xqm#L152 >>> >>> @Christian: would %rest:ANY or some sort of wildcard notion be possible? >>> >>> Regards, >>> >>> Maxi >>> >>> >>> >>> >>> 2014-11-26 22:12 GMT+01:00 Marc van Grootel <marc.van.grootel at gmail.com>: >>>> I agree. I'm not using Fold at work either ;-) and I'm also not >>>> knocking RESTXQ in any way as, yes, it's the closest to a standard and >>>> has many implementations. >>>> >>>> I do think that experimenting with other approaches is good. Some >>>> languages use something like Fold with great success and uptake. Often >>>> as a base library on top of which other routing libraries/DSL's are >>>> created fostering even more diverse approaches. >>>> >>>> For the time being this will stay based on RESTXQ and stay away from >>>> Java but it does feel clumsy and duplicating basic HTTP request >>>> plumbing. >>>> >>>> ah well.... we'll see ... >>>> >>>> --Marc >>>> >>>> >>>> On Wed, Nov 26, 2014 at 9:49 PM, Maximilian Gärber <mgaerber at arcor.de> wrote: >>>>> +1 >>>>> >>>>> I'd keep using restxq - maybe without the need for servlets sometime but it >>>>> is the closest to a xquery webapp standard we've got >>>>> >>>>> Am 25.11.2014 23:28 schrieb "Marc van Grootel" <marc.van.grootel at gmail.com>: >>>>> >>>>>> Hi, >>>>>> >>>>>> I would like to announce a new library (very alpha) called Fold. >>>>>> >>>>>> https://github.com/xokomola/fold >>>>>> >>>>>> It is a an HTTP routing library which provides an alternative way to >>>>>> map HTTP requests to XQuery functions. In future I hope to use this >>>>>> together with Origami to build REST services and small web apps. >>>>>> >>>>>> My main goal of announcing this is to get feedback on how to improve >>>>>> this. Currently it is defined on top of RESTXQ but in future this >>>>>> might be handled by a Java extension. There are parts missing still >>>>>> and I strongly advise you not to use this for a serious project. >>>>>> >>>>>> Performance gets bad quite quickly. Performance gains may very well be >>>>>> possible by XQuery refactorings. I basically wrote this as a port from >>>>>> a couple of Clojure libraries. >>>>>> >>>>>> A bit of documentation for this library and for Origami can be found >>>>>> in each project's wiki. Note that I only just started these and they >>>>>> are not complete. >>>>>> >>>>>> I'll be working on this library over the next month to get it into a >>>>>> more usable shape. >>>>>> >>>>>> Happy to receive comments and improvements. >>>>>> >>>>>> --Marc >>>> >>>> >>>> >>>> -- >>>> --Marc > > > > -- > --Marc
MG
Marc van Grootel1 Dec 2014 17:46 #
I'm only superficially aware of JAX-RS but I think that it didn't have this type of routing in mind when designed. AFAIKS there's only explicit verb annotations. When doing routing as I'm implementing in Fold it %rest:ANY would be a way of delegating the responsibility of finding the correct handler to the routing mechanism whereas JAX-RS seems to be designed more for the situation that you're wiring the handler directly to an explicit verb (or add multiple annotations). I could also imagine that it could be considered a somehow risky thing to do as %rest:ANY would not care which HTTP verb was used even a totally invented one. Same arguments might apply for RESTXQ. --Marc
Quoted text · Christian Grün · 113 lines
On Mon, Dec 1, 2014 at 5:34 PM, Christian Grün <christian.gruen at gmail.com> wrote: > Maybe we could check out what's the JAX-RS way of doing this. So far, > it has always been a good advice to do it the same way. > > > > On Mon, Dec 1, 2014 at 5:24 PM, Marc van Grootel > <marc.van.grootel at gmail.com> wrote: >> Hi Christian, >> >> %rest:ANY would route all HTTP methods through that function. >> Basically saying I don't care which method you call me with. So it has >> nothing to do with the paths. >> >> Hth >> >> --Marc >> >> On Mon, Dec 1, 2014 at 4:52 PM, Christian Grün >> <christian.gruen at gmail.com> wrote: >>> Hi Max, hi Marc, >>> >>> The %rest:path annotation in BaseX 8.0 allows regular expressions [1]; >>> I guess this is what you need? >>> >>> Best, >>> Christian >>> >>> [1] http://docs.basex.org/wiki/RESTXQ#Paths >>> >>> >>> >>> On Mon, Dec 1, 2014 at 3:51 PM, Maximilian Gärber <mgaerber at arcor.de> wrote: >>>> I guess this request is reasonable: >>>> >>>> https://github.com/xokomola/fold/blob/master/webapp/fold/adapter/basex-restxq.xqm#L152 >>>> >>>> @Christian: would %rest:ANY or some sort of wildcard notion be possible? >>>> >>>> Regards, >>>> >>>> Maxi >>>> >>>> >>>> >>>> >>>> 2014-11-26 22:12 GMT+01:00 Marc van Grootel <marc.van.grootel at gmail.com>: >>>>> I agree. I'm not using Fold at work either ;-) and I'm also not >>>>> knocking RESTXQ in any way as, yes, it's the closest to a standard and >>>>> has many implementations. >>>>> >>>>> I do think that experimenting with other approaches is good. Some >>>>> languages use something like Fold with great success and uptake. Often >>>>> as a base library on top of which other routing libraries/DSL's are >>>>> created fostering even more diverse approaches. >>>>> >>>>> For the time being this will stay based on RESTXQ and stay away from >>>>> Java but it does feel clumsy and duplicating basic HTTP request >>>>> plumbing. >>>>> >>>>> ah well.... we'll see ... >>>>> >>>>> --Marc >>>>> >>>>> >>>>> On Wed, Nov 26, 2014 at 9:49 PM, Maximilian Gärber <mgaerber at arcor.de> wrote: >>>>>> +1 >>>>>> >>>>>> I'd keep using restxq - maybe without the need for servlets sometime but it >>>>>> is the closest to a xquery webapp standard we've got >>>>>> >>>>>> Am 25.11.2014 23:28 schrieb "Marc van Grootel" <marc.van.grootel at gmail.com>: >>>>>> >>>>>>> Hi, >>>>>>> >>>>>>> I would like to announce a new library (very alpha) called Fold. >>>>>>> >>>>>>> https://github.com/xokomola/fold >>>>>>> >>>>>>> It is a an HTTP routing library which provides an alternative way to >>>>>>> map HTTP requests to XQuery functions. In future I hope to use this >>>>>>> together with Origami to build REST services and small web apps. >>>>>>> >>>>>>> My main goal of announcing this is to get feedback on how to improve >>>>>>> this. Currently it is defined on top of RESTXQ but in future this >>>>>>> might be handled by a Java extension. There are parts missing still >>>>>>> and I strongly advise you not to use this for a serious project. >>>>>>> >>>>>>> Performance gets bad quite quickly. Performance gains may very well be >>>>>>> possible by XQuery refactorings. I basically wrote this as a port from >>>>>>> a couple of Clojure libraries. >>>>>>> >>>>>>> A bit of documentation for this library and for Origami can be found >>>>>>> in each project's wiki. Note that I only just started these and they >>>>>>> are not complete. >>>>>>> >>>>>>> I'll be working on this library over the next month to get it into a >>>>>>> more usable shape. >>>>>>> >>>>>>> Happy to receive comments and improvements. >>>>>>> >>>>>>> --Marc >>>>> >>>>> >>>>> >>>>> -- >>>>> --Marc >> >> >> >> -- >> --Marc
-- --Marc

⚡Generated with XQuery