cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ard Schrijvers" <a.schrijv...@hippo.nl>
Subject RE: Test Session attribute exists from the sitemap
Date Wed, 03 Jan 2007 15:48:18 GMT


> Dev at weitling napisaƂ(a):
> > But what if you have an existing variable containing an 
> empty string as
> > value?
> That is way I called "hacky", it will work correctly except the
> situation you mentioned. More reliable way would be changing a little
> bit RequestParameterExistsAction[1] to check session attrs instead of
> request parameter or write own action (few lines of code really).

I think many of the problems that I see in general about being "logged in" or having some
session-attr boil down to two possible site behavior:

1) you want to redirect the user to a login page
2) you want to show a different page (from a different sitemap) for the not loggedin user
versus the loggedin user.

Right? You can solve this pretty solid and reuse the solution many times, without polluting
your main sitemap with {session-attr}, map:selects and redirects and actions, etc etc

So, in your main (working) sitemap, you have only one matcher:

<map:match type="loggedin">
    <map:mount src="{src}" uri-prefix="{uri-prefix}"/>
</map:match>

now, add 
<map:matcher logger="sitemap.matcher.loggedin" name="loggedin" src="foo.bar.cocoon.matching.LoggedinMatcher"/>

LoggedinMatcher extends Matcher

Now 

result.put("uri-prefix", "");
result.put("src", getDir() );
return result;

and the getDir() returns the subsitemap dirs of either the loggedin person (if some session
is correct/fileed) or the other one, of the not loggedin person. 

C'est tout

Regards Ard

> 
> -- 
> Grzegorz Kossakowski
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 
Mime
View raw message