BEA Home | Events | Solutions | Partners | Products | Services | Download | Developer Center | WebSUPPORT
| WebLogic Server Doc Home | HTTP Servlets | Previous Topic | Next Topic | Contents | Index | View as PDF

Overview of HTTP Servlets

The following sections provide an overview of Hypertext Transfer Protocol (HTTP) servlet programming and explain how to use HTTP servlets with WebLogic Server:

- What Is a Servlet?

- What You Can Do with Servlets

- Overview of Servlet Development

- Servlets and J2EE

- HTTP Servlet API Reference

What Is a Servlet?

A servlet is a Java class that runs in a Java-enabled server. An HTTP servlet is a special type of servlet that handles an HTTP request and provides an HTTP response, usually in the form of an HTML page. The most common use of WebLogic HTTP Servlets is to create interactive applications using standard Web browsers for the client-side presentation while WebLogic Server handles the business logic as a server-side process. WebLogic HTTP servlets can access databases, Enterprise JavaBeans, messaging APIs, HTTP sessions, and other facilities of WebLogic Server.

WebLogic Server fully supports HTTP servlets as defined in the Servlet 2.3 Proposed Final Draft, version 1 specification from Sun Microsystems. HTTP servlets form an integral part of the Java 2 Enterprise Edition (J2EE) standard.

What You Can Do with Servlets

- Create dynamic Web pages that use HTML forms to get end-user input and provide HTML pages that respond to that input. Examples of this utilization include online shopping carts, financial services, and personalized content.

- Create collaborative systems such as online conferencing.

- Servlets running in WebLogic Server have access to a variety of APIs and services. For example:

  - Session tracking—Allows a Web site to track a user's progress across multiple Web pages. This functionality supports Web sites such as e-commerce sites that use shopping carts. WebLogic Server supports session persistence to a database, providing fail-over between server down time and session sharing between clustered servers. For more information see Session Tracking from a Servlet.

  - JDBC drivers (including BEA)—JDBC drivers provide basic database access. With Weblogic Server's multitier JDBC implementations, you can take advantage of connection pools, server-side data caching, and transactions. For more information see Accessing Databases.

  - Security—You can apply various types of security to servlets, including using ACLs for authentication and Secure Sockets Layer (SSL) to provide secure communications.

  - Enterprise JavaBeans—Servlets can use Enterprise JavaBeans (EJB) to encapsulate sessions, data from databases, and other functionality.

  - Java Messaging Service (JMS)—JMS allows your servlets to exchange messages with other servlets and Java programs.

  - Java JDK APIs—Servlets can use the standard Java JDK APIs.

  - Forwarding requests—Servlets can forward a request to another servlet or other resource.

- Servlets written for any J2EE-compliant servlet engine can be easily deployed on WebLogic Server.

- Servlets and Java Server Pages (JSP) can work together to create an application.

Overview of Servlet Development

- Programmers of HTTP servlets utilize a standard API from JavaSoft, javax.servlet.http, to create interactive applications.

- HTTP servlets can read HTTP headers and write HTML coding to deliver a response to a browser client.

- Servlets are deployed on WebLogic Server as part of a Web Application. A Web Application is a grouping of application components such as servlet classes, JavaServer Pages (JSP), static HTML pages, images, and security. For more information see Administration and Configuration.

Servlets and J2EE

The Servlet 2.2 specification, part of the Java 2 Platform, Enterprise Edition, defines the implementation of the servlet API and the method by which servlets are deployed in enterprise applications. Deploying servlets on a J2EE-compliant server, such as WebLogic Server, is accomplished by packaging the servlets and other resources that make up an enterprise application into a single unit called a Web Application. A Web Application utilizes a specific directory structure to contain its resources and a deployment descriptor that defines how these resources interact and how the application is accessed by a client. A Web Application may also be deployed as an archive file called a .war file.

For more information on creating Web Applications, see Assembling and Configuring Web Applications. For an overview of servlet administration and deployment issues, see Administration and Configuration.

Note:

The Servlet 2.3 specification is part of the J2EE 1.3 specification. To use J2EE 1.3 features, please see WebLogic Server 6.1 with J2EE 1.2 and J2EE 1.3 Functionality.

WebLogic Server 6.1 with J2EE 1.2 and J2EE 1.3 Functionality

BEA WebLogic Server 6.1 is the first e-commerce transaction platform to implement advanced J2EE 1.3 features. To comply with the rules governing J2EE, BEA Systems provides two separate downloads: one with J2EE 1.3 features enabled, and one that is limited to J2EE 1.2 features only. Both downloads offer the same container and differ only in the APIs that are available.

WebLogic Server 6.1 with J2EE 1.2 Plus Additional J2EE 1.3 Features

With this download, WebLogic Server defaults to running with J2EE 1.3 features enabled. These features include EJB 2.0, JSP 1.2, Servlet 2.3, and J2EE Connector Architecture 1.0. When you run WebLogic Server 6.1 with J2EE 1.3 features enabled, J2EE 1.2 applications are still fully supported. WebLogic Server 6.1 supports the Proposed Final Draft version 1 of the Servlet 2.3 Specification with the following exceptions:

The <run-as> element is not supported.

The Proposed Final Draft version 1 differs from the Final version in

the following ways:

1. The Filter interface that we support has following methods:

doFilter(ServletRequest,ServletResponse,FilterChain)

getFilterConfig() Return the FilterConfig for this Filter.

setFilterConfig(Fil-terConfig) The container calls this

method when the Filter is instantiated and passes in a Filter-Config

2. The following listener classes have been renamed. The listeners which were affected were:

old: javax.servlet.ServletContextAttributesListener;

new: javax.servlet.ServletContextAttributeListener;

old: javax.servlet.http.HttpSessionAttributesListener;

new: javax.servlet.http.HttpSessionAttributeListener;

3. The getServletContext() method has been added to HttpSession

4. The ServletContext.getResourcePaths() method has been added to the directory argument

5. The status code 307 (temporary redirect) has been added to HttpServletResponse

WebLogic Server 6.1 with J2EE 1.2 Certification

With this download, WebLogic Server defaults to running with J2EE 1.3 features disabled and is fully compliant with the J2EE 1.2 specification and regulations.

HTTP Servlet API Reference

WebLogic Server supports the javax.servlet.http package in the Java Servlet 2.2 API. You can find additional documentation for the package from Sun Microsystems:

- API documentation

  - Package javax.servlet

  - Package javax.servlet.http

- Servlet 2.2 specification

Copyright © 2001 BEA Systems, Inc. All rights reserved. Required browser: Netscape 4.0 or higher, or Microsoft Internet Explorer 4.0 or higher.