Thursday, November 4, 2010

Re: Maps App: How to externalize the Maps Key and/or read it at runtime from a config?

Another option is to use the Dictionary class in GWT and write the key
into the HTML page.
http://google-web-toolkit.googlecode.com/svn/javadoc/2.1/com/google/gwt/i18n/client/Dictionary.html

You can manually edit an html page or write a jsp page that does the
work for you.

On Nov 4, 9:47 am, Ben <ben.falc...@gmail.com> wrote:
> I am building a Map-based GWT app, using Netbeans, GWT4NB, GWT2.0. In
> the project, the file:
>
>   \src\java\com\acme\myprj\Main.gwt.xml
>
> contains info as below. In particular, the Google Maps key for my app
> is included in this file in a <script> element. I'd like, however, to
> be able to build for several different machines, each of which will
> require a different maps key. So my question:
>
>  Can i externalize the maps key such that I can build the project
> *once* and then use a sort of config file to instrument the build
> AFTER the build (somehow read it at runtime?)?
>   Currently, i am changing the key in this xml file for each specific
> scenario, and rebuilding a .war file. Can this be somehow done *after
> build* so that a single build (already packaged in a .war) could read
> the Maps key from a config file (at runtime?)?
>
> Thanks for any leads..
>
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>
> file Main.gwt.xml:
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.7.0//
> EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.7.0/distro-
> source/core/src/gwt-module.dtd">
>
> <module>
>     <inherits name="com.google.gwt.user.User"/>
>     <inherits name='com.google.gwt.maps.GoogleMaps' />
>     <inherits name="com.google.gwt.json.JSON"/>
>
> <script src="http://maps.google.com/maps?
> gwt=1&amp;file=api&amp;v=2&amp;sensor=false&amp;key=ABQIAAAAmqNnQe_4rfvfhGe 1voMqnBTOqyWKpcNbXXXXXXXXXXXX"/
>
>
>
> ..OTHER STUFF..
>
>     <entry-point class="com.acme.myprj.client.MainEntryPoint"/>
> </module>

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate