On Thu, 13 Nov 2014 12:16:03 -0200, Ivano Luberti <lube...@archicoop.it>
wrote:
Hi all, I have a question about session handling in Tapestry5.
I have a
@SessionState
protected User user;
Shouldn't it be @SessionState(create = false) so user isn't instantiated
automatically and is null until you set the field?
that works as expected
I wanted to perform some cleanup when calling a logout link: the action
link listener is made as this:
public Object onActionFromLink() {
requestGlobals.getHTTPServletRequest().getSession().invalidate();
return Index.class;
}
You can (and should) @Inject Request. There's absolutely no reason in the
last 5 years to use RequestGlobals to get the request object. You can also
@Inject HttpServletRequest and HttpServletResponse directly if needed.
@Inject
private Request request;
...
Session session = request.getSession(false);
if (session != null) {
session.invalidate();
}
I don't know if this is important (I guess not) but the method is in a
component and not direclty in a page (so that I can render the link only
in protected pages )
No difference. Please change the @SessionState usage as I suggested and
try again.
--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org