Lesson 1
Java Servlets and the Java Servlet API
HTTP Requests
The Java Servlet API allows a software developer to add dynamic content to a Web server using the Java platform.
The generated content is commonly HTML, but may be other data such as XML. Servlets are the Java counterpart to non-Java dynamic Web content technologies such as PHP, CGI and ASP.NET.
Servlets can maintain state across many server transactions by using HTTP cookies, session variables or URL rewriting.
In this module you will review how HTTP works to get information from a Web server to a user. One of the most important aspects of HTTP, is that
every request to a web server is completely independent of the previous ones. We will discuss three other major server side technologies and what a servlet is and how it functions. Ater completing this module, you will be able to:
- Describe how a Web browser requests information from a Web server
- Describe how a Web server provides information to a Web browser
- List some features of CGI
- List some features of SSI
- List some features of ASP
- Compare servlets to other server-side technology
- Describe what a servlet is
Sun Java Web Server becomes Oracle iPlanet Web Server
When Oracle acquired Sun Microsystems in 2010, they did not retire the Sun Java Web Server but rather renamed it to Oracle iPlanet Web Server. Here's how the transition went:
- Rebranding: After the acquisition, Sun Java System Web Server was rebranded to Oracle iPlanet Web Server. This rebranding reflected Oracle's intent to continue supporting and maintaining the product under their own branding.
- Continued Maintenance: Oracle has continued to maintain and release updates for Oracle iPlanet Web Server, with versions like 7.0.27 being released in October 2017, indicating ongoing support post-acquisition.
- Product Evolution: The server software has seen updates and patches over the years, focusing on security, performance enhancements, and compatibility with newer versions of Java and other technologies.
This information is supported by various sources discussing the product's evolution post-acquisition:
- The transition from Sun Java System Web Server to Oracle iPlanet Web Server after the Oracle acquisition is documented.
- Oracle's continued maintenance approach for the server is evident from their hardware and software product pages.
Therefore, Oracle did not retire the Sun Java Web Server but instead integrated it into their product lineup with continued support and maintenance.
Servlets Support Several Capabilities
Servlets support several capabilities that are difficult or impossible to accomplish with regular CGI. Servlets can talk directly to the Web server, whereas regular CGI programs cannot, at least not without using a server-specific API. Communicating with the Web server makes it easier to translate relative URLs into concrete path names, for instance. Multiple servlets can also share data, making it easy to implement database connection pooling and similar resource-sharing optimizations. Servlets can also maintain information from request to request, simplifying techniques like session tracking and caching of previous computations.
- Portable: Servlets are written in the Java programming language and follow a standard API. Servlets are supported directly or by a plugin on virtually every major web server. Consequently, servlets written for Tomcat can run virtually unchanged on Microsoft Internet Information Server (with a separate plugin), IBM WebSphere, or Oracle WebLogic Server. They are part of the Java 2 Platform, Enterprise Edition (J2EE; https://www.oracle.com/technetwork/java/javaee/overview/index.html),
so industry support for servlets is becoming even more pervasive.
Inexpensive
A number of free or very inexpensive Web servers are good for development use or deployment of low or medium-volume websites. Thus, with servlets and JSP you can start with a free server such as Tomca 10 and migrate to more expensive servers with high-performance capabilities or advanced administration utilities only after your project meets initial success.
Buying a special-purpose web server from a U.S. company consumes a large part of early project funds. But, with servlets and JSP, you can start with a free server known as Apache Tomcat. Once the project starts to become successful, you can move to a server like IBM WebSphere that has higher performance and easier administration but is not free. But none of your server side Java Code (servlets or JSP pages) has to be rewritten. If your project becomes even larger, you might want to move to a distributed (clustered) environment or a cloud solution such as AWS or Google Cloud. If the project becomes quite large and complex, you might want to use Spring Boot 3.0 to encapsulate your business logic. So, iniially you might switch to Oracle WebLogic or IBM Websphere if you are looking for an enterprise solution.Finally, if your project becomes even bigger, you might move it from a Linux solution onto AWS or (GCP) Google Cloud Platform.