You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Jean-Baptiste Quenot <jb...@apache.org> on 2007/03/14 15:24:21 UTC

Adding a PageNotFoundPage?

Currently we have:

* AccessDeniedPage
* ExceptionErrorPage
* InternalErrorPage
* PageExpiredErrorPage

But we don't have a page to report an URL that does not point to
an existing resource.  What about adding that?

For example it would be needed here:
PackageRequestTargetUrlCodingStrategy should interrupts the cycle
and sends a 404 when a page/class cannot be found
http://issues.apache.org/jira/browse/WICKET-293

It would be needed in some other places as well I guess.

Cheers,
-- 
     Jean-Baptiste Quenot
aka  John Banana   Qwerty
http://caraldi.com/jbq/

Re: Adding a PageNotFoundPage?

Posted by Al Maw <wi...@almaw.com>.
Igor Vaynberg wrote:
> well yes, but jbq was saying we should create a special page for when this
> happens. and i disagreed. and then you disagreed with me, so are you
> agreeing with jbq?

I'm agreeing with you. <grin>
This stuff is so much easier to do on IRC / IRL. :)

     <AlMaw> Well, it should probably be like this:
     <AlMaw> If you're using WicketServlet, serve a 404.
     <AlMaw> If you're using WicketFilter, let it fall through and
             let the container deal with it.
<ivaynberg> agreed
     <AlMaw> As the container will do it for you.
     <AlMaw> In a way it won't for the servlet, obviously.
     <AlMaw> If you're using WicketFilter then you need an <error-page>
             mapping in your web.xml
     <AlMaw> Unless you're happy with the default container 404 page.
     <AlMaw> In which case, fine.
<ivaynberg> I think I confused filter and servlet
<ivaynberg> darn

So, erm, yeah. :-)

I'm not against a PageNotFound page for the WicketServlet. I think the 
user should provide one for the filter case if they're not happy with 
the default container one. I guess we need a setting for a servlet-based 
one so the user can customise it.

Al

Re: Adding a PageNotFoundPage?

Posted by Igor Vaynberg <ig...@gmail.com>.
well yes, but jbq was saying we should create a special page for when this
happens. and i disagreed. and then you disagreed with me, so are you
agreeing with jbq?

-igor


On 3/14/07, Al Maw <wi...@almaw.com> wrote:
>
> Igor Vaynberg wrote:
> > errr, no!
> >
> > what if iswicketurl does return true? maybe you do ?bookmarkablePage=
> > some.FooBarPage
> >
> > and FooBarPage does not exist. what to do then? we should just set the
> > header to 404 and let the chain continue
>
> Hmmm. Shouldn't we leave it all alone and just let the request fall
> through to lower in the chain? I'm pretty sure that's what we should do.
> The default servlet will then look for a resource called
> ?bookmarkablePage=some.FooBarPage on the filesystem under the context
> root, fail to find it, and 404 that.
>
> You'll need an <error-page> set up in the filter case either way, I'd
> have thought.
>
> Al
>

Re: Adding a PageNotFoundPage?

Posted by Al Maw <wi...@almaw.com>.
Igor Vaynberg wrote:
> errr, no!
> 
> what if iswicketurl does return true? maybe you do ?bookmarkablePage=
> some.FooBarPage
> 
> and FooBarPage does not exist. what to do then? we should just set the
> header to 404 and let the chain continue

Hmmm. Shouldn't we leave it all alone and just let the request fall 
through to lower in the chain? I'm pretty sure that's what we should do. 
The default servlet will then look for a resource called 
?bookmarkablePage=some.FooBarPage on the filesystem under the context 
root, fail to find it, and 404 that.

You'll need an <error-page> set up in the filter case either way, I'd 
have thought.

Al

Re: Adding a PageNotFoundPage?

Posted by Igor Vaynberg <ig...@gmail.com>.
errr, no!

what if iswicketurl does return true? maybe you do ?bookmarkablePage=
some.FooBarPage

and FooBarPage does not exist. what to do then? we should just set the
header to 404 and let the chain continue

-igor


On 3/14/07, Al Maw <wi...@almaw.com> wrote:
>
> Igor Vaynberg wrote:
> > erm no
> >
> > the important thing is that what we do is set the 404 header
> >
> > that way the filter chain knows its a 404 and can handle it properly
> >
> > as opposed to us happily streaming our own error page with a 200
>
> Errr, no. :-) We don't want to stream anything at all in the filter
> chain case.
>
> Currently WicketFilter looks to see if things match a Wicket
> page/request with isWicketRequest() (line 118 on WicketFilter) and
> leaves it the hell alone if it doesn't. Don't you go changing that to
> serve a 404 instead, or everyone's other servlet mappings and static
> resources and things will break.
>
> You can modify doGet() to serve a 404, that's fine. By that point, the
> filter thinks it's a Wicket request, so you probably should.
>
> In the filter case, one can achieve all this by mounting a 404 page, and
> using <error-page> to point to it. It certainly seems to cover all my
> use cases, and that way you can serve the same 404 page for non-Wicket
> URLs. I don't think you ever get 404 pages if something has passed the
> isWicketRequest() check.
>
> Al
>

Re: Adding a PageNotFoundPage?

Posted by Al Maw <wi...@almaw.com>.
Igor Vaynberg wrote:
> erm no
> 
> the important thing is that what we do is set the 404 header
> 
> that way the filter chain knows its a 404 and can handle it properly
> 
> as opposed to us happily streaming our own error page with a 200

