GWT as part of a non-web application

We have a Java server application that runs certain batch jobs. This main function is not like a web application, and there is no reason for it. But we would like to add an option to check what the application does from the web page. And we thought that this could be done using the Google Web Toolkit.

In any previous experience with GWT, we deployed it to Tomcat. But in this case it seems redundant. The web part is more about what the application really does.

I am thinking of a solution in which a web server is integrated into a jar file - perhaps Jetty? So the complete java application can be deployed in a single jar file along with the web / GWT part.

There may be performance aspects, but there will be very few users on the web side of things. Are there other reasons not to do it this way?

And can you give some tips on how to configure Eclipse / Ant / Jetty / GWT for this?

+4
source share
1 answer

we had similar experience in our previous project. There was an eclipse-rcp application with an integrated Jetty server (it started programmatically when the application started). The GWT application was deployed to Jetty, as usual. There was also an OSGI service as a controller to provide communication between the GWT server and other parts of the application. The GWT server was a regular RCP server, which is described in most examples. He had a link to the controller. In addition, it was an event listener that supports bot communication.

The main problem for me, I think, was the synchronization problem. Since there were many messages between the eclipse-rcp application, the GWT part (each of which allows us to say 100 ms that the message was received), and GWT had an asynchronous way of communication between the client part and its server part, then it was necessary to create some kind of mechanism to synchronize these messages. Otherwise, there were no performance issues (except IE 6. which should have been supported: S: D).

Hope this helps.

Update. As far as I remember, the controller was registered as an OSGI service only for communication with other services of the Eclipse-RCP part. To communicate with the GWT controller, a special interface was implemented, which was known to the GWT server (the controller was registered as an executor by creating an instance, and the server was registered in the controller as IMessageListener). This interface lay in a separate project, which could also be embedded in a .war file. This project also contained a number of events to support feedback from the controller to the GWT server via the IMessageListener interface.

This is kind of confused, probably sorry. Maybe I should draw a chart.

+1
source

Source: https://habr.com/ru/post/1387349/


All Articles