home | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Tomcat example source code file (web.xml)

This example Tomcat source code file (web.xml) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Tomcat tags/keywords

apache, application, application, asf, define, define, license, license, manager, manager, security, see, servlet, you

The Tomcat web.xml source code

<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
  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_2_5.xsd"
   version="2.5"> 

  <display-name>Tomcat Manager Application
  <description>
    A scriptable management web application for the Tomcat Web Server;
	Manager lets you view, load/unload/etc particular web applications.
  </description>

  <!-- Define the Manager Servlet
       Change servlet-class to: org.apache.catalina.servlets.HTMLManagerServlet
       to get a Servlet with a more intuitive HTML interface, don't change if you
       have software that is expected to parse the output from ManagerServlet
       since they're not compatible.
   -->
  <servlet>
    <servlet-name>HostManager
    <servlet-class>org.apache.catalina.manager.host.HostManagerServlet
    <init-param>
      <param-name>debug
      <param-value>2
    </init-param>
  </servlet>
  <servlet>
    <servlet-name>HTMLHostManager
    <servlet-class>org.apache.catalina.manager.host.HTMLHostManagerServlet
    <init-param>
      <param-name>debug
      <param-value>2
    </init-param>
  </servlet>

  <!-- Define the Manager Servlet Mapping -->
  <servlet-mapping>
    <servlet-name>HostManager
    <url-pattern>/list
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>HostManager
    <url-pattern>/add
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>HostManager
    <url-pattern>/remove
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>HostManager
    <url-pattern>/start
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>HostManager
    <url-pattern>/stop
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>HTMLHostManager
    <url-pattern>/html/*
  </servlet-mapping>

  <!-- Define a Security Constraint on this Application -->
  <security-constraint>
    <web-resource-collection>
      <web-resource-name>HTMLHostManager and HostManager commands
      <url-pattern>/html/*
      <url-pattern>/list
      <url-pattern>/add
      <url-pattern>/remove
      <url-pattern>/start
      <url-pattern>/stop
    </web-resource-collection>
    <auth-constraint>
       <!-- NOTE:  This role is not present in the default users file -->
       <role-name>admin
    </auth-constraint>
  </security-constraint>

  <!-- Define the Login Configuration for this Application -->
  <login-config>
    <auth-method>BASIC
    <realm-name>Tomcat Host Manager Application
  </login-config>

  <!-- Security roles referenced by this web application -->
  <security-role>
    <description>
      The role that is required to log in to the Manager Application
    </description>
    <role-name>admin
  </security-role>

</web-app>

Other Tomcat examples (source code examples)

Here is a short list of links related to this Tomcat web.xml source code file:



my book on functional programming

 

new blog posts

 

Copyright 1998-2019 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.