Hello John,

If you don't have any Stripes links which could cause the exception,
then probably someone tries to call URLs that are bound to validated
event handlers. This is a typical real-world scenario when web crawlers
scan your page.

There are several ways how you can get rid of these exceptions like these:

 1. Override ActionBeanContext#getSourcePageResolution
    
<http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/action/ActionBeanContext.html#getSourcePageResolution%28%29>
    As proposed in the exception message, you could do something more
    meaningful than throwing an Exception if no sourcePage was found. As
    you have access to the request in this class, you can also log some
    additional information stored in the request and session. Probably
    you already have a subclass of it in a Stripes extension package as
    proposed here
    <http://www.stripesframework.org/display/stripes/State+Management>.
 2. Use a Custom Exception Handler
    <http://www.stripesframework.org/display/stripes/Exception+Handling>
    You could write a dedicated exception handler that swallows these
    exceptions and does the same like an overridden
    getSourcePageResolution method.

Personally I would go with option 1, but maybe there are good reasons
for using number 2.

Hope that helps,
Marcus


Am 05.01.2013 17:00, schrieb Noobmeter Admin:
> Hi,
>
> I'm getting occasional SourcePageNotFoundException in logs and cannot
> figure out how to deal with them.
>
> 2013-01-05 15:18:38,143 +0000 [http-bio-8080-exec-63] ERROR
> ValidationErrorReportResolution:82  -
> net.sourceforge.stripes.exception.SourcePageNotFoundException: 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
> '_sourcePage' 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().
>       at 
> net.sourceforge.stripes.action.ValidationErrorReportResolution.execute(ValidationErrorReportResolution.java:56)
>       at 
> net.sourceforge.stripes.exception.DefaultExceptionHandler.handle(DefaultExceptionHandler.java:165)
>       at 
> net.sourceforge.stripes.controller.StripesFilter.doFilter(StripesFilter.java:263)
>
> I only have one form, and it is:
>
> <stripes:form beanclass="com.something.SomeActionBean" method="post"
> focus="name">
>       <stripes:text name="value1" />  
>       <stripes:submit name="submitName"/>
>         <!-- snip -->
> </stripes:form>
>
> So it is a proper Stripes form, not a homegrown one. The HTML for it includes
> <input type="hidden" name="_sourcePage"
> value="GlW_ykMrb6SKXvymq6Cw3g==" /><input type="hidden" name="__fp"
> value="squzNcabnHgp-8i4HC5Ugg==" /></div>
>
>
> The handler for that form then performs some manipulations, and
> redirects to some ForwardResolution or RedirectResolution.
>
> I also have other ActionBeans which get GET requests with pretty URLs
> (@UrlBinding), and these sometimes add ValidationErrors (e.g., if user
> mistyped URL, or other error occurred), set them in context, and do a
> ForwardResolution to /root.jsp.
>
> And usually that works just fine, the root page gets these validation
> errors and displays them fine. But rarely (according to logs)
> something fails.
>
> Is it an abuse / hack to use ValidationErrors outside of a form to
> validate GET parameters? What should I use instead?
>
> How can I debug which user actions have lead to the source page not
> being supplied but being expected?
>
> Regards,
> John
>
> ------------------------------------------------------------------------------
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. SALE $99.99 this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_122912
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122912
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to