简体   繁体   中英

Using external library classes in client side :GWT

I want to use Solrj library in my GWT application. I made a GWT server class to communicate with Solrj client. My client code gets a Collection<FacetField> from the server class and builds the UI.

My problem is that GWT complains about missing source code:

No source code is available for type org.apache.solr.client.solrj.response.FacetField; did you forget to inherit a required module?

I can create an additional module for Solrj and then GWT will compile it to JS. But it will compile a lot of other classes, that I might never use on the client.

Another way is to write some wrappers of Solr classes and pass them to the client. But I'm not sure, because these wrappers will import Solr classes and I might have the same problem again.

What is the best way to solve this?

Write some DataLorry (dummy object)

server|| FacetField obj==>DataLorry obj==> client.

Flush required data in to DataLorry object.

That saves you a lot of data traffic between client and server even, since you are passing only required data on the wire.

Make sure that object is serializable and in shared package.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM