You can serve Java webapps (.war files) on an Elvis server by placing them in subfolders of Config/plugins/active. Both .war files and directories with ./WEB-INF/web.xml files are supported. All directories and files starting with a dash ( - ) are ignored and are not scanned.
The server scans and subsequently deploys webapps on startup and every time the plugins are reloaded from the desktop client. The webapps are registered with the Jetty webserver that is embedded in the Elvis server.
Webapps are available under the <serverUrl>/plugins/path_below_active_plugins context path. For example:
- Config/plugins/active/someplugin/mywebapp.war is hosted at http://example.com/plugins/someplugin/mywebapp
- Config/plugins/active/anotherplugin/folder/webapp-dir/WEB-INF/web.xml is hosted at: http://example.com/plugins/anotherplugin/folder/webapp-dir
Some init parameters are passed to the webapp:
elvisServerVersion | The version of the Elvis Server. |
elvisContextPath | The context path where the Elvis Server runs, usually root: "". |
elvisPluginContextPath | The context path of this plugin. /plugins/someplugin/mywebapp in the example above. |
elvisPluginLocation | The location of the plugin webapp on disk. |
These can be accessed from JSP files:
<a href="${initParam.elvisContextPath}/install">Open client install page</a>
Or from the ServletContext:
ServletContext application = config.getServletContext();
File file = new File(application.getInitParameter("elvisPluginLocation"), "my-plugin-config.txt");
Comments
Do you have corrections or additional information about this article? Leave a comment!
Do you have a question about what is described in this article? Please contact support here.
0 comments
Please sign in to leave a comment.