<application mode="{{ smartgears_application_mode }}">

        <name>{{ item.webapp_name }}</name>
        <group>{{ item.webapp_group }}</group>
        <version>{{ item.version }}</version>
{% if item.description is defined %}
        <description> {{ item.description }} </description>
{% endif %}
{% if webapp_proxy_endpoint is defined %}
        <proxy protocol="{{ webapp_proxy_protocol }}">
                <hostname>{{ webapp_proxy_endpoint }}</hostname>
{% if webapp_proxy_protocol == 'https' %}
                <port>{{ webapp_proxy_port  | default ('443') }}</port>
{% elif webapp_proxy_protocol == 'http' %}
                <port>{{ webapp_proxy_port  | default ('80') }}</port>
{% else %}
                <port>{{ webapp_proxy_port }}</port>
{% endif %}
         </proxy>
{% endif %}
{% if item.persistence_location is defined %}
        <persistence location="{{ item.persistence_location }}"/>
{% endif %}
{% if item.exclude_handlers is defined %}
{% for eh in item.exclude_handlers %}
        <exclude {{ eh }}</exclude>
{% endfor %}
{% endif %}        
{% if item.include_handlers is defined %}
{% for ih in item.include_handlers %}
        <include {{ ih }}</include>
{% endfor %}
{% endif %}        

</application>