alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Jetty example source code file (web.xml)

This example Jetty 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 - Jetty tags/keywords

comment, comment, delete, iso-8859-1, put, put, realm, realm, role, user, webapp, webapp

The Jetty web.xml source code

<?xml version="1.0" encoding="ISO-8859-1"?>
<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>Test WebApp
  
  <listener>
    <listener-class>com.acme.TestListener
  </listener>

  <filter>
    <filter-name>TestFilter
    <filter-class>com.acme.TestFilter
  </filter>

  <filter-mapping>
    <filter-name>TestFilter
    <url-pattern>/dump/*
    <url-pattern>/dispatch/*
    <url-pattern>*.dump
    <servlet-name>*
    <dispatcher>REQUEST
    <dispatcher>FORWARD
    <dispatcher>INCLUDE
    <dispatcher>ERROR
  </filter-mapping>
  
  <filter>
    <filter-name>MultiPart
    <filter-class>org.mortbay.servlet.MultiPartFilter
    <init-param>
      <param-name>deleteFiles
      <param-value>true
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>MultiPart
    <url-pattern>/dump/*
  </filter-mapping>
  
  <filter>
    <filter-name>GzipFilter
    <filter-class>org.mortbay.servlet.jetty.IncludableGzipFilter
    <init-param>
      <param-name>bufferSize
      <param-value>8192
    </init-param>
    <init-param>
      <param-name>minGzipSize
      <param-value>1024
    </init-param>
    <init-param>
      <param-name>userAgent
      <param-value>(?:Mozilla[^\(]*\(compatible;\s*+([^;]*);.*)|(?:.*?([^\s]+/[^\s]+).*)
    </init-param>
    <init-param>
      <param-name>cacheSize
      <param-value>1024
    </init-param>
    <init-param>
      <param-name>excludedAgents
      <param-value>MSIE 6.0
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>GzipFilter
    <url-pattern>/*
  </filter-mapping>
  
  
  <filter>
    <filter-name>Chat
    <filter-class>com.acme.ChatFilter
  </filter>
  <filter-mapping>
    <filter-name>Chat
    <url-pattern>/chat/*
    <dispatcher>REQUEST
    <dispatcher>FORWARD
  </filter-mapping>
  
  <filter>
    <filter-name>Throttle
    <filter-class>org.mortbay.servlet.ThrottlingFilter
  </filter>
  
  <filter-mapping>
    <filter-name>Throttle
    <url-pattern>/dump/throttle/*
  </filter-mapping>

  <!-- Comment out to support PUT and DELETE
  <filter>
    <filter-name>RestFilter
    <filter-class>org.mortbay.servlet.RestFilter
    <init-param>
      <param-name>maxPutSize1024
    </init-param>
  </filter>
  
  <filter-mapping>
    <filter-name>RestFilter
    <servlet-name>default
    <dispatcher>REQUEST
  </filter-mapping>
  -->


  <servlet>
    <servlet-name>Hello
    <servlet-class>com.acme.HelloWorld
    <load-on-startup>1
  </servlet>

  <servlet-mapping>
    <servlet-name>Hello
    <url-pattern>/hello/*
  </servlet-mapping>
  
  <servlet>
    <servlet-name>Dump
    <servlet-class>com.acme.Dump
    <load-on-startup>1
    <run-as>admin
  </servlet>

  <servlet-mapping>
    <servlet-name>Dump
    <url-pattern>/dump/*
    <url-pattern>*.dump
  </servlet-mapping>

  <servlet>
    <servlet-name>Session
    <servlet-class>com.acme.SessionDump
    <load-on-startup>1
  </servlet>
  
  <servlet-mapping>
    <servlet-name>Session
    <url-pattern>/session/*
  </servlet-mapping>
  
  <servlet>
    <servlet-name>Cookie
    <servlet-class>com.acme.CookieDump
    <load-on-startup>1
  </servlet>
  
  <servlet-mapping>
    <servlet-name>Cookie
    <url-pattern>/cookie/*
  </servlet-mapping>
  
  <servlet>
    <servlet-name>Dispatch
    <servlet-class>com.acme.DispatchServlet
    <load-on-startup>1
  </servlet>
  
  <servlet-mapping>
    <servlet-name>Dispatch
    <url-pattern>/dispatch/*
  </servlet-mapping>
  
  <servlet>
    <servlet-name>JspSnoop
    <jsp-file>/snoop.jsp
    <load-on-startup>1
  </servlet>
  
  <servlet-mapping>
    <servlet-name>JspSnoop
    <url-pattern>/jspsnoop/*
  </servlet-mapping>
   
  <servlet>
    <servlet-name>CGI
    <servlet-class>org.mortbay.servlet.CGI
    <load-on-startup>1
  </servlet>
  
  <servlet-mapping>
    <servlet-name>CGI
    <url-pattern>/cgi-bin/*
  </servlet-mapping>
  
  <servlet>
    <servlet-name>Concat
    <servlet-class>org.mortbay.servlet.ConcatServlet
    <init-param>
      <param-name>development
      <param-value>true
    </init-param>
    
    <load-on-startup>1
  </servlet>
  
  <servlet-mapping>
    <servlet-name>Concat
    <url-pattern>/concat
  </servlet-mapping>
  
  <error-page>
    <error-code>404
    <location>/jspsnoop/ERROR/404
  </error-page>
  
  <error-page>
    <exception-type>java.io.IOException
    <location>/jspsnoop/IOException
  </error-page>

  <security-constraint>
    <web-resource-collection>
      <web-resource-name>Any User
      <url-pattern>/dump/auth/*
      <url-pattern>*.htm
    </web-resource-collection>
    <auth-constraint>
      <role-name>*
    </auth-constraint>
  </security-constraint>

  <security-constraint>
    <web-resource-collection>
      <web-resource-name>relax
      <url-pattern>/dump/auth/relax/*
      <url-pattern>/auth/relax.txt
      <http-method>GET
      <http-method>HEAD
    </web-resource-collection>
  </security-constraint>

  <security-constraint>
    <web-resource-collection>
      <web-resource-name>Admin Role
      <url-pattern>/dump/auth/admin/*
    </web-resource-collection>
    <auth-constraint>
      <role-name>content-administrator
    </auth-constraint>
  </security-constraint>

  <security-constraint>
    <web-resource-collection>
      <web-resource-name>Forbidden
      <url-pattern>/dump/auth/noaccess/*
      <url-pattern>/auth/*
    </web-resource-collection>
    <auth-constraint/>
  </security-constraint>

  <security-constraint>
    <web-resource-collection>
      <web-resource-name>SSL
      <url-pattern>/dump/auth/ssl/*
    </web-resource-collection>
    <user-data-constraint>
      <transport-guarantee>CONFIDENTIAL
    </user-data-constraint>
  </security-constraint>

<!--
  <login-config>
    <auth-method>BASIC
    <realm-name>Test Realm
  </login-config>
-->

<!--
  <login-config>
    <auth-method>DIGEST
    <realm-name>Test Realm
  </login-config>
-->

  <login-config>
    <auth-method>FORM
    <realm-name>Test Realm
    <form-login-config>
       <form-login-page>/logon.html?param=test
       <form-error-page>/logonError.html?param=test
    </form-login-config>
  </login-config>

  <jsp-config>
    <taglib>
      <taglib-uri>
        http://www.acme.com/taglib
      </taglib-uri>
      <taglib-location>
        /WEB-INF/acme-taglib.tld
      </taglib-location>
    </taglib>

    <taglib>
      <taglib-uri>
        http://www.acme.com/taglib2
      </taglib-uri>
      <taglib-location>
        /WEB-INF/acme-taglib2.tld
      </taglib-location>
    </taglib>
  </jsp-config>
  
  <session-config>
    <session-timeout>5
  </session-config>

</web-app>


Other Jetty examples (source code examples)

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

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 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.