Listato 5. Web.xml dell'applicazione che utilizza JavaMail

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
  <display-name>MailServlet</display-name>
  <servlet>
    <description></description>
    <display-name>MailServlet</display-name>
    <servlet-name>MailServlet</servlet-name>
    <servlet-class>email.MailServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>MailServlet</servlet-name>
    <url-pattern>/MailServlet</url-pattern>
  </servlet-mapping>
  <security-constraint>
    <web-resource-collection>
      <web-resource-name>Area Riservata</web-resource-name>
      <url-pattern>/MailServlet/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
      <role-name>admin</role-name>
    </auth-constraint>
  </security-constraint>  
  <login-config>
    <auth-method>BASIC</auth-method>
    <realm-name>Richiesta Autenticazione</realm-name>
  </login-config>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
</web-app>