Sie sind auf Seite 1von 9

Instituto Politcnico Nacional

Escuela Superior de Cmputo

THEMATIC UNIT I:
Introduction to Web Applications

M. en C. Hermes Francisco Montes Casiano


hermes.escom@gmail.com
Structure of a Web Application Configuration files

ndice

1 Structure of a Web Application


Directory Structure

2 Configuration files

2/7
THEMATIC UNIT I: Introduction to Web Applications Hermes Francisco Montes Casiano
Structure of a Web Application Configuration files

Introduction
A Web application exists as a structured hierarchy of
directories.
The root of this hierarchy serves as the document root for files
that are part of the application.
Example
For a Web application with the context path /catalog in a Web
container, the index.html file at the base of the Web application
hierarchy

Context Path
Since the context path of an application determines the URL
namespace of the contents of the Web application, Web containers
must reject Web applications defining a context path that could
cause potential conflicts in this URL namespace.
3/7
THEMATIC UNIT I: Introduction to Web Applications Hermes Francisco Montes Casiano
Structure of a Web Application Configuration files

Introduction

A special directory exists within the application hierarchy


named WEB-INF.
WEB-INF Directory
Contains all things related to the application that arent in the
document root of the application, and is not part of the public
document tree of the application.

3/7
THEMATIC UNIT I: Introduction to Web Applications Hermes Francisco Montes Casiano
Structure of a Web Application Configuration files

WEB-INF Directory

The contents of the WEB-INF directory are:


The /WEB-INF/web.xml deployment descriptor.
The /WEB-INF/classes/ directory for servlet and utility
classes. The classes in this directory must be available to the
application class loader.
The /WEB-INF/lib/*.jar area for Java ARchive files. The Web
application class loader must be able to load classes from any
of these archive files.

WEB-INF Private resources


Also, except for the case where static resources are packaged in
JAR files, any requests from the client to access the resources in
WEB-INF/ directory must be returned with a
SC_NOT_FOUND(404) response.
4/7
THEMATIC UNIT I: Introduction to Web Applications Hermes Francisco Montes Casiano
located inofa adirectory
Structure called exampleapp, and can be accessed by the URL http://localhost:808
Web Application Configuration files
exampleapp/. Here, /exampleapp/ is called the context path for the Web application. The context pa
refers to everything in the URL after the server and port number, and is the part of the URL that is us
to resolve theSample structure
location of the resource.

webapps/

exampleapp/
index.jsp
contact.html

images/
photo.jpg
graphic.png
META-INF/

WEB-INF/
web.xml

classes/
SampleServlet.class

lib/
struts.jar

tags/
Figure 7-1: Directory structure
5/7for a sample Web application
THEMATIC UNIT I: Introduction to Web Applications Hermes Francisco Montes Casiano
Structure of a Web Application Configuration files

ndice

1 Structure of a Web Application

2 Configuration files
Configuration files

6/7
THEMATIC UNIT I: Introduction to Web Applications Hermes Francisco Montes Casiano
Structure of a Web Application Configuration files

Web Application Deployment Descriptor (web.xml)

A deployment descriptor is an XML file that contains


configuration information used by the Web application for
execution on the Servlet engine.
Location
The deployment descriptor for a Web application is the
TOMCAT_HOME/webapps/webapp_name/WEB-INF/web.xml
file.

7/7
THEMATIC UNIT I: Introduction to Web Applications Hermes Francisco Montes Casiano
Structure of a Web Application Configuration files

Web Application Deployment Descriptor (web.xml)

A deployment descriptor is an XML file that contains


configuration information used by the Web application for
execution on the Servlet engine.
The web.xml inlcude de following configuration and
deployment information:
1 ServletContext Init Parameters
2 Session Configuration
3 Servlet/JSP Definitions
4 Servlet/JSP Mappings
5 MIME Type Mappings
6 Welcome File list
7 Error Pages
8 Security

7/7
THEMATIC UNIT I: Introduction to Web Applications Hermes Francisco Montes Casiano

Das könnte Ihnen auch gefallen