Feature #5155
make it easier to deploy custom servlets into the FWD server
0%
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.
- The Java servlet code for should be packaged as a
.war
("web archive"). - In the "standard project template", the
.war
file needs to be placed in thedeploy/lib/
folder. This needs to happen before the FWD server is started and before any code is copied from there to make a deployment. - 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: EXAMPLE
- 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.
- The
.war
files must currently have aweb.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.