=== Configuring CamelHttpTransportServlet

==== Minimal configuration

The simplest way to configure `CamelHttpTransportServlet` is with configuration properties.
The most minimal setup requires that you define one or more URL patterns for the Servlet with `quarkus.camel.servlet.url-patterns`.

For example with configuration like the following.

[source,properties]
----
quarkus.camel.servlet.url-patterns = /*
----

And a Camel route.

[source,java]
----
from("servlet://greet")
    .setBody().constant("Hello World");
----

Produces the message `Hello World`.

==== Advanced configuration

*Servlet name*

To give a specific name to the Servlet you can use the `quarkus.camel.servlet.servlet-name` configuration option.

[source,properties]
----
quarkus.camel.servlet.servlet-name = My Custom Name
----

*Servlet class*

You may use a custom Servlet class (E.g one that extends `CamelHttpTransportServlet`) in your Camel routes.

[source,properties]
----
quarkus.camel.servlet.servlet-class = org.acme.MyCustomServlet
----

*Multiple named Servlets*

For more advanced use cases you can configure multiple 'named' Servlets.

[source,properties]
----
quarkus.camel.servlet.my-servlet-a.servlet-name = my-custom-a
quarkus.camel.servlet.my-servlet-a.url-patterns = /custom/a/*

quarkus.camel.servlet.my-servlet-b.servlet-name = my-custom-b
quarkus.camel.servlet.my-servlet-b.servlet-class = org.acme.CustomServletB
quarkus.camel.servlet.my-servlet-b.url-patterns = /custom/b/*
----

[source,java]
----
from("servlet://greet?servletName=my-custom-a")
    .setBody().constant("Hello World");

from("servlet://goodbye?servletName=my-custom-b")
    .setBody().constant("Goodbye World");
----

*Finer control of Servlet configuration*

If you need more control of the Servlet configuration, for example to configure custom init parameters,
then you can do this with a custom Servlet class through the `jakarta.servlet.annotation.WebServlet` annotation options.

[source,java]
----
import jakarta.servlet.annotation.WebServlet;
import org.apache.camel.component.servlet.CamelHttpTransportServlet;

@WebServlet(
    urlPatterns = {"/*"},
    initParams = {
        @WebInitParam(name = "myParam", value = "myValue")
    }
)
public class MyCustomServlet extends CamelHttpTransportServlet {
}
----

Or you can configure the `CamelHttpTransportServlet` using a `web-app` descriptor placed into `src/main/resources/META-INF/web.xml`.

[source,xml]
----
<web-app>
  <servlet>
    <servlet-name>CamelServlet</servlet-name>
    <servlet-class>org.apache.camel.component.servlet.CamelHttpTransportServlet</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>CamelServlet</servlet-name>
    <url-pattern>/services/*</url-pattern>
  </servlet-mapping>
</web-app>
----
