Unfortunately, this doesn't work very well. Because DMF takes over if the
container responds with 404 and because DMF treats all URL bindings as
prefix mappings, what you get with @UrlBinding("/") is an ActionBean that
ends up handling every 404 error for your app. There's some relevant
discussion here:
http://stripesframework.org/jira/browse/STS-688
-Ben
On Wed, Dec 29, 2010 at 9:19 AM, Newman, John W <john.new...@viaoncology.com
> 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