[
http://www.stripesframework.org/jira/browse/STS-780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12118#comment-12118
]
Ben Gunter commented on STS-780:
--------------------------------
Samuel, I think I came up with a solution we will both be happy with. It keeps
the validation error report for benefit of beginners, but allows advanced users
to handle SourcePageNotFoundException however they wish. Here's the commit
message describing the changes. Let me know what you think.
--
A better fix for STS-780. ActionBeanContext throws SourcePageNotFoundException
by default and never returns ValidationErrorReportResolution.
DefaultExceptionHandler now has a handler for SourcePageNotFoundException that
does return ValidationErrorReportResolution. To disable the error report, a
developer can simply override the appropriate handle(..) method in their
exception handler.
> ValidationErrorReportResolution error with XHTML
> ------------------------------------------------
>
> Key: STS-780
> URL: http://www.stripesframework.org/jira/browse/STS-780
> Project: Stripes
> Issue Type: Bug
> Components: Context Management
> Affects Versions: Release 1.5.4
> Reporter: Samuel Santos
> Assignee: Ben Gunter
> Fix For: Release 1.5.5, Release 1.6
>
>
> When you click on a link that causes a validation error, and don't have a
> sourcePage parameter in the query string, you'll get the nasty error returned
> on the ActionBeanContext#getSourcePageResolution method line 228.
> The problem is that ValidationErrorReportResolution writes directly to the
> HttpServletResponse writer.
> If you use a decoration framework like SiteMesh, you end up with malformed
> HTML (e.g. two <html> tag elements).
> That along may not be that severe as long as you don't use XHTML and its
> draconian error handling, which will immediately cause your site to break.
> Since mobile best practices dictate that mobile web applications should
> always use the content-type application/xhtml+xml, we need to implement our
> own ActionBeanContext and override the method getSourcePageResolution in each
> new mobile application we develop:
> @Override
> public Resolution getSourcePageResolution() {
> if (getSourcePage() == null) {
> throw new IllegalStateException("Here's how it is. Someone (quite
> possibly the Stripes Dispatcher) needed "
> + "to get the source page resolution. But no source page was
> supplied in the "
> + "request, and unless you override
> ActionBeanContext.getSourcePageResolution() "
> + "you're going to need that value. When you use a
> <stripes:form> tag a hidden " + "field called '"
> + StripesConstants.URL_KEY_SOURCE_PAGE + "' is included. "
> + "If you write your own forms or links that could generate
> validation errors, "
> + "you must include a value for this parameter. This can be
> done by calling "
> + "request.getServletPath().");
> } else {
> return new ForwardResolution(getSourcePage());
> }
> }
> This really needs to be fixed in order to fully support XHTML.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development