<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2009-2013 Roland Huss
  ~
  ~ Licensed 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://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
         version="3.1">

  <display-name>JSON JMX Agent</display-name>

  <servlet>
    <servlet-name>jolokia-agent</servlet-name>
    <servlet-class>org.jolokia.http.AgentServlet</servlet-class>
    <init-param>
      <description>
        Class names (comma separated) of RequestDispatcher used in addition
        to the LocalRequestDispatcher
      </description>
      <param-name>dispatcherClasses</param-name>
      <param-value>org.jolokia.jsr160.Jsr160RequestDispatcher</param-value>
    </init-param>
    <init-param>
      <description>
        Debugging state after startup. Can be changed via
        the Config MBean during runtime
      </description>
      <param-name>debug</param-name>
      <param-value>false</param-value>
    </init-param>
    <init-param>
      <description>
        Entries to keep in the history. Can be changed during
        runtime via the config MBean
      </description>
      <param-name>historyMaxEntries</param-name>
      <param-value>10</param-value>
    </init-param>
    <init-param>
      <description>
        Maximum number of entries to keed in the local
        debug history if switched on. Can be change via
        the config MBean during runtime.
      </description>
      <param-name>debugMaxEntries</param-name>
      <param-value>100</param-value>
    </init-param>
    <init-param>
      <description>
        Maximum depth when traversing bean properties.
        If set to 0, depth checking is disabled
      </description>
      <param-name>maxDepth</param-name>
      <param-value>15</param-value>
    </init-param>
    <init-param>
      <description>
        Maximum size of collections returned when
        serializing to JSON. When set to 0, not
        collections are truncated.
      </description>
      <param-name>maxCollectionSize</param-name>
      <param-value>1000</param-value>
    </init-param>
    <init-param>
      <description>
        Maximum number of objects which is traversed
        when serializing a single response. Use this
        as airbag to avoid boosting your memory and
        network traffic. Nevertheless, when set to 0
        not limit is used.
      </description>
      <param-name>maxObjects</param-name>
      <param-value>0</param-value>
    </init-param>
    <init-param>
      <description>
        Options specific for certain application
        server detectors. Detectors can evaluate these
        options and perform a specific initialization based
        on these options. The value is a JSON object with
        the detector's name as key and the options as value.
        E.g. '{glassfish: {bootAmx: false}}' would prevent
        the booting of the AMX subsystem on a glassfish with
        is done by default.
      </description>
      <param-name>detectorOptions</param-name>
      <param-value>{}</param-value>
    </init-param>
    <init-param>
      <description>
        This option specifies in which order the key-value properties within
        ObjectNames as returned by "list" or "search" are returned. By default
        this is the so called 'canonical order' in which the keys are sorted
        alphabetically. If this option is set to "false", then the natural
        order is used, i.e. the object name as it was registered. This option
        can be overridden with a query parameter of the same name.
      </description>
      <param-name>canonicalNaming</param-name>
      <param-value>true</param-value>
    </init-param>
    <init-param>
      <description>
        Whether to include a stacktrace of an exception in case
        of an error. By default it it set to "true" in which case
        the stacktrace is always included. If set to "false", no
        stacktrace is included. If the value is "runtime" a stacktrace
        is only included for RuntimeExceptions. This global option
        can be overridden with a query parameter.
      </description>
      <param-name>includeStackTrace</param-name>
      <param-value>true</param-value>
    </init-param>
    <init-param>
      <description>
        When this parameter is set to "true", then an exception thrown
        will be serialized as JSON and included in the response
        under the key "error_value". By default it is "false". This global
        option can be overridden by a query parameter of the same name.
      </description>
      <param-name>serializeException</param-name>
      <param-value>false</param-value>
    </init-param>
    <init-param>
      <description>
        If discoveryEnabled is set to true, then this servlet will listen
        for multicast discovery request and responds with its agent URL and
        other server specific information. Instead of setting this confog variable,
        discovery can be also enabled via the system property "jolokia.discoveryEnabled"
        or the environment variable "JOLOKIA_DISCOVERY_ENABLED".

        In addition the config parameter "discoveryAgentUrl" can be used to set the the agent's URL.
        By default, auto detection (after the first request was processed by the servlet)) of the URL is used.
        If the URL is set, then discovery is automatically enabled (i.e. there is
        no need to set "discoveryEnabled=true"). This configuration option
        is especially useful if the WAR is used in a proxy setup. Instead of setting the URL
        here, it can be set also either via the system property "jolokia.discoveryAgentUrl" or the
        environment variable "JOLOKIA_DISCOVERY_AGENT_URL".
      </description>
      <param-name>discoveryEnabled</param-name>
      <param-value>false</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>

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

  <!--
  Example Configuration for switching on BASIC security. The role 'Jolokia'
  must be mapped to real users with passwords on the Appserver side:

  <login-config>
    <auth-method>BASIC</auth-method>
    <realm-name>Jolokia</realm-name>
  </login-config>

  <security-constraint>
    <web-resource-collection>
      <web-resource-name>Jolokia-Agent Access</web-resource-name>
      <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
      <role-name>Jolokia</role-name>
    </auth-constraint>
  </security-constraint>

  <security-role>
    <role-name>Jolokia</role-name>
  </security-role>
  -->
</web-app>

<!--
  Copyright 2009-2010 Roland Huss

  Licensed 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.
-->

