Pregunta

During the development of our GWT application, we will use a third party Java library for interfacing with some hardware. The user will use the interface which will eventually call Method() from the 3rd Party Library API. This will probably work in GWT development mode but it might pose problems when compiling the application for deployment when the Java code is converted into javascript as that library has no javascript support.

I am not exactly sure how we will over come this. But, for now it seems like RPC pattern may help us. Please correct any mistakes I make of my assumed understanding of RPC. The user will perform an action which will send an RPC request to a server containing the 3rd party Java API call which will perform the necessary information and updated the GWT user interface accordingly. My question boils down to this - how can I use a third party library in my GWT app when I dont think it will compile the application into java script.

I feel as if I am not entirely descriptive, but this is a problem that we have not considered and hope that we can somehow resolve this.

Any and all feedback is greatly appreciated!

¿Fue útil?

Solución

Server side code is not converted to Javascript, so if you wrap your calls to the 3rd party lib via RPC you should be fine.

This extends to parameters and return values to your 3rd party lib. I.e. you can't use 3rd party types in the RPC interface.

Otros consejos

If you want to add 3rd party library then it must have source files also, because GWT will convert all code to javascript. Refer this answer Adding external jar to GWT

If 3rd party library can be accessed via JavaScript, then you can use JSNI in the GWT client code.

https://developers.google.com/web-toolkit/doc/latest/DevGuideCodingBasicsJSNI

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top