Announcement Announcement Module
No announcement yet.
Redirect to 403 if formBackingObject should not be retrieved. Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Redirect to 403 if formBackingObject should not be retrieved.

    I have several pages that accept a request parameter eg. where the id represents the object to be retrieved from the database (using SimpleFormController). Currently I have code that determines if the remote user has adequate permissions to access the object, and if successful the formBackingObject is populated. What I would like to do is forward/redirect to either a 403 or custom error page in the event that the user is not permitted to view/retrieve the object.
    Is there a way of redirecting from within formBackingObject, or should I use AbstractFormController and handle the redirection via the showForm method?

  • #2
    You can throw some specific exception type from the controller. In web.xml, that exception type can be mapped to a specific error url that renders a 403 response or whatever custom error page.


    • #3
      See this post