Announcement Announcement Module
Collapse
No announcement yet.
Redirect to 403 if formBackingObject should not be retrieved. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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. http://host.com/product.htm?id=123 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.

    Comment


    • #3
      See this post

      http://forum.springframework.org/showthread.php?t=22922

      Comment

      Working...
      X