Hi,

This morning I've been debugging a bad date format pattern, so I've got a break 
point in java.text.DateFormat.parse(String) to see which pattern is allowing 
invalid dates through.  When I initially load up the first page, I see this 
break point getting hit about 20 times even though there should be no date 
parsing that I am aware of, this is a blank GET request to the home page.  The 
stack is showing:

Daemon Thread [ajp-localhost%2F127.0.0.1-8009-1] (Suspended (breakpoint at line 
335 in DateFormat))
                SimpleDateFormat(DateFormat).parse(String) line: 335
                FastHttpDateFormat.internalParseDate(String, DateFormat[]) 
line: 191
                FastHttpDateFormat.parseDate(String, DateFormat[]) line: 166
                Request.getDateHeader(String) line: 183  << not sure how this 
one is implemented - it calls parse date on every header/parameter in the 
request, so that's really where the penalty is.               
RequestFacade.getDateHeader(String) line: 632
                FlashRequest.<init>(HttpServletRequest) line: 134
                FlashRequest.replaceRequest(HttpServletRequest) line: 81
                FlashScope.completeRequest() line: 165
                StripesFilter.flashOutbound(HttpServletRequest) line: 308
                StripesFilter.doFilter(ServletRequest, ServletResponse, 
FilterChain) line: 255
                DynamicMappingFilter.doFilter(ServletRequest, ServletResponse, 
FilterChain) line: 350
                ApplicationFilterChain.internalDoFilter(ServletRequest, 
ServletResponse) line: 235

So the stripes flash scope is doing something that is actually taking a 
considerable amount of time.  (each one of those 20+ failed date parse attempts 
throws an exception, which adds up to be expensive.)   This application is not 
using flash scope anywhere, so I'd like to disable this piece entirely.  
Looking at the code for stripes filter, I just see:

            // Execute the rest of the chain
            flashInbound(httpRequest);
            filterChain.doFilter(httpRequest, servletResponse);

and

        finally {
            // reset the flag that indicates if this is the initial invocation
            if (initial) {
                initialInvocation.set(true);
                flashOutbound(httpRequest);

                // Once the request is processed, take the Configuration back 
out of thread local
                StripesFilter.configurationStash.remove();
            }

So I don't think there is an existing way to avoid the flash scope.  Is there a 
clever way to disable that?  If not, could we add a configuration flag to do so:

            // Execute the rest of the chain
            if (configuration.isFlashScopeIsEnabled())  { // default = true
                  flashInbound(httpRequest);
}
            filterChain.doFilter(httpRequest, servletResponse);

        finally {
            // reset the flag that indicates if this is the initial invocation
            if (initial) {
                initialInvocation.set(true);
                if (configuration.isFlashScopeEnabled())  {
                    flashOutbound(httpRequest);
                }

                // Once the request is processed, take the Configuration back 
out of thread local
                StripesFilter.configurationStash.remove();
            }

And wherever else flash scope related bits are invoked would be blocked by this 
setting as well.  I'm imaginging there are other places involved I could 
disable as well. Any thoughts?  Should I look at using flash scope because I'm 
missing how powerful it is?  (I haven't seen a need for it yet).

-John

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to