Getting started

Getting essential

The best way to get essential is via Maven. See Download for more information.

Getting a client

For testing your resource implementations, rest-client is a valuable helper for the beginning. It is a visual HTTP client - available for free, easy to use and with support for HTTP authentication. Moreover, it allows you to save requests and to write custom test templates.

Also, essential comes along with its own REST client for programmatic use and a testsuite for unit and integration test development.

The servlet context

essential was designed to be usable in any Java environment. Nevertheless, in order to give developers a quick start, it comes along with a premade context implementation for Servlet Containers. So, 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.