Here is a quick way to determine if your code is executing in the GAE/J environment:
boolean onGoogleAppEngine = getServletContext().getServerInfo().startsWith("Google App Engine");getServerInfo() currently returns "Google App Engine/1.2.0" when running in the live GAE/J environment. When running in local development mode it returns "Google App Engine Development/1.2.0".
Please comment if you know of any better/cleaner way to determine if your code is executing in the GAE/J sandbox.
4 comments: