As of 1.3.0, we also set the com.google.appengine.runtime.environment system property and alternatively provide this programmatic API (which does not require access to a ServletContext):
http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/utils/SystemProperty.html On Mon, Dec 21, 2009 at 4:52 PM, Jorge <[email protected]> wrote: > I found this in the Programming GAE book by Dan Sanderson, O'Reilly, > 2010: > > "An app can determine whether it is running on AppEngine or in the > development server from the servlet info string in the srvlet context, > returned by this.getServletContext()getServletInfo(). This string > starts with Google App Engine Development when running in the > development server..." > > Jorge Gonzalez > > > On Nov 28, 7:34 am, Guillaume Laforge <[email protected]> wrote: > > Another approach I've just found is doing something like: > > > > ApiProxy.getCurrentEnvironment().getClass().getName().contains > > ("LocalHttpRequestEnvironment") > > > > Not sure in the end what's the best approach of them all. > > > > On 24 nov, 16:29, Marcel Overdijk <[email protected]> wrote: > > > > > Or use a Listener as described herehttp:// > marceloverdijk.blogspot.com/2009/10/determining-runtime-enviro... > > > > > On 23 nov, 15:58, Nacho Coloma <[email protected]> wrote: > > > > > > To answer my own question, this has been my best shot this far: > > > > > > SecurityManager sm = System.getSecurityManager(); > > > > localDevelopmentEnvironment = sm == null || > > > > "com.google.appengine.tools.development.DevAppServerFactory > > > > $CustomSecurityManager".equals(sm.getClass().getName()); > > > > > > If anyone has a better way, I will be glad to hear. > > > > > > On Nov 23, 1:17 pm, Nacho Coloma <[email protected]> wrote: > > > > > > > Hi all, > > > > > > > I was considering options, but I first wanted to ask: is there a > > > > > recommended way to differentiate between my localdevelopment > > > > > environment and the realGAEserver? This far, the only options I can > > > > > think of are: > > > > > > > * adding a -Dtest=true to my eclipse launcher > > > > > > > * looking up for any test environment classes (Class.forName) but > it's > > > > > not reliable as they could get included by mistake in any WAR > release. > > > > > > > * I have been searching for instanceof alternatives i.e.: > > > > > DatastoreServiceFactory.getService() instanceof > LocalDatastoreService > > > > > but I could not find any such expression that could possibly work. > > > > > > > Ideas? What are people using out there? > > > > > > > Nacho. > > -- > > You received this message because you are subscribed to the Google Groups > "Google App Engine for Java" group. > To post to this group, send email to > [email protected]. > To unsubscribe from this group, send email to > [email protected]<google-appengine-java%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-appengine-java?hl=en. > > > -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
