Documentation Configuring the web. For more details, see the Eclipse Jetty 9. Java web applications use a deployment descriptor file to determine how URLs map to servlets, which URLs require authentication, and other information.
This file is named web. For more information about the web. About Deployment Descriptors A web application's deployment descriptor describes the classes, resources and configuration of the application and how the web server uses them to serve web requests. When the web server receives a request for the application, it uses the deployment descriptor to map the URL of the request to the code that ought to handle the request.
The deployment descriptor is a file named web. Here is a simple web. The web server uses this configuration to identify the servlet to handle a given request and call the class method that corresponds to the request method e. You can declare multiple servlets using the same class with different initialization parameters. The name for each servlet must be unique across the deployment descriptor. The standard does not support wildcards in the middle of a string, and does not allow multiple wildcards in one pattern.
The servlet can access its initialization parameters by getting its servlet configuration using its own getServletConfig method, then calling the getInitParameter method on the configuration object using the name of the parameter as an argument. For example, if an app has a JSP file named start. The deployment descriptor can specify a list of filenames that the server should try when the user accesses a path that represents a WAR subdirectory that is not already explicitly mapped to a servlet.
The servlet standard calls this the "welcome file list. A filter may perform an auxiliary task such as logging, performing specialized authentication checks, or annotating the request or response objects before calling the servlet. Filters allow you to compose request processing tasks from the deployment descriptor. A filter class implements the javax. Filter interface, including the doFilter method. Here is an simple filter implementation that logs a message, and passes control down the chain, which may include other filters or a servlet, as described by the deployment descriptor: You can also map filters directly to other servlets.
Filters are not invoked on static assets, even if the path matches a filter-mapping pattern. Static files are served directly to the browser. Error Handlers You can customize what the server sends to the user when an error occurs, using the deployment descriptor. The server can display an alternate page location when it's about to send a particular HTTP status code, or when a servlet raises a particular Java exception. At present, you cannot configure custom error handlers for some error conditions.
Specifically, you cannot customize the response page when no servlet mapping is defined for a URL, the quota error page, or the server error page that appears after an App Engine internal error. However, the load actually occurs during the first request handled by the web server instance, not prior to it. Some deployment descriptor elements can take a human readable display name, description and icon for use in IDEs.
App Engine doesn't use these, and ignores them. Notification of the destruction of servlets, servlet context, or filters is not supported. Security Constraints are not supported: Was this page helpful? Let us know how we did: Send feedback Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 3.
For details, see our Site Policies. Last updated February 16,