Hi everyone,
recently I was asked to support older browsers (namely Opera 12.17). Opera 
permutations have been disabled for quite some time (I'm using trunk build 
of GWT) and for unknown browsers the user.agent selection script just 
returns "unknown" which makes the module fail to load. Since we're talking 
Opera here I thought "Hey! It should mostly work with safari or gecko 
permutations right?". I dug a little deeper in how the selection works and 
ended up modifying UserAgentPropertyGenerator. But modifying stock GWT one 
(I just placed my new implementation in my project's class path, you don't 
need to recompile GWT to make it work) has a downside since the 
UserAgentAsserter stops working and I wanted to use it to show some message 
to the user about unsupported browser. This is because UserAgent class that 
is responsible for the values being compared is generated by the very same 
UserAgentPropertyGenerator. After a while I figured I could replace the 
generator only for the selection script by modifying my gwt.xml file. So I 
ended up with something like this:

<!-- Returns 'safari' instead of 'unknown' -->
<property-provider name="user.agent" generator=
"my.own.UserAgentPropertyGenerator"/>
<!-- Since plain AssertionError isn't good enough for me I use my own 
asserter as well -->
<set-configuration-property name="user.agent.runtimeWarning" value="false"/>
<!-- My own asserter that throws more specific exception -->
<entry-point class="my.own.UserAgentAsserter" />
With this approach you don't need to copy any GWT internals (which I think 
is way better).

My questions are, did someone tried to use something similar? What approach 
did you take? Are there some problems with this one?

GWT provides property error function callback, it would be great if this 
function could be used to return a fallback value. Are these callback 
something that is likely to change or is it something that can be used in 
production? The documentation on this is pretty bad though :-(.

Honza

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to