• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

SimpleMappingExceptionResolver and Spring filters

 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I may have run into a situation where exception mapping won't work in the context of using servlet filters. I'm attempting to use a combination of a DelegatingFilterProxy and the spring security components to enforce security over my web application. The problem I've run into is that I'm using the RequestHeaderPreAuthenticatedProcessingFilter to pull a header variable out of the request header as it's designed to do.

Also, as it's designed to do, it will throw an exception if the specified header is not found. I'd like to intercept that exeption and display a better page than a stack trace. Using the ExceptionResolver, I can't seem to intercept the exception at all. I think that's because this only configures the DispatcherServlet and the filter sits in front of that since I can't see any evidence of the dispatcher in the stack trace and as I'm debugging.

Anyone have an idea how to intercept the exceptions when they come from a filter? I've even tried configuring an entry in the web.xml file using the error page definition. At least it seems to intercept it but appears to fail in trying to serve up the page (not sure why since I can't get any additional information). My page is simply '/error.html'. I can get to the resource if I simply put it on the URL path but no luck during invocation of the filter. I've boiled it down to be as simple as possible. That should catch any exception of type java.lang.Exception, which does appear to happen. I must be missing something because this just seems like it should work... unless there's something going on with Tomcat (v6).



Thanks,

mark
 
reply
    Bookmark Topic Watch Topic
  • New Topic