Sun Java System Web Server 7.0 Developer's Guide to Java Web Applications

Sample Applications in Web Server 7.0

Sun Java System Web Server 7.0 includes a set of sample applications, which can be found in the install_dir/samplesfollowing directory.

Sample Directories

All of the sample applications are arranged in a specific and well-defined directory structure. In general, the top-level directory of a sample application includes the following:

Table 2–1 Sample Directories

Directory  

Contents  

caching

JSP and servlet examples that demonstrate how to cache results of JSP and servlet execution. 

fastcgi

A sample to demonstrate how to use the FastCGI plug-in shipped with the Web Server 7.0 (using PHP).  

i18n

A basic Java EE web application that demonstrates how to dynamically change the display language based on user preference. 

Javamail

A servlet that uses the Javamail API to send an email message. 

JDBC

Java DataBase Connectivity examples are included in the following directories:  

  • blob: A servlet that accesses BLOBs through the JDBC API

  • simple: A basic servlet that accesses an RDBMS through the JDBC API.

  • transactions: A servlet that uses the transaction API with JDBC to control a local transaction

JDBC rowset

Example showing how to use JSR-114 JDBC rowset. 

JNDI

Java Naming and Directory Interface examples are in the following directories: 

  • custom: Demonstrates how to use the custom resource

  • external: Demonstrates how to use the external resource

  • readenv: Demonstrates the environment entries specified in the web.xml file

  • url: A servlet that uses the URL resource facility to access a resource.

JSF 1.1

Example showing how to use Java Server Faces components to quickly build web application user interfaces. 

JSTL

Basic examples that demonstrate usage of the JSP Standard Tag Library. 

NSAPI plugins

NSAPI examples. 

RMI-IIOP

Basic example that demonstrates using a servlet to access a stateless EJBTM using RMI/IIOP running in Sun Java System Web Server 7.0.

Security

Examples demonstrating how to secure Java EE web applications through standard authentication mechanisms and access controls. Security examples are included in the following directories: 

  • basic-auth: Demonstrates how to develop, configure, and exercise basic authentication

  • client-cert: Demonstrates how to develop, configure, and exercise client certificate authentication

  • form-auth: Demonstrates how to develop, configure, and exercise form-based authentication

  • jdbcrealm: Demonstrates how to develop, configure, and exercise JDBC realm authentication

Servlet and JSP example 

Servlet 2.4 and JSP 2.0 examples combined into a single web application. 

WS-I 1.1  

Web Services interoperability 1.1 samples.  

websecurity  

Web Services security samples. 

Building the Samples

An ANT-based build system is used to build the individual sample application. The build.xml file has target to compile the sources, to clean, and to build the war file. It also has targets to deploy and undeploy the application, using the corresponding CLI commands provided by the Web Server. Register application resources in the deployment target.

Documentation for the Samples

Documentation is installed along with the samples during the installation. The index.html in the document root of the default Web Server instance contains links to the samples documentation. In addition, you can access the documentation HTML files directly in the samples directory.