Sunday, October 4, 2015

Re: How do I keep third part from seeing my GWT core Java source code


@JsExport("MSEP")

The parameter value "MSEP" is ignored when you apply @JsExport on class level, thats why you don't see it in your compiled JS output. If you want to rename a class you need to rename its constructor. Also keep in mind that when you apply @JsExport("MSEP") to your constructor it will replace any default namespace (any @JsNamespace you have used or by default the package name of the class) so you would need to repeat the namespace in your @JsExport annotation if you want to use a namespace, e.g. @JsExport("my.package.MSEP")

When you do that you should see "MSEP" in your JavaScript output. Currently you most likely have the names MyStartEntryPoint (or maybe not because its abstract) and getJsData in your JS output.


I want to compile my GWT core library into javascript such as gwt.nocache.js so I can use JSNI to wrap the above class and third part can use my JSNI wrapper. The reason why I do this way is to keep third part from seeing my GWT core source code. Is it possible? 

Yes that should work. You produce a minified JavaScript library using GWT and then create a GWT wrapper project for it. You don't have to use JSNI in your wrapper project, you can also use JsInterop if you want. But keep in mind when choosing this approach the project that uses your library can not optimize the usage of your library as its now all JavaScript. Even if that project only uses 10% of your library it must download the full size of the library. 

Also in the end it is all just JavaScript which runs in the browser so it can be reverse engineered. So while you hide your real java source code, the actual code being executed is not hidden at all and can be analyzed/copied whatever. The only code you can really protect is the code on your server.


-- J.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@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.

No comments:

Post a Comment