How to determine *at runtime* which permutation is used?

41 views
Skip to first unread message

Hilco Wijbenga

unread,
Nov 9, 2011, 6:54:34 PM11/9/11
to GWT Users
Hi all,

It would be helpful to see which permutation is being downloaded by
the browser. Is there a way to determine *at runtime* which
permutation (or at least which browser permutation) is being used?

It would be fine if extra work is needed during the build to generate
this information. Perhaps there is some sort of trigger/event at the
start of each permutation's compilation? Any ideas?

Cheers,
Hilco

Danny Kirchmeier

unread,
Nov 9, 2011, 8:37:29 PM11/9/11
to google-we...@googlegroups.com
You can use GWT.getPermutationStrongName()

You can choose to write that to the screen like so
RootPanel.get().add(new Label(GWT.getPermutationStrongName()));

Hilco Wijbenga

unread,
Nov 9, 2011, 10:22:02 PM11/9/11
to google-we...@googlegroups.com
On 9 November 2011 17:37, Danny Kirchmeier <da...@kirchmeier.us> wrote:
> You can use GWT.getPermutationStrongName()

Thank you.

Unfortunately, this gives me: F0A79CA92B424357F8F0A6170AD004B9. Is
there a way to turn this into something readable?

Paul Robinson

unread,
Nov 10, 2011, 3:46:31 AM11/10/11
to google-we...@googlegroups.com
You can use deferred binding for this.

<replace-with class="com.whatever.MyClassImplIE6">
<when-type-is class="com.whatever.MyClass"/>
<when-property-is name="user.agent" value="ie6" />
</replace-with>

<replace-with class="com.whatever.MyClassImplIE8">
<when-type-is class="com.whatever.MyClass"/>
<when-property-is name="user.agent" value="ie8" />
</replace-with>

etc

and then
MyClass thing = GWT.create(MyClass.class);

You can put whatever you want into MyClass, and into its subclasses so you can get whatever you need at runtime, but have the real work done at compile time.

Paul

Reply all
Reply to author
Forward
0 new messages