## Name

Servlet — provides support for HTTP endpoints that are published as servlets

## Overview

You can only consume from endpoints generated by the Servlet component. Therefore, it should only be used as input into your Apache Camel routes. To issue HTTP requests against other HTTP endpoints, use the HTTP Component.

## URI format

The URI format of a Servlet endpoint is:

    servlet://relative_path[?options]

## Dependencies

Maven users will need to add the following dependency to their `pom.xml` for this component:

Example 10. Adding the servlet dependency

    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-servlet</artifactId>
        <version>x.x.x</version>
        <!-- use the same version as your Camel core version -->
    </dependency>

## Options

Table 28, “Servlet endpoint options” lists the options for a Servlet endpoint.

Table 28. Servlet endpoint options

Name | Default | Description
--- | --- | ---
`httpBindingRef` |  | Specifies a reference to an `org.apache.camel.component.http.HttpBinding` in the registry.
`matchOnUriPrefix` | `false` | Specifies if the `CamelServlet` should try to find a target consumer by matching the URI prefix if no exact match is found.
`servletName` |  | Specifies the servlet name that the endpoint will bind to. If there is no servlet name specified, the endpoint will be bind to first published Servlet.

## Message headers

Apache Camel will apply the same Message Headers as the HTTP component.

Apache Camel will also populate all `request.parameter` and `request.headers`. For example, if a client request has the URL, `http://myserver/myserver?orderid=123`, the exchange will contain a header named `orderid` with the value 123.

## Related topics

HTTP
HTTP4