You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by EC <ch...@gmail.com> on 2010/10/15 08:25:15 UTC

Cannot create statless page

Hi,
I am trying to create a simple stateless app according to:
https://cwiki.apache.org/WICKET/stateless-pages.html
and the example in the source.

Whenever I access this page, wicket tries to get an instance of
javax.servlet.http.HttpSession. Our java server traps that and notifies via
an exception.
What is the way around it?
Do I need to implement ISessionStore myself?

Here is the source:

public class MyApplication extends WebApplication {
public Class getHomePage() {
return HomePage.class;
}
@Override
protected void init() {
super.init();
getResourceSettings().setResourcePollFrequency(null);
}
@Override
protected ISessionStore newSessionStore() {
return new HttpSessionStore(this);
}
}
public class HomePage extends WebPage {
public HomePage() {
add(new Label("label", new Model("Hello, World")));
}
}

<html>
<body>
<h1 wicket:id='label'>HELLO</h1>
</body>
</html>

Re: Cannot create statless page

Posted by Doug Leeper <do...@yahoo.com>.
Try adding setStatelessHint( true ) in the HomePage constructor.

public class HomePage extends WebPage {
    public HomePage() {
         add(new Label("label", new Model("Hello, World")));
         setStatelessHint( true );   // <----- new 
    }
} 
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Cannot-create-statless-page-tp2996566p2997184.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Cannot create statless page

Posted by Jeremy Thomerson <je...@wickettraining.com>.
On Fri, Oct 15, 2010 at 1:25 AM, EC <ch...@gmail.com> wrote:

> Hi,
> I am trying to create a simple stateless app according to:
> https://cwiki.apache.org/WICKET/stateless-pages.html
> and the example in the source.
>
> Whenever I access this page, wicket tries to get an instance of
> javax.servlet.http.HttpSession. Our java server traps that and notifies via
> an exception.
> What is the way around it?
> Do I need to implement ISessionStore myself?
>
> Here is the source:
>
> public class MyApplication extends WebApplication {
> public Class getHomePage() {
> return HomePage.class;
> }
> @Override
> protected void init() {
> super.init();
> getResourceSettings().setResourcePollFrequency(null);
> }
> @Override
> protected ISessionStore newSessionStore() {
> return new HttpSessionStore(this);
> }
> }
> public class HomePage extends WebPage {
> public HomePage() {
> add(new Label("label", new Model("Hello, World")));
> }
> }
>
> <html>
> <body>
> <h1 wicket:id='label'>HELLO</h1>
> </body>
> </html>
>

The session is always going to be created for every request (stateless or
not).  But, if the session wasn't bound during the request, it is temporary
and thrown away at the end of the request.

-- 
Jeremy Thomerson
http://www.wickettraining.com