Project

General

Profile

Feature #5155

make it easier to deploy custom servlets into the FWD server

Added by Greg Shah about 3 years ago. Updated about 3 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
Due date:
% Done:

0%

billable:
No
vendor_id:
GCD

History

#2 Updated by Greg Shah about 3 years ago

Our current approach to loading web applications/servlets into the FWD server's embedded container current relies on the following process.

  1. The Java servlet code for should be packaged as a .war ("web archive").
  2. In the "standard project template", the .war file needs to be placed in the deploy/lib/ folder. This needs to happen before the FWD server is started and before any code is copied from there to make a deployment.
  3. The servlet code must be loaded into the FWD server at runtime. The FWD server provides a Server Initialization and Termination Hook that provides this capability.
    • Implement the "loader" using these hooks, in a Java class which is then included into the application jar file.
    • The loader should look something like this:
    • Register the hook class in the directory.xml.
    • The result will be that the new websocket servlet will be loaded into the FWD server when it starts and will be available for the lifetime of the server.
  4. The .war files must currently have a web.xml for configuration of the services.

I think this approach should be made much easier.

  • We could implement a simple list of web services to load in the directory, eliminating the need for the init/term hooks which are an unnecessary complication. We already have to make edits to the directory for the hooks, the hooks themselves don't add any value.
  • We should support annotations for configuration, eliminating the requirement for the web.xml.

The use of web.xml bothers me a bit. I think there are significant security exposures by using it. My sense is that we should be in much tighter control over the initialization in order to minimize these potential impacts.

#3 Updated by Constantin Asofiei about 3 years ago

To allow mixed annotations and web.xml configuration for the services (servlet, web socket), the web.xml needs to have metadata-complete="false" version="3.0" set at its web-app node.

Otherwise, I agree that we should have a customWebServices section in directory.xml, where the .war and any other requirements are configured and managed, without the need of FWD server hooks. I'm thinking that the context parameters required by the WebAuthFilter may be able to be configured directly in the directory, and 'injected' via the WebAppContext to be made available as real context parameters to the servlet/filters. This would eliminate the need to have FWD-specific configuration in web.xml.

Also available in: Atom PDF