Logo Help Center

Elvis 4 Java webapp plug-ins

Elvis 4 Java webapp plug-ins

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");
Was this article helpful?
0 out of 0 found this helpful / Created: / Updated:
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.