Using Struts 2 on Google App Engine

12/20/2009

Google App Engine (GAE) has some great benefits such as scalability and the fact that it’s free to start.  When using Struts 2 with Google App Engine there a few things to keep in mind.

The first is that it runs inside a security sandbox that is more restrictive than your typical Java environment.  This means that OGNL, the expression language that Struts 2 uses, will not work correctly out of the box.  You can fix this by adding a listener as described in this article.  An example listener can be found here and is used in this web.xml file.

The second problem is that Google App Engine has some special URLs that it uses.  If you try to visit them, Struts 2 will attempt to process the request as if it’s a Struts 2 Action and will bomb out when the Action can’t be found.  You can add an exclusion filter to your struts.xml to counteract this problem:

<constant name="struts.action.excludePattern" value="/_ah/.*"/>



Be Sociable, Share!