29.01.2013 Views

WebSphere Application Server - IBM Redbooks

WebSphere Application Server - IBM Redbooks

WebSphere Application Server - IBM Redbooks

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Some elements of Example 4-1 on page 62 are discussed below.<br />

► is the root element and encompasses all other elements.<br />

► contains information for a servlet or JSP, including initialization<br />

parameters.<br />

► defines a mapping between a servlet and a URL pattern.<br />

This allows the servlet to be referenced in the application by a generic name.<br />

► contains an ordered list of welcome files in it. This is<br />

useful when a valid partial request is received. In such cases the server<br />

appends each welcome file in the order mentioned in this element and sends<br />

the request to the first resource that it matches.<br />

► is used to describe each tag library used in the application.<br />

Web application archive concept<br />

Along with the Web application concept, the Java Servlet Specification 2.3 also<br />

specifies a file format named Web archive (WAR) to package Web applications.<br />

All the elements contained within a Web application are compressed into a WAR<br />

file for deployment. Using WAR files allow Web applications to be packaged in a<br />

platform-independent way.<br />

4.2.1 A Web application in an application server<br />

Within the server the Web application is rooted at a specific path called the<br />

context path. All the requests from clients beginning with this path will be routed<br />

to the application.<br />

All the Java components of the same Web application share information and<br />

have access to the same pool of resources. This information is encapsulated in<br />

the servlet context provided by the servlet container. Since there is one and only<br />

one servlet context per Web application, servlet instances of a Web application<br />

will point to the same ServletContext instance.<br />

An application server can contain many Web applications with every Web<br />

application rooted to a specific path. The server manages a servlet context for<br />

each of these Web applications.<br />

The server is responsible for encapsulating the data sent by the client into an<br />

HttpServletRequest object. This task includes identifying the following elements,<br />

obtained from the client’s request for a URL:<br />

► Context path: The path prefix leading to the Web application. This context<br />

path is associated with the servlet context of the application.<br />

► Servlet path: The section of the requested URL that directly corresponds to<br />

the mapping that activated this request. Typically, mapping consists of<br />

64 <strong>IBM</strong> <strong>WebSphere</strong> <strong>Application</strong> <strong>Server</strong> - Express V5.0.2 Developer Handbook

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!