My GWT app (2.1.0) allows users to choose different methods of combining data. They can average, find the variance, etc. I achieve this effect with an enum that specifies which method to use.

Now I want to code custom methods for individual clients. For instance, someone could request a MODE feature.

One solution would be to just add MODE to the enum, write the getMode() function, and add it to the app. The problem comes in with 10,000 custom options. I don't mind *writing* 10,000 different methods, but I don't want all 10,000 functions being sent to each client. In fact, I want to make sure that one client can't see the implementation of another client's method, which may contain private data.

GWT.runAsync can help me split all of these methods into different chunks that will only be downloaded if the user requests it. Is there a way to run some sort of permission check before downloading that code? For example, I don't want someone changing the value of their enum-specified preference to trick the (private) code in to downloading.

I'm running this on the java GAE. I could write a filter to do a permission check before downloading cachedjs files, but since the names of the GWT files change after every compile I can't think of a way to control access to the different chunks in a meaningful way.

I hope this is clear. Thanks for any pointers!