Struts2 web application can run in the servlet container like Jetty. Jetty also have an embedded option. Eclipse RCP uses Eclipse platform for extension and customization with plugins. There's an article of using Eclipse RCP with embedded Jetty server:
First, let’s add the jetty plugin to our dependencies. Open the tab
Dependencies in your plugin configuration. Then add these six
plugins to the Required Plug-ins:
javax.servlet
org.eclipse.equinox.http.jetty
org.eclipse.equinox.http.regstry
org.eclipse.equinox.http.servlet
org.mortbay.jetty.server
org.mortbay.jetty.util
In the list of plugins included at the launch of application you need
to change the Auto-Start value for three plugins to true (if you are
lazy, you can turn the default behavior to auto start but this is
another concern):
org.eclipse.equinox.http.jetty
org.eclipse.equinox.http.regstry
org.eclipse.equinox.http.servlet
Now if you run the application you can check if your server is
correctly running by accessing http://localhost
. This should work
flawlessly except maybe if you are not allowed to run server in port
80 or there is already a server running in port 80.
You can change the port by adding an argument to the VM arguments in
Run Configurations. Add this value:
-Dorg.eclipse.equinox.http.jetty.http.port=8888
. Change 8888
to
whatever port you want the server to be running.
Now if you are running the application, you can access it from the
port you mentioned before.
The next task is to define one (or several) servlet(s) that will serve
any request the server gets. To do this, you need to open the
Extensions tab from your plugin configuration and add a new
extension named org.eclipse.equinox.http.registry.servlets
. After
that add new servlet
. You need to mention the class name of the
servlet, and an alias for that. One note here is you need to add slash
in front of the alias. For example, if you want to make the servlet
accessible from http://localhost:8888/webserviceInterface
, then the
alias value is /webserviceInterface
. Of course, you need to
implement a servlet which will do the work you want.