Hi!
As I said, in this case, what you consider dangerous I consider safe and
vice-versa. Just different opinions. :) I agree that there's no completely
safe option. Both have their pros and cons. And I don't consider
@SessionState data-dangerous at all. I'd never use non-specific object
types with it, though, such as collections, string or numbers, just
classes belonging to the project being developed.
On Thu, 06 Jan 2011 18:24:25 -0200, Michael Gentry <mgen...@masslight.net>
wrote:
Hi Thiago,
You argue that @SessionState is type-safe, but it is data-dangerous.
Is that a good trade-off? I personally want my data to be safe, too.
:-)
Also, If I do:
@SessionAttribute("user")
private String user;
On something that was already set to be a User record (instead of a
string), it'll blow up immediately with a class cast exception. (Or
vice-versa.) That at least seems safer to me. Ideally I'd prefer
something more safe, but that doesn't seem to be an option, currently.
Also, I'm planning on using more verbose keys than "user". That's
just a convention, though, and not a guarantee of safety.
Thanks!
mrg
On Thu, Jan 6, 2011 at 2:45 PM, Thiago H. de Paula Figueiredo
<thiag...@gmail.com> wrote:
On Thu, 06 Jan 2011 17:21:32 -0200, Michael Gentry
<mgen...@masslight.net>
wrote:
I'd like to suggest that @SessionState be deprecated in favor of
@SessionAttribute in the future.
I'm completely against. @SessionState has been used as it is since
Tapetry 5
exists. I think @SessionAttribute is dangerous for almost the same
arguments
you use against @SessionState. One thing that I loved in Tapestry,
coming
from a Struts (argh!) background, was that @SessionState avoids the
problem
of having different parts of the code ending up using the same session
attribute name for very different things (including storing different
object
types). @SessionState is type-safe, @SessionAttribute isn't (if one page
stores a string in the "user" session attribute and then another one
has a
@SessionAttribute("user") private User user; field, unless you provided
a
CoercionTuple<String, User>, it will probably fail).
Conclusion: what is a heaven for one can be a hell for another. :)
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant,
developer, and
instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
Consultor, desenvolvedor e instrutor em Java, Tapestry e Hibernate
Coordenador e professor da Especialização em Engenharia de Software com
Ênfase em Java da Faculdade Pitágoras
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org