Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Web Service on RAP(How to implement Web Service on RAP)
Web Service on RAP [message #1839649] Thu, 25 March 2021 07:54 Go to next message
David Lee is currently offline David LeeFriend
Messages: 54
Registered: May 2013
Member
Good day, everyone,

In order to provide other systems to read/write data from the RAP application instead of allowing direct access to the database.

I found Web Service might be a good solution, can someone guide me how to do it? And what plugins/packages do I need?

Thank you so much!

David
Re: Web Service on RAP [message #1839874 is a reply to message #1839649] Tue, 30 March 2021 17:22 Go to previous message
Benjamin Wolff is currently offline Benjamin WolffFriend
Messages: 115
Registered: July 2009
Senior Member
Hi David,

in principle, you could expose one or more servlets under a given URL. You can use the extension point "org.eclipse.equinox.http.registry.servlets" (in the "Extensions" registry of the plugin.xml Editor) and register a class that extends
javax.servlet.http.HttpServlet
.

In the extension point you enter the fully qualified name of your servlet for the "class" property and the "alias" property is that determines the URL, under which the servlet will be accessible, e.g. "/api". The servlet would than answer on requests to "<base URL>/api".

From there you would have to implement the request and response processing yourself. There might be some Java libs to help with that (e.g. JSON serializer/deserializer) etc. Depending on your use case, it might not be the most convenient way to provide a RESTful API, since it might not be very easy for use different URLs with more parts (like /api/v1/foo/bar), since the servlet mapping doesn't work dynamically. Maybe it would be possible to expose the API in a different WAR file and deploy it next to the RAP app?

HTH

Ben
Previous Topic:FileUpload issue
Next Topic:RAP in action
Goto Forum:
  


Current Time: Tue Sep 21 21:41:03 GMT 2021

Powered by FUDForum. Page generated in 0.02157 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top