2

I am using GWT 2.5.1 and I am accesing to a .war deployed with Tomcat 7.0.32, using the browser of a Kindle paperwhite model No. EY21.

The problem is that GWT cannot get the user-agent of the Kindle correctly, I mean, I get the following values:

  • From my server: getMyThreadLocalRequest().getHeader("user-agent") --> Mozilla/5.0 (X11; U; Linux armv7l like Android; en-us) AppleWebKit/531.2+ (KHTML, like Gecko) Version/5.0 Safari/533.2+ Kindle/3.0+ --> ok!

  • From the web www.whatsmyuseragent.com --> Mozilla/5.0 (X11; U; Linux armv7l like Android; en-us) AppleWebKit/531.2+ (KHTML, like Gecko) Version/5.0 Safari/533.2+ Kindle/3.0+ --> ok !

  • From the GWT 2.5.1 library: Window.Navigator.getUserAgent() --> Mozilla/5.0 (X11; ; U; Linux armv7l; en-us) AppleWebKit/534.26+ (KHTML, like Gecko) Version/5.0 Safari/534.26+ --> ?¿?¿

So, I think that the GWT function is not getting the correct value for the user agent of the Kindle paperwhite browser...

Any idea??

Thanks a lot in advance!!

horstmann
  • 149
  • 1
  • 2
  • 8

1 Answers1

2

The way GWT computes the user.agent value in client side is in the class UserAgentPropertyGenerator.java which is used to create the bootstrap script:

  body.println("var ua = navigator.userAgent.toLowerCase();");

  [...]

  // webkit family
  new UserAgentPropertyGeneratorPredicate("safari")
  .getPredicateBlock()
    .println("return (ua.indexOf('webkit') != -1);")
  .returns("'safari'"),

Taking a look to this code and the user agent string you sent, gwt must select the webkit permutation (because user agent contains WebKit) .

If you don't get any error, just a blank page, perhaps you have disabled the permutation for webkit browsers (safari) in your module file, or maybe you are using other properties apart from the user.agent one in your project, and some combination of properties does not match your device.

If you are using xsiframe linker, take a look to the compilation-mappings.txt file generated in the compiler output folder, which have a list with permutation names and properties.

Manolo Carrasco Moñino
  • 9,723
  • 1
  • 22
  • 27