users@jersey.java.net

Re: _at_RolesAllowed - Customizing error pages

From: tmp <le_tmp_at_gmx.de>
Date: Mon, 29 Nov 2010 06:05:19 -0800 (PST)

thank you very much!

i had some problems to insert a 404 page btw.
first i tried it like this:

if (r.getStatus() == 403 && r.getEntity() == null) {
            return Response.fromResponse(r).entity(new
Viewable("/error-pages/403", null)).build();
        }
else if (r.getStatus() == 403 && r.getEntity() == null) {
            return Response.fromResponse(r).entity(new
Viewable("/error-pages/404", null)).build();
        }


it worked for the 403 exception but not for the 404. so i had to change the
code a bit:

  if (r.getStatus() == 403 && r.getEntity() == null) {
            return Response.fromResponse(r).entity(new
Viewable("/error-pages/403", null)).build();
        }
        else if (r.getStatus() == 404 && r.getEntity() == null) {
            return Response.ok(new Viewable("/error-pages/404",
null)).build();
        }

can you explain that? it works fine, but i don't know why :)
thank you very much
-- 
View this message in context: http://jersey.576304.n2.nabble.com/RolesAllowed-Customizing-error-pages-tp5780105p5784411.html
Sent from the Jersey mailing list archive at Nabble.com.