This chapter provides a basic overview on various technologies that are supported in the Web Server.
Web Server is a major new release with significant enhancements in the administration infrastructure. This release is the first 64-bit version of Web Server supported on Solaris SPARC®, AMD64 and Linux platforms.
Web Server 7.0 provides:
Comprehensive command-line interface support
Web-based Distributed Authoring and Versioning (WDAV)
Access control lists (ACL)
This product also comes with a robust built-in migration tool that helps migrate applications and configurations from Web Server 6.0 and 6.1 to Sun Java System Web Server 7.0.
Sun Java System Web Server 7.0 introduces the following new features:
Java Web Services Developer Pack 2.0 support
Session replication support
Extensive real-time monitoring support
Integrated reverse proxy plug-in and FastCGI plug-in support
For more features and information, see Features and Enhancements in Update 2 Release in Sun Java System Web Server 7.0 Update 3 Release Notes.
Java servlets are server-side Java programs that generate content in response to a client request. Servlets can be thought of as applets that run on the server side without a user interface. Servlets are invoked through URL invocation or by other servlets.
Sun Java System Web Server 7.0 supports the Java Servlet 2.5 specification.
Java Servlet API version 2.5 is fully backward compatible with versions 2.1, 2.2, 2.3, and 2.5. Therefore, all existing servlets continues to work without modification or recompilation.
To develop servlets, use Sun's Java Servlet API. For information about using the Java Servlet API, see the documentation provided by Sun at http://java.sun.com/products/servlet/index.html.
For the Java Servlet 2.5 specification, see http://java.sun.com/products/servlet/download.html.
For information about developing servlets in Sun Java System Web Server, see Chapter 4, Developing Servlets
Web Server 7.0 supports the JavaServer Pages (JSP) 2.1 specification. A JSP page is, much like an HTML page, that can be viewed in a web browser. However, in addition to HTML tags, JSP can include a set of JSP tags and directives intermixed with Java code that extend the ability of the web page designer to incorporate dynamic content in a page. These additional features provide functionality such as displaying property values and using simple conditionals.
JSP pages can access full Java functionality using the following methods:
Embedding Java code directly into scriptlets
Using server-side tags that include Java servlets
Servlets are Java classes that must be compiled. Servlets can be defined and compiled by a Java programmer, who then publishes the interface to the servlet. The web page designer can access a precompiled servlet from a JSP page. For information about creating JSPages, see http://java.sun.com/products/jsp/index.html
The Java Server Pages Standard Tag Library (JSTL) encapsulates as simple tags the core functionality common to many web applications. JSTL has support for common, structural tasks such as iteration and conditionals, tags for manipulating XML documents, internationalization tags, and SQL tags. It also provides a framework for integrating existing custom tags with JSTL tags.
For more information on JSTL 1.2, see http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSTL.html#wp74644.
Web Services uses a Web Services Description Language (WSDL) file to describe the service and a registry service to register and lookup the services. The Simple Object Access Protocol (SOAP) binding is the standard interoperable binding for accessing Web Services. Based on Java Web Services Developer Pack (Java WSDP), Web Server supports integrated Java Web Services runtime and tools, and therefore supports portable Web Services implementations. For more information, see Chapter 3, Web Services Overview.
Web Server 7.0 provides Java Naming and Directory InterfaceTM (JNDI) API support that enables web applications to look up for Java Enterprise Edition (Java EE) services such as Java DataBase Connectivity (JDBCTM) data sources. All functional aspects of this JNDI implementation are essential. However, the web server's implementation does not support the CosNaming service required for remote objects as well as lookup of UserTransaction, ORB, JMS resources, or the EJB references.
In Web Server, JDBCRESOURCE and JDBCCONNECTIONPOOL elements in server.xml have been merged into one element called jdbc-resource to simplify JDBC configuration. Many of the configuration parameters have been renamed. For more information on the jdbc-resource element, see Chapter 3, Elements in server.xml, in Sun Java System Web Server 7.0 Update 3 Administrator’s Configuration File Reference.
Using JNDI, a web application can access a JDBC connection pool by looking up the jdbc-resource that configures it. The jdbc-resources can access the name in its web descriptor. The following web descriptors example refer to the connection pool created in the earlier example.
<web-app> ... <resource-ref> <description>JDBC Connection Pool</description> <res-ref-name>jdbc/myJdbc</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> ... </web-app>
<sun-web-app> ... <resource-ref> <res-ref-name>jdbc/myJdbc</res-ref-name> <jndi-name>jdbc/MyPool</jndi-name> </resource-ref> ... </sun-web-app>
In the above example, jdbc/myJdbc is the name by which the pool is referenced in the web application and jdbc/MyPool is the JNDI name of the jdbc-resources configuration.
The following is an example for using the pool in a web application.
Context initContext = new InitialContext(); Context webContext = (Context)initContext.lookup("java:/comp/env"); DataSource ds = (DataSource) webContext.lookup("jdbc/myJdbc"); Connection dbCon = ds.getConnection();
Web Server 7.0 provides support for the following tools:
Sun Java Studio Enterprise 8.1– Java Studio Enterprise 8.1 enables you create Java, Web, and EJB projects from existing code.
NetBeans IDE 5.5 – NetBeans IDE 5.5 is an integrated development environment to create, deploy the Java EE based web applications.
For more information, see Using NetBeans IDE 5.5.
Sun Java Studio Enterprise 8.1– Web Server 7.0 supports Sun Java Studio Enterprise 8.1, Standard Edition. You can use Sun Java Studio to assemble and deploy web applications. For more information, see Using Sun Java Studio Enterprise 8.1.
JSR 88 Support for Application Deployment - You can write your own Java Specification Request (JSR) 88 client to deploy applications to the Web Server 7.0. For more information, see http://jcp.org/en/jsr/detail?id=88.
Sun Java System Web Server 7.0 enables you to write customized classes for the various phases of the server lifecycle. For instance, a user may have a startup code that ensures that a remote data source is available for the applications. Such classes are notified of server lifecycle events supporting Java based tasks within the Web Server environment. These tasks automatically perform actions such as starting the server and sending notification if the server shuts down. You can use this support to instantiate singletons, RMI servers, and so forth. For more information, see List of Elements in Sun Java System Web Server 7.0 Update 3 Administrator’s Configuration File Reference
The intention of session replication is to provide sufficient session failover support through in-memory-backup of HTTP sessions to another server instance of the same cluster. This feature covers most usage scenarios. For more information, see Configuring Session Replication in Sun Java System Web Server 7.0 Update 3 Administrator’s Guide
Sun Java System Web Server has the following core components:
Web container implements the JSP 2.1, Servlet 2.5, and JSTL 1.2 specification which are part of Java EE 1.4.
Monitoring and configuring interfaces.
For more information about non-Java APIs and programming technologies, see the Sun Java System Web Server 7.0 Update 3 Developer’s Guide and the Sun Java System Web Server 7.0 Update 3 NSAPI Developer’s Guide.