Freddy D. <[EMAIL PROTECTED]> writes:
>
> Hi Jim,
>
> > First off, you've done an amazing job on the book. I think it's a perfect
> > compliment to anyone who is using the framework. The examples you've
> > provided
> > are very real-world applicable and have saved me a ton of time.
>
> Thank you for your kind words!
>
> > When I navigate to a url that maps to an existing action bean, I get an
> > exception:
>
> First thing I would try is a correction to the code that I posted. I made
> a mistake due to CPB (Coding Past Bedtime) syndrome ;)
>
> At the end, I had return null; and that should be return cls:
>
> @Override
> public Class<? extends ActionBean> getActionBeanType(String path) {
> Class<? extends ActionBean> cls = super.getActionBeanType(path);
> if (cls == null) {
> ActionBean bean = handleActionBeanNotFound(null, path);
> if (bean != null) {
> return bean.getClass();
> }
> }
> return cls; // Correction here
> }
>
> Let me know if that indeed fixes the problem for URLs that are bound to
> Action Beans.
>
> > to it. When I tried a url that was not bound, I got the same error, but I
> > noticed that when I disabled my interceptor (loginintercptor from the
> > book),
> > it
> > worked. After disabling the interceptor, I tried the url to the bound
> > actionbean, but that still did not work properly.
>
> This is probably a different problem in the LoginInterceptor; I'll have a
> look and let you know if I find anything.
>
> Cheers,
> Freddy
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>
Hi Freddy,
It looks like while you were suffering from CPB, I was suffering from LCB
(looking at code past bedtime) syndrome. I didn't catch that either. Regardless,
that did indeed fix the issue.
I also tracked down the issue with the login interceptor. In your example on
page 386, you give the following:
public Resolution intercept(ExecutionContext execContext)
throws Exception
{
Resolution resolution = execContext.proceed();
MyActionBeanContext ctx =
(MyActionBeanContext) execContext.getActionBeanContext();
BaseActionBean actionBean = (BaseActionBean)
execContext.getActionBean();
Class<? extends ActionBean> cls = actionBean.getClass();
if (ctx.getUser() == null && !ALLOW.contains(cls)) {
resolution = new RedirectResolution(LoginActionBean.class);
}
return resolution;
}
With the way we've set things up, when an actionbean is not found, we are
creating an instance of DefaultViewActionBean, which obviously can't be cast to
BaseActionBean. I remedied this by wrapping the block in an if statement to
check to see if the bean was an instance of BaseActionBean:
public Resolution intercept(ExecutionContext execContext)
throws Exception
{
Resolution resolution = execContext.proceed();
if (execContext.getActionBean() instanceof BaseActionBean)
{
MyActionBeanContext ctx =
(MyActionBeanContext) execContext.getActionBeanContext();
BaseActionBean actionBean = (BaseActionBean)
execContext.getActionBean();
Class<? extends ActionBean> cls = actionBean.getClass();
if (ctx.getUser() == null && !ALLOW.contains(cls)) {
resolution = new RedirectResolution(LoginActionBean.class);
}
}
return resolution;
}
That seemed to do the trick.
Again, thank you for all of your help! Can't wait to see the final version of
the book!
- Jim
P.S. Funny thing...as I was about submit this message, I realized the captcha to
submit was "brothels"...interesting :-)
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users