Using tapestry 4 and an application state object holding user
information I would like to write some code that does X when the user
is logged in and Y otherwise. Also I would like to remain stateless
for as long as possible for performance reasons.
In tapestry 3 I would do something like this:
if(visit != null && visit.isAuthenticated()) {
} else { ... }
In tapestry 4 I have the nice option of injecting the user data ASO
into my page and calling getUserData() to retrieve it. The problem is
that as soon as I call getUserData() it will cause my application to
go stateful. The only method I have seen to avoid this is to use the
StateObjectPersistenceManager to determine if that ASO exists. The
problem with this approach is that I cant inject the ASO into my page
so I am forced to retrieve it myself then cast it to the correct type
and continue my logic:
if (sessionScopeManager.exists(name) &&
((UserData)sessionScopeManager.get(name, null)).isAuthenticated()) {
} else {...}
I think we all can agree that this syntax is less than desirable and
quite a pain for such a common operation.
Is there a better way to accomplish this using tapestry 4 as it is
today or would it be a nice to have to be able to inject a property
with null if the ASO has not been created yet?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]