Hello,
I've implemented the custom error 404 page solution from 
http://www.mkyong.com/wicket/how-do-configure-404-error-page-in-wicket-solution/
http://www.mkyong.com/wicket/how-do-configure-404-error-page-in-wicket-solution/
. However, I noticed some strange behavior:

There is a home page with a modal window in it, so the page is not
stateless:

public class TestPage extends WebPage {

        public TestPage() {
        }

        @Override
        protected void onInitialize() {
                super.onInitialize();

                add(new ModalWindow("modal_window"));
        }
}


The custom error page is stateless: 

public class PageNotFound extends WebPage {

        public PageNotFound() {
            super();
    }

        public PageNotFound(IModel<?> model) {
            super(model);
    }

        public PageNotFound(PageParameters parameters) {
            super(parameters);
    }
}


The application class is: 

public class TestApplication extends WebApplication {
        public TestApplication() {
        }

        @Override
        protected void init() {
                super.init();

                ICompoundRequestMapper rootRequestMapper =
getRootRequestMapperAsCompound();
                rootRequestMapper.add(new MountedMapper("/home", 
TestPage.class));
                rootRequestMapper.add(new MountedMapper("/404", 
PageNotFound.class));
        }

        @Override
        public Class<? extends Page> getHomePage() {
                return TestPage.class;
        }
}

... and the web.xml:

        <filter>
                <filter-name>wicket.WicketWarp</filter-name>
                
<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
                <init-param>
                        <param-name>applicationClassName</param-name>
                        
<param-value>org.apache.wicket.TestApplication</param-value>
                </init-param>
        </filter>

        <filter-mapping>
                <filter-name>wicket.WicketWarp</filter-name>
                <url-pattern>/*</url-pattern>
                <dispatcher>REQUEST</dispatcher> 
                <dispatcher>ERROR</dispatcher>
        </filter-mapping>

        <error-page>
                <error-code>404</error-code>
                <location>/404</location>
        </error-page>

Since the home page is not stateless the page id is displayed also. When:

        rootRequestMapper.add(new MountedMapper("/404", PageNotFound.class));

is present in the TestApplication the id of the home page is incremented by
2 each time the page is displayed (home?0, home?2, home?4..). When the error
page mapping is commented the id is incremented by 1 (as expected). From I
was able to trace in the wicket code on each request for the home page, also
a request for the error 404 custom page is made and because of this the id
is incremented by 2. Is this a normal behavior? Thanks in advance.
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Custom-error-404-page-and-page-id-s-tp3220118p3220118.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

Reply via email to