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
See also:
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 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 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.3 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.
HTTP Servlet API Reference
WebLogic Server supports the javax.servlet.http package in the Java Servlet 2.3 API. You can find additional documentation for the package from Sun Microsystems:
- API documentation
- Servlet 2.3 specification