Implements a Servlet to enable Webjars resources for Servlet 2.x API compliant Java EE containers that do not support the Servlet 3.x API
-
Register Maven dependency:
<dependency> <groupId>org.webjars</groupId> <artifactId>webjars-servlet-2.x</artifactId> <version>1.6</version> </dependency>
-
Register servlet in your web.xml
<!--Webjars Servlet--> <servlet> <servlet-name>WebjarsServlet</servlet-name> <servlet-class>org.webjars.servlet.WebjarsServlet</servlet-class> <load-on-startup>2</load-on-startup> </servlet> <servlet-mapping> <servlet-name>WebjarsServlet</servlet-name> <url-pattern>/webjars/*</url-pattern> </servlet-mapping>
-
If you want to disable webjars resources caching you can use the
disableCache
configuration property. Eg:<!--Webjars Servlet--> <servlet> <servlet-name>WebjarsServlet</servlet-name> <servlet-class>org.webjars.servlet.WebjarsServlet</servlet-class> <init-param> <param-name>disableCache</param-name> <param-value>true</param-value> </init-param> <load-on-startup>2</load-on-startup> </servlet>