[
https://issues.apache.org/struts/browse/WW-2726?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44418#action_44418
]
paul4christ79 edited comment on WW-2726 at 7/19/08 7:49 AM:
------------------------------------------------------------
I know what you mean. I found it very unnatural to use an exception when I had
to with Tapestry. Thanks for the pushback, because I believe there is a better
way:
FilterDispatcher#doFilter() should refactor out its Exception handling and
action handling into a protected methods for customization. Since what we
really want to do is at the servlet level, it would make more sense to subclass
the filter and do the HTTP stuff there. After all, it is not the responsibility
of the ActionMapper to do redirects, right?
PS: Methods in DefaultActionMapper should be more accessible to subclasses. I
would mark these as protected and final: isSlashesInActionNames,
getDefaultExtensions.
was (Author: paul4christ79):
I know what you mean. I found it very unnatural to use an exception when I
had to with Tapestry. Thanks for the pushback, because I believe there is a
better way:
FilterDispatcher#doFilter() should refactor out its Exception handling and
action handling into a protected method for customization. Since what we really
want to do is at the servlet level, it would make more sense to subclass the
filter and do the HTTP stuff there. After all, it is not the responsibility of
the ActionMapper to do redirects, is right?
PS: Methods in DefaultActionMapper should be more accessible to subclasses. I
would mark these as protected and final: isSlashesInActionNames,
getDefaultExtensions.
> FilterDispatcher: Catch RedirectException to issue 30x code
> -----------------------------------------------------------
>
> Key: WW-2726
> URL: https://issues.apache.org/struts/browse/WW-2726
> Project: Struts 2
> Issue Type: Improvement
> Components: Dispatch Filter
> Reporter: Paul Benedict
>
> 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.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.