The HTTP Servlet context is meant for usage in servlet containers like Tomcat, Jetty and others.
To use essential in a servlet context, add the following to your web.xml.
<servlet> <servlet-name>MyServletName</servlet-name> <servlet-class>net.craftforge.essential.context.servlet.EssentialHttpServlet</servlet-class> <init-param> <param-name>package</param-name> <param-value>my.resource.implementations</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>MyServletName</servlet-name> <url-pattern>/MyServletPath/*</url-pattern> </servlet-mapping>
Choose a name for you servlet and point to the EssentialHttpServlet class. The init parameter "package" tells essential where to find your resource implementation classes. essential will handle all requests matching the URL pattern in the servlet mapping.
<dependency> <groupId>net.craftforge.essential</groupId> <artifactId>essential-servlet</artifactId> <version>2.0-beta2</version> </dependency>