Hi Dirk,

initialization may now be triggered when asking a page for #isPageStateless(), this is done to be sure to catch stateful components added lately in #onInitialize().

RequestAdapter#commitRequest() detaches the page first before testing statefulness:

                try
                {
                    page.detach();
                }
                catch (Exception e)
                {
                    log.error("Error detaching page", e);
                }

                boolean isPageStateless;
                try
                {
                    isPageStateless = page.isPageStateless();
                }
                catch (Exception x)
                {
log.warn("An error occurred while checking whether a page is stateless. Assuming it is stateful.", x);
                    isPageStateless = false;
                }

Seems your page wasn't initialized previously and your model throws away something in #onDetach()?

Sven


On 07/09/2013 11:40 AM, Dirk Forchel wrote:
I've a question regarding this issue
https://issues.apache.org/jira/browse/WICKET-5083 and
Commit:34f43642195058f375d161dbb7cec58b40711423. This commit changed the
behavior of our application (I used git:bisect to pinpoint the changes
made). From this revision on, our application does not behave as expected.
Requests to the root segment are forwarded to the home page which results in
an exception.
For example:
http://localhost:8080/ results in http://localhost:8080/de/home
We use a LanguageMapper to resolve the language from the request. The
language is a persistent item in our database. Therefore we need a
transaction to the database which is started/committed in a subclass of
AbstractRequestCycleListener (#onRequestHandlerResolved,
onRequestHandlerExecuted).
I assume, that during the redirect all components are initialized allthough
they should not. Am I right or do I miss something? How can I prevent this?

The stacktrace looks similiar to:

WARN [RequestAdapter] An error occurred while checking whether a page is
stateless. Assuming it is stateful.
java.lang.IllegalStateException: there is no transaction bound to this
thread
at org.foo.model.Model.currentTransaction(Model.java:657)
at org.foo.model.Item.getEntity(Item.java:451)
at org.foo.model.Item.getEntity(Item.java:446)
at org.foo.model.FunctionField.get(FunctionField.java:237)
at org.foo.model.Language.getIsoCode(Language.java:948)
at org.foo.wicket.pages.Document.createXHTMLNameSpace(Document.java:166)
at org.foo.wicket.pages.Document.initComponents(Document.java:134)
at org.foo.wicket.pages.Document.onInitialize(Document.java:118)
at
org.foo.wicket.pages.AbstractBasePage.onInitialize(AbstractBasePage.java:85)
at org.foo.wicket.pages.HomePage.onInitialize(HomePage.java:106)
at org.apache.wicket.Component.fireInitialize(Component.java:863)
at
org.apache.wicket.MarkupContainer.internalInitialize(MarkupContainer.java:955)
at org.apache.wicket.Page.isPageStateless(Page.java:451)
at
org.apache.wicket.page.RequestAdapter.commitRequest(RequestAdapter.java:166)



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/WICKET-5083-and-Page-isPageStateless-tp4660166.html
Sent from the Users forum mailing list archive at Nabble.com.

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



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

Reply via email to