You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Jürgen Lind <Ju...@iteratec.de> on 2012/04/27 09:41:16 UTC
Stateless Page Question
Hi,
I'm a bit confused with stateless pages and maybe somebody can shed light on this...
I have a (currently) empty mounted WebPage that is later supposed to serve as a
health-check page and will thus be called frequently. Now, if a do a simple wget
with the page URL, my RequestCycleListener tells me, that a new session was created.
I use the following code for this check:
if (((ServletWebRequest) RequestCycle.get().getRequest()).getContainerRequest().getSession()
.isNew()) {
logger.info("New session started");
}
Now, since the page should not be bound to a session and will be called very often, I would
rather not have the overhead of session creation for each request. Is there something I am
missing?
Jürgen
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Stateless Page Question
Posted by Jürgen Lind <Ju...@iteratec.de>.
Oh, sorry for the stupid question. Obviously, I haven't done raw servlet
programming for a while...
J.
On 27.04.2012 09:50, Martin Grigorov wrote:
> From HttpServletRequest javadocs:
>
> HttpSession getSession()
> Returns the current session associated with this request, or if the
> request does not have a session, creates one.
>
> Use getSession(false) instead.
>
> To keep the page stateless you may use wicket-devutils
> StatelessChecker in Dev mode.
>
> On Fri, Apr 27, 2012 at 10:41 AM, Jürgen Lind<Ju...@iteratec.de> wrote:
>> Hi,
>>
>> I'm a bit confused with stateless pages and maybe somebody can shed light on
>> this...
>> I have a (currently) empty mounted WebPage that is later supposed to serve
>> as a
>> health-check page and will thus be called frequently. Now, if a do a simple
>> wget
>> with the page URL, my RequestCycleListener tells me, that a new session was
>> created.
>> I use the following code for this check:
>>
>> if (((ServletWebRequest)
>> RequestCycle.get().getRequest()).getContainerRequest().getSession()
>> .isNew()) {
>> logger.info("New session started");
>> }
>>
>> Now, since the page should not be bound to a session and will be called very
>> often, I would
>> rather not have the overhead of session creation for each request. Is there
>> something I am
>> missing?
>>
>> Jürgen
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
>
Mit freundlichen Grüßen,
Jürgen Lind
--
Dr. Jürgen Lind
iteratec GmbH Fon: +49 (0)89 614551-44
Inselkammerstrasse 4 Fax: +49 (0)89 614551-10
82008 Unterhaching Web: www.iteratec.de
Sitz und Registergericht der iteratec GmbH: München HRB 113 519
Geschäftsführer: Klaus Eberhardt, Mark Goerke, Inge Hanschke, Ralf Menzel
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Stateless Page Question
Posted by Martin Grigorov <mg...@apache.org>.
>From HttpServletRequest javadocs:
HttpSession getSession()
Returns the current session associated with this request, or if the
request does not have a session, creates one.
Use getSession(false) instead.
To keep the page stateless you may use wicket-devutils
StatelessChecker in Dev mode.
On Fri, Apr 27, 2012 at 10:41 AM, Jürgen Lind <Ju...@iteratec.de> wrote:
> Hi,
>
> I'm a bit confused with stateless pages and maybe somebody can shed light on
> this...
> I have a (currently) empty mounted WebPage that is later supposed to serve
> as a
> health-check page and will thus be called frequently. Now, if a do a simple
> wget
> with the page URL, my RequestCycleListener tells me, that a new session was
> created.
> I use the following code for this check:
>
> if (((ServletWebRequest)
> RequestCycle.get().getRequest()).getContainerRequest().getSession()
> .isNew()) {
> logger.info("New session started");
> }
>
> Now, since the page should not be bound to a session and will be called very
> often, I would
> rather not have the overhead of session creation for each request. Is there
> something I am
> missing?
>
> Jürgen
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org