[
http://www.stripesframework.org/jira/browse/STS-111?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ben Gunter closed STS-111.
--------------------------
> Stripes 1.2 doesn't work with Spring unless you go through an ActionBean first
> ------------------------------------------------------------------------------
>
> Key: STS-111
> URL: http://www.stripesframework.org/jira/browse/STS-111
> Project: Stripes
> Issue Type: Bug
> Components: Tag Library
> Environment: Stripes version 1.2
> Reporter: Jeppe Cramon
> Assignee: Tim Fennell
> Priority: Blocker
> Fix For: Release 1.2.1
>
>
> I guess I was too fast to say that Stripes 1.2 didn't give upgrade
> problems... Just hadn't checked my logs or tried use the actions that used
> Spring injection.
> The problem only occurs if you don't go through an ActionBean first.
> The problem comes from the FormTags isWizard() method.
> There are actually two issues with it.
> 1. It hides the real cause of the StripesServletException that's thrown from
> StripesFilter.getConfiguration().getActionResolver().getActionBean(...)
> I changed to log.error statement to the following, so that I can see the
> cause:
> log.error(sse.getRootCause() != null ? sse.getRootCause() : sse, "Could not
> locate an ActionBean that was bound to the URL [",
> this.actionWithoutContext, "]. Without an
> ActionBean class Stripes ",
> "cannot determine whether the ActionBean is a
> wizard or not. ",
> "As a result wizard behaviour will be disabled.");
> 2. The call to
> StripesFilter.getConfiguration().getActionResolver().getActionBean(...) uses
> an empty ActionBeanContext where request and response isn't set.
> Since the ActionBeanContext doesn't have the request and response objects,
> the SpringHelper fails in the 2. line of the injectBeans() method with a NPE.
> I couldn't find the NPE until I changed the log.error statement in the
> FormTag's isWizard() method, so please keep it, it aids in finding bugs.
> Below is a working version of the isWizard() method. You'll notice that it
> currently catches a ServletException and not StripesServletException.
> This is because the ActionBeanContextFactory's getContextInstance() method is
> defined to throw a ServletException instead of a StripesServletException
> (which the default implementation throws). I could have gone with a double
> catch block with identical code, but didn't.
> It would probably be best if you could change ActionBeanContextFactory's
> getContextInstance() method to throw StripesServletException so that the code
> in FormTag's isWizard method can be changed to only catch
> StripesServletException.
> For those who want to use Stripes 1.2 with Spring and use the useActionBean
> tag, can copy the attached file to their work into the
> net.sourceforge.stripes.tag package. TomCat or another server will then load
> it before the Stripes version.
> FormTag's isWizard() method that works with Spring:
> =========================================
> protected boolean isWizard() {
> ActionBean bean = getActionBean();
> if (bean == null) {
> try {
> ActionBeanContext context =
> StripesFilter.getConfiguration().getActionBeanContextFactory().getContextInstance((HttpServletRequest)getPageContext().getRequest(),
> (HttpServletResponse)getPageContext().getResponse());
> bean =
> StripesFilter.getConfiguration().getActionResolver().getActionBean(
> context, this.actionWithoutContext);
> }
> catch (ServletException sse) {
> log.error(sse.getRootCause() != null ? sse.getRootCause() :
> sse, "Could not locate an ActionBean that was bound to the URL [",
> this.actionWithoutContext, "]. Without an
> ActionBean class Stripes ",
> "cannot determine whether the ActionBean is a
> wizard or not. ",
> "As a result wizard behaviour will be disabled.");
> return false;
> }
> }
> return bean.getClass().getAnnotation(Wizard.class) != null;
> }
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and,
should the need arise, upgrade to a full multi-node Oracle RAC database
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development