Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-2726

FilterDispatcher: Catch RedirectException to issue 30x code

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Won't Do
    • None
    • None
    • Dispatch Filter
    • None

    Description

      When creating my own implementation of ActionMapper, I have no way to tell the FilterDispatcher to redirect to a different page. I am creating an alias in effect.

      Here's what is going on:
      1. I invoke the superclass to match an action mapping. if found, return.
      2. Match again adding "/index.action" to the servlet path. if found, return.
      3. Match again adding "index.action" (no slash) to the servlet path. if found, return.

      Aside from the obvious inefficiencies to be resolve, it should be plain what my intent is. I am executing the index action for a directory path, but there's no good way to get #3 to issue a redirect. URIs ending in /foo should become /foo/ in the browser.

      Therefore, I pull a page from the Tapestry book. You can throw a RedirectException with a path and a temporary/permanent flag to set the correct HTTP status.

      Attachments

        Activity

          People

            Unassigned Unassigned
            pbenedict Paul Benedict
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: