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 <glafo...@gmail.com> 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 <marceloverd...@gmail.com> wrote:
>
> > Or use a Listener as described 
> > herehttp://marceloverdijk.blogspot.com/2009/10/determining-runtime-enviro...
>
> > On 23 nov, 15:58, Nacho Coloma <icol...@gmail.com> 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 <icol...@gmail.com> 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 google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.


Reply via email to