To improve compile time in development I have created a facility
whereby developers can fetch the GWT host page and if a compile is
needed, it is automatically started, and the compile is only for the
browser the developer is currently using. This is working fine and
really reduces compile time in development. My application takes an
extra 30 seconds to compile for each browser added.
I know I can accomplish this with multiple modules, but I don't want
to make multiple modules. What I want to accomplish is an override the
user agent property at compile time. I can do this two ways, one way
is using set-property in my module.xml file:
<set-property name="user.agent" value="gecko"/>
Another way, and one that works to allow compile for two browsers
instead of just one, is to copy a custom UserAgent.gwt.xml file early
in the classpath, so when the developer hits the URL, a servlet filter
checks if the compile is needed and places the specific
UserAgent.gwt.xml file in the classpath and compiles. One type of
UserAgent.gwt.xml file might include
<define-property name="user.agent" values="gecko,safari"/>
This works fine, but when the application is run in hosted mode I get
the following error if I only defined the user.agent property with a
single browser:
[ERROR] Unable to get value of property 'user.agent'
com.google.gwt.core.ext.BadPropertyValueException: Property
'user.agent' cannot be set to unexpected value 'null'
at
com.google.gwt.dev.shell.ModuleSpacePropertyOracle.computePropertyValue(ModuleSpacePropertyOracle.java:
114)
at
com.google.gwt.dev.shell.ModuleSpacePropertyOracle.getPropertyValue(ModuleSpacePropertyOracle.java:
59)
at
com.google.gwt.dev.cfg.ConditionWhenPropertyIs.doEval(ConditionWhenPropertyIs.java:
48)
The user agent detection Javascript is missing from the nocache.js
file when I compile for only one browser. If i change the
UserAgent.gwt.xml file to include two browsers:
<define-property name="user.agent" values="gecko,ie6"/>
Hosted mode works fine and the user.agent detection Javascript is
inluded in the nocache.js file.
If instead I override the user.agent by using <set property> in
mymodule gwt.xml I get
[ERROR] Unable to load module entry point class
com.tradecard.tradepage.gwt.modules.packbyscan.client.PackByScanModule
(see associated exception for details)
com.google.gwt.core.client.JavaScriptException: (TypeError): Object
doesn't support this property or method
number: -2146827850
description: Object doesn't support this property or method
at
com.google.gwt.user.client.impl.DOMImplStandard.initEventSystem(Native
Method)
at
com.google.gwt.user.client.impl.DOMImplMozilla.initEventSystem(DOMImplMozilla.java:
45)
at
com.google.gwt.user.client.impl.DOMImpl.maybeInitializeEventSystem(DOMImpl.java:
165)
I think this second one is because I have not compiled for I.E., and I
am running hosted mode on windows.
I think the first one is a bug. Either the user agent detection code
should not be optimized out of the nocache.js file, or it should not
be called when it's not there.
As a work around, I am compiling for ie6 in addition to the browser
used by the developer, so they can switch to hosted mode without an
issue. However I would like to be able to compile just for Firefox if
that is the browser the developer is using, and have hosted mode
work.
Thanks in advance for advice and comments,
Chris
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" 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-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---