Errr, no. :-) We don't want to stream anything at all in the filter 
chain case.

Currently WicketFilter looks to see if things match a Wicket 
page/request with isWicketRequest() (line 118 on WicketFilter) and 
leaves it the hell alone if it doesn't. Don't you go changing that to 
serve a 404 instead, or everyone's other servlet mappings and static 
resources and things will break.

You can modify doGet() to serve a 404, that's fine. By that point, the 
filter thinks it's a Wicket request, so you probably should.

In the filter case, one can achieve all this by mounting a 404 page, and 
using <error-page> to point to it. It certainly seems to cover all my 
use cases, and that way you can serve the same 404 page for non-Wicket 
URLs. I don't think you ever get 404 pages if something has passed the 
isWicketRequest() check.

Al

Re: Adding a PageNotFoundPage?

Posted by Igor Vaynberg <ig...@gmail.com>.
erm no

the important thing is that what we do is set the 404 header

that way the filter chain knows its a 404 and can handle it properly

as opposed to us happily streaming our own error page with a 200

-igor


On 3/14/07, Igor Vaynberg <ig...@gmail.com> wrote:
>
> exactly
>
> -igor
>
>
> On 3/14/07, Jean-Baptiste Quenot <jb...@apache.org> wrote:
> >
> > * Al Maw:
> >
> > > Err, if you  use a filter then you fall  through and do whatever
> > > the container does. Please don't break it for the filter case.
> >
> > So you say it's not a  good idea to throw a PageNotFoundException,
> > rather  ensure that  isWicketRequest()  returns false  to let  the
> > request flow to the next filter in the chain?
> > --
> >      Jean-Baptiste Quenot
> > aka  John Banana   Qwerty
> > http://caraldi.com/jbq/
> >
>
>

Re: Adding a PageNotFoundPage?

Posted by Igor Vaynberg <ig...@gmail.com>.
exactly

-igor


On 3/14/07, Jean-Baptiste Quenot <jb...@apache.org> wrote:
>
> * Al Maw:
>
> > Err, if you  use a filter then you fall  through and do whatever
> > the container does. Please don't break it for the filter case.
>
> So you say it's not a  good idea to throw a PageNotFoundException,
> rather  ensure that  isWicketRequest()  returns false  to let  the
> request flow to the next filter in the chain?
> --
>      Jean-Baptiste Quenot
> aka  John Banana   Qwerty
> http://caraldi.com/jbq/
>

Re: Adding a PageNotFoundPage?

Posted by Jean-Baptiste Quenot <jb...@apache.org>.
* Al Maw:

> Err, if you  use a filter then you fall  through and do whatever
> the container does. Please don't break it for the filter case.

So you say it's not a  good idea to throw a PageNotFoundException,
rather  ensure that  isWicketRequest()  returns false  to let  the
request flow to the next filter in the chain?
-- 
     Jean-Baptiste Quenot
aka  John Banana   Qwerty
http://caraldi.com/jbq/

Re: Adding a PageNotFoundPage?

Posted by Al Maw <wi...@almaw.com>.
Jean-Baptiste Quenot wrote:
> * Johan Compagner:
> 
>> What do  we now when  a bookmarkable page  is asked for  but not
>> found? just the 404? with nothing else?
> 
> Currently we  log an error and  return the error page  with status
> code 500, that's BAD!

Err, if you use a filter then you fall through and do whatever the 
container does. Please don't break it for the filter case.

Al

Re: Adding a PageNotFoundPage?

Posted by Johan Compagner <jc...@gmail.com>.
its an error :)

On 3/14/07, Jean-Baptiste Quenot <jb...@apache.org> wrote:
>
> * Johan Compagner:
>
> > What do  we now when  a bookmarkable page  is asked for  but not
> > found? just the 404? with nothing else?
>
> Currently we  log an error and  return the error page  with status
> code 500, that's BAD!
> --
>      Jean-Baptiste Quenot
> aka  John Banana   Qwerty
> http://caraldi.com/jbq/
>

Re: Adding a PageNotFoundPage?

Posted by Jean-Baptiste Quenot <jb...@apache.org>.
* Johan Compagner:

> What do  we now when  a bookmarkable page  is asked for  but not
> found? just the 404? with nothing else?

Currently we  log an error and  return the error page  with status
code 500, that's BAD!
-- 
     Jean-Baptiste Quenot
aka  John Banana   Qwerty
http://caraldi.com/jbq/

Re: Adding a PageNotFoundPage?

Posted by Johan Compagner <jc...@gmail.com>.
So when a bookmarkable page can't be found we throw that error?
We could do that but would that help a lot?
What do we now when a bookmarkable page is asked for but not found?
just the 404? with nothing else?

Maybe we could reusse the accessdenied?
(you are trying to get things that you shouldn't)

johan



On 3/14/07, Jean-Baptiste Quenot <jb...@apache.org> wrote:
>
> Currently we have:
>
> * AccessDeniedPage
> * ExceptionErrorPage
> * InternalErrorPage
> * PageExpiredErrorPage
>
> But we don't have a page to report an URL that does not point to
> an existing resource.  What about adding that?
>
> For example it would be needed here:
> PackageRequestTargetUrlCodingStrategy should interrupts the cycle
> and sends a 404 when a page/class cannot be found
> http://issues.apache.org/jira/browse/WICKET-293
>
> It would be needed in some other places as well I guess.
>
> Cheers,
> --
>      Jean-Baptiste Quenot
> aka  John Banana   Qwerty
> http://caraldi.com/jbq/
>