Hello,

Hey guys!

I'm trying to integrate GWT into an offline HTML application for Android and 
iPhone. In order to do this, I need to compile a MANIFEST file to direct the 
browser to cache files. I've got it working now with a servlet that returns 
a text/cache-manifest file with a list of the contents of my /app directory 
(the module is rename-to app). While this works, I'm forcing the mobile 
browser to download ALL permutations of the GWT compiled units because I 
can't determine the which version is for the mobile-webkit.

Is there any easy way to determine which file maps to which user agent?

In case there isn't, my alternative plan looks something like this:
1. Create an interface widget called UserAgentDetector, one method String 
getUserAgentName()
2. Create multiple classes implementing UserAgentDetector that return a 
single, static, unique string of the user agent. (ex. return 
"EvansUniqueMozillaAgentString";)
3. Append my gwt.xml file to map each class to the various user agent using 
replace:
<replace-with class="com.evan.agent.MozillaUserAgentDetector">
<when-type-is class="com.evan.agent.UserAgentDetector" />
<any>
<when-property-is name="user.agent" value="gecko"/>
<when-property-is name="user.agent" value="gecko1_8" />
</any>
</replace-with>
4. Toss some .create binding command in my EntryModule
5. Create a post-compiler step to text search each of the files, matching up 
the unique agent string (EvansUniqueMozillaAgentString) with the js file 
name.
6. Output the matches to a .properties file, which I can then feed into my 
cache-manifest servlet generator

The idea being that each permutation will include ONLY the UserAgentDetector 
that is relevent to the target. By making a ~nonsense user agent string, I 
can deduce which agent the file is targeting by the presence of that string. 
Will this work? It seems convoluted.

Can anyone suggest a better way?

Thanks!

Evan

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/Y0sKtffE08MJ.
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.

Reply via email to