LibraryLink ToToggle FramesPrintFeedback

Using a Custom Servlet

In some cases, you might want to write a custom servlet that deploys FUSE Services Framework enabled endpoints. A common reason is to deploy FUSE Services Framework client applications into a servlet container. The CXF servlet does not support deploying pure client applications.

The procedure for using a custom servlet is similar to the one for using the default CXF servlet:

There are a few important differences between using the CXF servlet and using a custom servlet:

Implementing the servlet is easy. You simply add logic to the servlet’s constructor to instantiate the FUSE Services Framework endpoint. Example 6.3 shows an example of instantiating a consumer endpoint in a servlet.


If you choose not to use the default location for the configuration file, then you must add code for loading the configuration file. To load the configuration from a custom location do the following:

  1. Use the ServletContext to resolve the file location into a URL.

  2. Create a new bus for the application using the resolved URL.

  3. Set the application’s default bus to the newly created bus.

Example 6.4 shows an example of loading the configuration from the WEB-INF/client.xml file.


Depending on what other features you want to use, you might need to add additional code to your servlet. For example, if you want to use WS-Security in a consumer you must add code to your servlet to load the credentials and add them to your requests.

To deploy your application to a servlet container you must build a WAR file that has the following directories and files: