Sun Java System Web Server 7.0 Update 8 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/samples directory. All the sample applications are arranged in a specific
and well-defined directory structure. The sample application included
as part of the Sun Java System Web Server are packaged into consistent
directory structure as elaborated below:
-
NSAPI — This directory contains examples of
source code for Server Application Functions (SAFs) which helps you
get started with programming your Sun Java System Web Server.
Directory path: install-dir/samples/nsapi
-
Java — This directory contains samples which
help to create, deploy and run various java applications.
Directory
path: install-dir/samples/java
-
FastCGI — This directory contains samples, which
demonstrates the use of PHP Add-On and FastCGI plug-in on Web Server
7.0.
Directory path: install-dir/samples/fastcgi
-
Administration CLI — This directory contains
scripts that one can run using the wadm command
line utility. The utility can be found at <install-root>/bin/wadm. wadm is built on a Tcl engine and hence
supports Tcl scripting. Some of these samples demonstrate how scripts
can be used to perform common administrative tasks. They also demonstrate
how new utilities can be built on top of existing commands.
Directory
path: install-dir/samples/admin/
-
NSACL — This directory contains access control
samples which implement the Loadable Attribute Service (LAS) APIs.
Directory path: install-dir/samples/nsacl
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:
-
src: A directory containing all
the Java source files, deployment descriptors, JSPs, and HTML files.
Samples that use a database provide a script to populate data in the
database.
-
docs: A directory containing all
documentation for the application.
-
.WAR file: The deployable .WAR
file for the sample application.
-
build.xml: A file for the ANT system
to build the sample application
Java Samples
A complete index of Java sample applications provided as part
of the Sun Java System Web Server product is listed below:
Table 2–1 Java Samples
Directory
|
Contents
|
apis
|
This directory contains source code of the extensible session
manager and session store API that was published in the previous release
of Web Server (6.0). These APIs have been deprecated since Sun ONE
Web Server 6.1 and are provided in this directory for the purpose
of backward compatibility.
Directory path: install-dir/samples/java/apis
|
simple
|
Basic JSP and servlet examples combined into a single web application
(Tomcat samples).
Directory path: install-dir/samples/java/webapps/simple
|
caching
|
JSP and servlet examples that demonstrate how to cache results
of JSP and servlet execution.
Directory path: install-dir/samples/java/webapps/caching
|
jstl
|
Basic examples that demonstrate usage of the JSP Standard Tag
Library.
Directory path: install-dir/samples/java/webapps/jstl
|
rmi-iiop
|
Basic
example that demonstrates using a servlet to access a stateless EJBTM using RMI/IIOP running in Sun Java System Application
Server 8.x.
Directory path: install-dir/samples/java/webapps/rmi-iiop
|
javamail
|
A servlet that uses the Javamail API to send an email message.
Directory path: install-dir/samples/java/webapps/javamail
|
i18n
|
A basic Java EE web application that demonstrates how to dynamically
change the display language based on user preference.
Directory path: install-dir/samples/java/webapps/i18n
|
JSF
|
Example showing how to use Java Server Faces (JSF) components
to quickly build web application user interfaces. JSF examples are
included in the following directories:
-
carstore: Online car store sample
-
components: JSF custom components
sample
-
guessnumber: Guess number sample
Directory path: install-dir/samples/java/webapps/jsf
|
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
-
rowset: Demonstrates the JDBC rowset
feature
Directory path: install-dir/samples/java/webapps/jdbc
|
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 how to use
the environment entries specified in the web.xml file
-
url: Demonstrates how to use the
servlet with the URL resource facility to access a resource
Directory path: install-dir/samples/java/webapps/jndi
|
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
Directory path: install-dir/samples/java/webapps/security
|
webservices/security
|
Web services security examples are located in the following
directory:
Directory path: install-dir/samples/java/webapps/webservices/security
|
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.