Network Deployment (Distributed operating systems), v8.0 > Applications > Web applications > Learn about web applications > Web applications
Servlets are Java programs that use the Java Servlet API. We must package servlets in a WAR file or web module for deployment to the application server. Servlets run on a Java-enabled web server and extend the capabilities of a web server, similar to the way applets run on a browser and extend the capabilities of a browser.
Servlets can support dynamic web page content, provide database access, serve multiple clients at one time, and filter data.
In the application server, discussions of servlets focus on HTTP servlets, which serve Web-based clients.
We can define servlets as welcome files. Non-servlet resources are served only when the fileServingEnabled attribute is set to true in the IBM extensions XMI file, ibm-web-ext.xmi, located in each Web module WEB-INF directory or by using an assembly tool to set the property in the source .war file. Serving welcome files is connected to serving static content. Therefore the fileServingEnabled attribute is set in the web module.
Supported configurations: For IBM extension and binding files, the .xmi or .xml file name extension is different depending on whether you are using a pre-Java EE 5 application or module or a Java EE 5 or later application or module. An IBM extension or binding file is named ibm-*-ext.xmi or ibm-*-bnd.xmi where * is the type of extension or binding file such as app, application, ejb-jar, or web. The following conditions apply:
- For an application or module that uses a Java EE version prior to version 5, the file extension must be .xmi.
- For an application or module that uses Java EE 5 or later, the file extension must be .xml. If .xmi files are included with the application or module, the product ignores the .xmi files.
However, a Java EE 5 or later module can exist within an application that includes pre-Java EE 5 files and uses the .xmi file name extension.
The ibm-webservices-ext.xmi, ibm-webservices-bnd.xmi, ibm-webservicesclient-bnd.xmi, ibm-webservicesclient-ext.xmi, and ibm-portlet-ext.xmi files continue to use the .xmi file extensions.
A servlet context defines the server view of the web application within which the servlet is running. The context also supports a servlet to access its available resourcest. Using the servlet context, a servlet can log events, obtain URL references to resources, and set and store attributes for other servlets in the context to use. These properties declare the parameters for the context of a web application. The properties convey setup information, such as the email address for the webmaster or the name of a system with critical data.
A servlet mapping is a correspondence between a client request and a servlet. Web containers use URL paths to map client requests to servlets, and follow the URL path-mapping rules as specified in the Java Servlet specification. The container uses the Uniform Resource Identifier (URI) from the request, minus the context path, as the path to map to a servlet. The container chooses the longest matching available context path from the list of web applications that it hosts.
Develop servlets with WAS extensions
Web applications: Resources for learning Concept topic