You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Andrew Ducker <an...@ducker.org.uk> on 2013/04/14 11:09:12 UTC

Tools and Sessions

Odd one, that I'm hoping someone can clear up for me.

I created a tool, and added setters for:
public void setRequest(HttpServletRequest request)
and
public void setSession(HttpSession session)

The session is being passed in as "null", but request.getSession() is 
returning the session I'd expect to get.

Any idea why this would be?

(Running under Google App Engine, which doesn't seem to cause a problem 
otherwise.  But you never know...)

Andy

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Re: Tools and Sessions

Posted by Nathan Bubna <nb...@gmail.com>.
It's because by default it avoids session creation, passing in the
result of request.getSession(false).

You can configure your session toolbox to pass true and create
sessions.  See the examples at:
http://velocity.apache.org/tools/devel/config.html

(which i just noticed are all misformated. argh.)

On Sun, Apr 14, 2013 at 2:09 AM, Andrew Ducker <an...@ducker.org.uk> wrote:
> Odd one, that I'm hoping someone can clear up for me.
>
> I created a tool, and added setters for:
> public void setRequest(HttpServletRequest request)
> and
> public void setSession(HttpSession session)
>
> The session is being passed in as "null", but request.getSession() is
> returning the session I'd expect to get.
>
> Any idea why this would be?
>
> (Running under Google App Engine, which doesn't seem to cause a problem
> otherwise.  But you never know...)
>
> Andy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org