Class ServletConfigWrapper

  • All Implemented Interfaces:
    ServletConfig

    public class ServletConfigWrapper
    extends Object
    implements ServletConfig
    A wrapper around an existing ServletConfig instance. By default it delegates all methods. However, it also allows initialization parameters to be added or overwritten. This can be useful when a sub class of some servlet needs to provide hard-coded or calculated initialization parameter values to its parent class. For instance:
    
     public void init(ServletConfig servletConfig) {
         super.init(new ServletConfigWrapper(servletConfig)
                 .withInitParameter("booleanParameter", true)
                 .withInitParameter("intParameter", 100));
     }
     
    Author:
    Rob Spoor