Skip to content

Configuring Servlets

johnmcclean-aol edited this page Feb 28, 2015 · 6 revisions

Configuring Global Servlets

These Servlets will be available on all Microservices sharing a core Spring context.

In order to automagically add a Servlet to your Microservice, implement the interface ServletConfiguration on a Spring bean. If the bean implementing ServeltConfiguration is also a Servle only the method getMapping() need be implemented. This will be the context URL of your Servlet.

     public Class<? extends Servlet> getServlet()

Override the above method to configure a specified Servlet class. Typically used for Servlets in external jar files.

     public String getName()

To change the Servlet name to something other than the Class name.

     public Map<String,String> getInitParameters()

To configure the init parameters for the Servlet

#Configuring Local Servlets

These Servlets will only be available on the Microservice modules they are configured against.

In your Module object override

 public Map<String,Servelt> getServlets()

To configure module local servlets and their contexts Urls .

 public Class<? extends ServletConfiguration>[] getServletConfigurationClass()