As Ben said, mapping to "/" isn't a good idea. However, since I would assume that this is a fairly common case, I do support the idea of using "" as a special sign for UrlBindings, as suggested on the bottom of STS-688.
As for performance, Stripes is nary a peep in my profiler. String manipulation and I/O are way more CPU-intensive than ActionBean binding and validation. For example, I just run 32000 requests against my current test code, and no single Stripes method used more than 0.5% of CPU time. On class level, DefaultActionBeanPropertyBinder managed to use ~1%. On package level, all of Stripes uses about 6%. All other time I get to use on my app. So it's a fair trade, IMO. /Janne On Dec 29, 2010, at 16:19 , Newman, John W wrote: > Did you look at dynamic mapping filter at all? > > Leave your web.xml as is, just paste this in > > <filter> > <filter-name>DynamicMappingFilter</filter-name> > > <filter-class>net.sourceforge.stripes.controller.DynamicMappingFilter</filter-class> > </filter> > <filter-mapping> > <filter-name>DynamicMappingFilter</filter-name> > <url-pattern>/*</url-pattern> > <dispatcher>REQUEST</dispatcher> > <dispatcher>FORWARD</dispatcher> > <dispatcher>INCLUDE</dispatcher> > </filter-mapping> > > And > @UrlBinding("/") > public class Home extends AbstractActionBean<ActionBeanContext> { > > should work fine. Before DMF was added, I would do > > <welcome-file-list> > <welcome-file>Home.action</welcome-file> > </welcome-file-list> > > And make an empty file named Home.action next to WEB-INF... there's a thread > on this in the list archives if you dig. It worked, but I didn't measure > performance. Really if we were to have a serious conversation about ways to > improve performance, it would be a very very long discussion, with a lot to > say about the overuse of reflection. > > -----Original Message----- > From: Janne Jalkanen [mailto:janne.jalka...@ecyrd.com] > Sent: Wednesday, December 29, 2010 6:27 AM > To: Stripes Users List > Subject: Re: [Stripes-users] UrlBinding to / > > Folks, > > to follow up on this, it seems that the simplest way to accomplish an > URLBinding to "/" is to create an "/index.jsp" -file which has the following > contents: > > <%@ page language="java" contentType="text/html; charset=UTF-8" > pageEncoding="ISO-8859-1"%> > <% > // > // We just simply redirect to the proper actionbean. > // > > request.getRequestDispatcher( "/action/mybean" > ).forward(request,response); %> > > Also ensure that index.jsp is in your welcome-file-list. > > There seems to be no more performance penalty on Tomcat 6, oddly enough. > You'll just need to be careful that you have your Servlet Filters mapped > properly in web.xml, since RequestDispatcher.forward() does not rerun the > filter chain. (FWIW, I tried setting up REQUEST and FORWARD dispatchers for > StripesFilter, but got very quickly into infinite loops, which were severely > detrimental to the performance of my web site. So just map the filters you > need properly for *.jsp and you should be fine.) > > This change alone bumped my Yottaa score up by 10 notches compared to just > blindly mapping action/mybean as a welcome-file. :-) > > /Janne > > On 29 Dec 2010, at 00:31, Janne Jalkanen wrote: > >> Hi folks! >> >> I need to map the root of my site to a particular ActionBean. Now, the >> simple way to do this is of course to use a welcome-file-list in web.xml >> (Tomcat 6.0.x): >> >> <welcome-file-list> >> <welcome-file>action/mybean</welcome-file> >> </welcome-file-list> >> >> but unfortunately this carries a fairly heavy performance penalty: compared >> to accessing action/mybean directly, the performance on EC2 Large instances >> is up to 100ms slower - and I'm seeing a definite bump in CPU usage as well >> (about 5x of what I would use normally). On my local OSX box the difference >> isn't that bad, but I'm still seeing it, especially the CPU usage. There's >> no considerable IO. >> >> So it seems that the welcome-file solution is less than ideal in my >> environment, and before I go and start ripping the guts out of it (or worse, >> changing my production environment), I'm wondering if there's a simple and >> clean way to resolve this the Stripes way. I see >> http://stripesframework.org/jira/browse/STS-688 has some discussion. >> >> Would a custom Servlet Filter be the best solution here? If so, then how >> would I invoke a particular ActionBean from it? >> >> (Here's the interesting part - it's slightly *faster* to have an >> index.jsp redirecting with 302 to /action/mybean than have the >> /action/mybean as the welcome-file. However, I want to steer away from >> redirects, since 1) I want clean URLs, and 2) redirects can be quite >> bad for performance, especially on mobile networks. And 3) it bothers >> me that this should really be faster than have an extra redirect >> loop... I'm wondering if having an ActionBean as a welcome-file >> somehow confuses Tomcat when the file does not exist physically.) >> >> /Janne > > > ------------------------------------------------------------------------------ > 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-users mailing list > Stripes-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/stripes-users > > > ------------------------------------------------------------------------------ > 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-users mailing list > Stripes-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/stripes-users ------------------------------------------------------------------------------ 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-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users