From: Filippo P. (S.G. Consulting) <pa...@sg...> - 2006-09-06 08:17:23
|
I've done it using appmods like this. %% root directory resource_matcher([]) -> fun root_resource/1; %% root directory resource_matcher(Url) when Url =3D=3D "/" -> fun root_resource/1; %% matches "/desiredurl" resource_matcher(Url) when Url =3D=3D "/desiredurl" -> fun desired_resource/1; %% matches urls like "/url/123" %% print some debug ionfo if match fails resource_matcher(Url) -> {Base, Id} =3D lists:split(length("/url/"), Url), case Base of "/url/" -> url_resource(list_to_integer(Id)); _ -> fun debug_data/1 end. out(A) -> Resource =3D resource_matcher(A#arg.appmoddata), Resource(A). filippo Claes Wikstr=F6m wrote: > Chris Campbell wrote: >> Hi, >> >> I'm reading Software Engineering for Internet Applications by P. >> Greenspun et al. which describes "abstract urls". Basically, URLs >> with no extension which the server tries to find a file for. In it's >> simplest form, it tries extensions or directories. Is there a >> facility like this built in to yaws? I've been messing around with >> appmods to do this, but am wondering if there are any functions in >> yaws which do this already. >=20 > I think appmods are the best way to implement this. Using appmods > we get explicit and detailed control over the URL. >=20 > /klacke >=20 |