Announcement Announcement Module
No announcement yet.
Upon AccessDeniedException Get URL Accessed Page Title Module
Move Remove Collapse
This topic is closed
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Upon AccessDeniedException Get URL Accessed

    Hi all,

    I have setup Acegi, but when I get an AccessDeniedException and the handler calls the configured JSP page, I would like to know what URL caused the problem. Is this available in the active scope of the SecurityContext? The call to request.getRequestURL() or getRequestURI() only returns the name of the JSP that I have configured to handle the exception.


  • #2
    I don't think you know this information, you'd have to code this yourself.


    • #3
      Thanks for the help. I'll take a deeper look into it when I get some more time.


      • #4
        Ok, getting back to this it seems one has to implement the org.acegisecurity.ui.AccessDeniedHandler interface or override the actual implementation class being used (AccessDeniedHandlerImpl). Inside the implementation one can get access to the necessary information then implement home grown logic (prob not recommended) or call the acegi superclass' handle method (making sure to call the superclass after doing nec. work since the superclass commits the response). Once done, make sure to configure the handler in the Spring XML configuration if using Acegi within Spring (prob the handler for an ExceptionTranslationFilter). Pretty straightforward, hth