<?xml version="1.0" encoding="UTF-8"?>
<!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
      version="3.0"> 

    <display-name>Apache ActiveMQ REST API</display-name>

    <servlet>
        <servlet-name>MessageServlet</servlet-name>
        <servlet-class>org.apache.activemq.web.MessageServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
        <async-supported>true</async-supported>
        <!--
        Uncomment this parameter if you plan to use multiple consumers over REST
        <init-param>
                <param-name>destinationOptions</param-name>
                <param-value>consumer.prefetchSize=1</param-value>
        </init-param>
        -->
        <!--
        Uncomment this parameter if you plan to change the default max size of a message over REST. By default, it is set
        to 100,000. Set it to -1 to disable the limitation but be aware that your AMQ instance could run out of memory if
        the message is too big. See https://issues.apache.org/jira/browse/AMQ-8029 for more details.
        <init-param>
            <param-name>maxMessageSize</param-name>
            <param-value>-1</param-value>
        </init-param>
        -->
    </servlet>

    <servlet>
        <servlet-name>jolokia-agent</servlet-name>
        <servlet-class>org.jolokia.http.AgentServlet</servlet-class>
        <!-- Uncomment this if you want jolokia multicast discovery to be enabled         
        <init-param>
          <param-name>discoveryEnabled</param-name>
          <param-value>true</param-value>
        </init-param>      
        <init-param>
          <param-name>discoveryAgentUrl</param-name>
          <param-value>http://${host}:8161/api/jolokia</param-value>
        </init-param>
        <init-param>
          <param-name>agentDescription</param-name>
          <param-value>Apache ActiveMQ</param-value>
        </init-param>
        -->
        <init-param>
            <param-name>policyLocation</param-name>
            <param-value>${prop:jolokia.conf}</param-value>
        </init-param>
        <!-- turn off returning exceptions and stacktraces from jolokia -->
        <init-param>
          <param-name>allowErrorDetails</param-name>
          <param-value>false</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup> 
    </servlet>

    <servlet-mapping>
        <servlet-name>MessageServlet</servlet-name>
        <url-pattern>/message/*</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>jolokia-agent</servlet-name>
        <url-pattern>/jolokia/*</url-pattern>
    </servlet-mapping>

    <session-config>
        <cookie-config>
            <http-only>true</http-only>
        </cookie-config>
    </session-config>

</web-app>
