Hi,

I guess you have some broken link in your page.
This link makes request to the server, WicketFilter ignores it, then the web
container tries to handle it but again there is nothing to serve and finally
uses /404 for this resource, and here Wicket handles it and increments the
counter.

Put a breakpoint in WicketFilter#process() and see the url for this
broken/missing resource.

See below some comments

On Sun, Jan 16, 2011 at 5:04 PM, hok <[email protected]> wrote:

>
> 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));
>

you can use the shortcuts: mountPage("/home", TestPage.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: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to