Kovalan V
Kovalan V

Reputation: 39

Having RESTful service in RCP application

We have an existing eclipse RCP application that works as a standalone product. At a high level, this product is used to configure a image specification using its UI and we can export a sample Image based on these configuration. Now we are developing another web application that has several modules and one module of it is to develop something that our eclipse RCP application does. Just to provide a QUICK integration of the RCP application for demo purpose, I plan to run the RCP application separately in the server machine and expose its static functionality as a RESTful webservice. So the module shall make a RESTful call to the RCP application.

Now just to begin with I tried to embed a jetty server for hosting the REST service during the start of RCP application like below

enter image description here

enter image description here

But the thing is after the Jetty server is started I am not able to access the TestWebService using the path i configured. So I am confused if this is the right approach to have a RESTful service inside a RCP application. Please note that iam able to hit the server with http://localhost:1002, but not the service.

Following is the console log when i hit on http://localhost:1002/hello/test:

enter image description here

Upvotes: 2

Views: 888

Answers (1)

Adam Horvath
Adam Horvath

Reputation: 1286

It's a really weird architecture you're experimenting with. I mean to write an RCP-application which listens on a port and offers REST services on it; this could lead to further obstacles.

Instead I would seperate it into two software artifacts: an RCP-app and a web-application (.war).

You could extract a business-logic jar (It can be an OSGi plug-in if necessary) contaning your image manipulation logic. Then include this plug-in/.jar as a dependency in the webapp and offer out it's functionalities thru a Web-container (Tomcat, GlassFish, etc.)

So your other (third) application will connect to the Web-services offered by this .war file.

opt.1) If you need a single running instance (because of database or other shared resource) then your RCP-app will have to use this REST service too.

opt.2) If not then simple compile the .jar/plug-in containing the business-logic into your RCP-app.

Upvotes: 1

Related Questions