You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by chickabee <ja...@gmail.com> on 2007/09/09 18:18:04 UTC

[Wicket] Vs [HTTP 404 - File not found]

Hi Guys, 

What is the preferred strategy for  customization of error page under HTTP
404 - File not found  situations, any helpful pointer will be appreciated.

At present i have used error directive in web.xml and I wonder how should i
go about it, if i want to handle this from within wicket.

Thanks


-- 
View this message in context: http://www.nabble.com/-Wicket--Vs---HTTP-404---File-not-found--tf4409883.html#a12580317
Sent from the Wicket - User 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: [Wicket] Vs [HTTP 404 - File not found]

Posted by Andrew Klochkov <a....@webalta-team.com>.
Al Maw wrote:
> You probably need to write a servlet filter that wraps the entire 
> request that sets the encoding:
WicketFilter does exactly the same thing, but the response encoding is 
already set (by container?) so it remains wrong.
It seems like the approach Igor mentioned works only if you use 
ISO-8859-1 for your pages (at least under tomcat 5.5).

>
> public class CharsetFilter implements Filter {
>
>     public void init(FilterConfig config) throws ServletException {}
>     public void destroy() {}
>
>     public void doFilter(ServletRequest request,
>             ServletResponse response, FilterChain chain)
>         throws IOException, ServletException
>     {
>         request.setCharacterEncoding("UTF-8");
>         chain.doFilter(request, response);
>     }
> }
>


-- 
Andrew Klochkov


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


Re: [Wicket] Vs [HTTP 404 - File not found]

Posted by Al Maw <wi...@almaw.com>.
Andrew Klochkov wrote:
> Igor Vaynberg wrote:
>> http://herebebeasties.com/2006-12-20/using-a-servlet-filter-for-404-error-page/ 
> 
> I tried this approach under tomcat 5.5.17 but got problems with 
> character encoding. When WicketFilter gets the request to the correct 
> page (defined in the web.xml error-page/location) the request encoding 
> is already set (by tomcat?) to ISO-8859-1 and wicket can't change it. So 
> user gets a page with wrong encoding :-( Googling for the solution 
> didn't help.

You probably need to write a servlet filter that wraps the entire 
request that sets the encoding:

public class CharsetFilter implements Filter {

     public void init(FilterConfig config) throws ServletException {}
     public void destroy() {}

     public void doFilter(ServletRequest request,
             ServletResponse response, FilterChain chain)
         throws IOException, ServletException
     {
         request.setCharacterEncoding("UTF-8");
         chain.doFilter(request, response);
     }
}

-- 
Alastair Maw
Wicket-biased blog at http://herebebeasties.com

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


Re: [Wicket] Vs [HTTP 404 - File not found]

Posted by Andrew Klochkov <a....@webalta-team.com>.
Igor Vaynberg wrote:
> http://herebebeasties.com/2006-12-20/using-a-servlet-filter-for-404-error-page/
>
>   
Igor,

I tried this approach under tomcat 5.5.17 but got problems with 
character encoding. When WicketFilter gets the request to the correct 
page (defined in the web.xml error-page/location) the request encoding 
is already set (by tomcat?) to ISO-8859-1 and wicket can't change it. So 
user gets a page with wrong encoding :-( Googling for the solution 
didn't help.

-- 
Andrew Klochkov


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


Re: [Wicket] Vs [HTTP 404 - File not found]

Posted by Igor Vaynberg <ig...@gmail.com>.
http://herebebeasties.com/2006-12-20/using-a-servlet-filter-for-404-error-page/

-igor


On 9/9/07, chickabee <ja...@gmail.com> wrote:
>
>
> Hi Guys,
>
> What is the preferred strategy for  customization of error page under HTTP
> 404 - File not found  situations, any helpful pointer will be appreciated.
>
> At present i have used error directive in web.xml and I wonder how should
> i
> go about it, if i want to handle this from within wicket.
>
> Thanks
>
>
> --
> View this message in context:
> http://www.nabble.com/-Wicket--Vs---HTTP-404---File-not-found--tf4409883.html#a12580317
> Sent from the Wicket - User 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: [Wicket] Vs [HTTP 404 - File not found]

Posted by Andrew Klochkov <a....@webalta-team.com>.
Martijn Dashorst wrote:
>
> But yes, you need to do some special processing to make the page
> bigger than N bytes (512?) before IE thinks it can do better than you.
>   
Oops :-) Sorry, of course I meant 512 bytes :-)

-- 
Andrew Klochkov


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


Re: [Wicket] Vs [HTTP 404 - File not found]

Posted by Martijn Dashorst <ma...@gmail.com>.
On 9/10/07, Andrew Klochkov <a....@webalta-team.com> wrote:
> the response bigger than 512Kb, so IE doesn't show it's friendly 404

I hope I don't have to download half a meg to find out my original
request couldn't be found ;)

But yes, you need to do some special processing to make the page
bigger than N bytes (512?) before IE thinks it can do better than you.

Martijn


-- 
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.0-beta3 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta3/

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


Re: [Wicket] Vs [HTTP 404 - File not found]

Posted by Andrew Klochkov <a....@webalta-team.com>.
Hi,

I don't know the best way but we just created error404.html which 
forwards to the home page. Notice that several lines of dots - they make 
the response bigger than 512Kb, so IE doesn't show it's friendly 404 
page. Please share your expirience if you have a better way to handle it :-)

<html>
<head>
    <meta http-equiv="Refresh" content="0; url=/main">
</head>
<body>
<p style="display:none">
    
................................................................................................
    
................................................................................................
    
................................................................................................
    
................................................................................................
    
................................................................................................
    
................................................................................................
</p>
</body>
</html>


chickabee wrote:
> Hi Guys, 
>
> What is the preferred strategy for  customization of error page under HTTP
> 404 - File not found  situations, any helpful pointer will be appreciated.
>
> At present i have used error directive in web.xml and I wonder how should i
> go about it, if i want to handle this from within wicket.
>
> Thanks
>
>
>   


-- 
Andrew Klochkov


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