Erlang/OTP Forums

Author Message

<  Yaws mailing list  ~  Merging arg_rewrite and appmods (was does yaws_vdir work?)

Guest
Posted: Mon Feb 11, 2008 10:13 pm Reply with quote
Guest
Actually, would it not be nice to have one API for both "request"
(arg_rewrite) and "reply" (appmods) modules? Something like:

handle({Request,Reply}) -> {NewRequest, NewReply}
Request = #arg
Reply = same as out/1 function returns today (maybe with some new tags)

In this way it would be possible to nest, chain or connect modules in
different manners. These could be specialized for different tasks like vdirs,
authorization, proxies etc. Simple chaining example:

handle(ReqReply) ->
handle(ReqReply,[vdir_module, authorize_module, route_module]).

handle(ReqReply, []) -> ReqReply;
handle({Req,{quit, Reply}},_) -> {Req,Reply}; % Just to get out from any mod
handle(ReqReply,[M|T]) -> handle(M:handle(ReqReply),T).

I think Restlet (a Java based REST framework, http://www.restlet.org/) has
something of this approach using a uniform interface for all type
of "restlets". Using parameterized Erlang modules could be one way to do a
similar "wiring", connecting modules together - maybe:
http://planeterlang.org/story.php?title=The_black_art_of_Erlangs_parameterized_modules

I am not sure how easily this concept plugs into the existing Yaws
infrastructure though.

Mikael

Friday 25 January 2008 22:51:10 skrev Mikael Karlsson:
> I think Klacke has given you the best answer, but you can chain
> arg_rewrite_mods by writing your own arg_rewrite_mod:
>
> -module(my_mod).
> -export([arg_rewrite/1]).
>
> arg_rewrite(Arg) -> yapp:arg_rewrite(yaws_vdir:arg_rewrite(Arg)).
> or ..
> arg_rewrite(Arg) -> arg_rewrite(Arg,[yaws_vdir,yapp]).
>
> arg_rewrite(Arg,[]) -> Arg;
> arg_rewite(Arg,[M|T]) -> arg_rewrite(M:arg_rewrite(Arg),T).
>
> I guess it can be a bit tricky to know in which docroot you will end up
> eventually though...
>
> Regards
> Mikael
>
> Thursday 24 January 2008 12:45:22 Claes Wikstrom wrote:
> > Steve Vinoski wrote:
> > > I was hoping to use a URL rewrite to return a local file, so I tried
> > > to get the yaws_vdir module compiled, installed, and configured, but
> > > no luck. This particular server is eventually going to need yapp
> > > configured as its arg_rewrite_mod, so I'm not sure I can use yaws_vdir
> > > anyway.
> >
> > Yapp and vdirs - I really can tell.
> >
> > > Are there any Yaws funs I can call internally from appmod code
> > > to just send a file back to the client in a way that takes care of
> > > HTTP headers such as ETag, Last-modified, If-modified-since, etc.? I
> > > looked around and saw some candidates but they looked internal to the
> > > module they were in.
> >
> > The appmod return values
> >
> > {page, Page}
> > {page, {Options, Page}}
> >
> > Are meant to cater for this.
> >
> >
> > /klacke
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Erlyaws-list mailing list
> Erlyaws-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/erlyaws-list




-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist
yeti
Posted: Sat Sep 01, 2012 6:03 am Reply with quote
User Joined: 01 Sep 2012 Posts: 17 Location: fgf
discount designer *beep* come in different shapes and styles such as The HOBO, Satchel, and Tote bag. With all these shapes and sizes you are sure to find the one that suits you best, whether it be a celebrity fashion discount *beep* or a tote bag. Fashion bags come in a variety of sizes so you are able to put what you need in your bag or even just carry it around for that great new look.
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum