Retrieve JSF session from a servlet

Hi all,

I have a downloadservlet where I need to check permission. Therefore I retrieve a backing bean by creating a FacesContext and get the bean from it like this:

FacesContext ctx = this.getFacesContext(request, response);

VariableResolver vr = ctx.getApplication().getVariableResolver();

getLog().debug("Got variableResolver: " + vr);

WebSession ws = (WebSession) vr.resolveVariable(ctx,"webSession");

However, because of an apparent JSF bug this doesn't always work.

Therefore: is it actually possible to retrieve jsf session variables (like the WebSession bean) from a servlet?

Thanks,

Steven

[711 byte] By [tombatorea] at [2007-11-27 11:23:45]
# 1

> However, because of an apparent JSF bug this doesn't always work.

Please elaborate.

> Therefore: is it actually possible to retrieve jsf session variables (like the

> WebSession bean) from a servlet?

If this bean is session scoped, then it is just available as an attribute of the HttpSession object.

BalusCa at 2007-7-29 15:53:30 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Yes it is on the session, so thank you for solving my apparently "simple" question ;)

I was actually about to ask something else already but couldn't edit anymore... you were pretty fast.

Thanks

tombatorea at 2007-7-29 15:53:30 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...