Web Application WAR FileSyntax packager -webArchive[-classpath servletorjspbean/classes [-classFiles package/MyClass1.class: package/MyClass2.class]] [-contentFiles login.jsp:index.html
Trang 1Web Application WAR File
Syntax
packager -webArchive[-classpath servletorjspbean/classes [-classFiles package/MyClass1.class: package/MyClass2.class]] <content-root>
[-contentFiles login.jsp:index.html:images/me.gif] web.xml myWebApp.war
Example: Creating a Simple WAR File
The following command packages the myWebPage.xml deployment descriptorand the page inWebPageDir/Hello.html into themyWebPage.war file:
packager -webArchive myWebPageDir myWebPage.xml myWebPage.war
Example: Specifying Individual Content Files
Suppose that you add a Hello.jsp file to the directory myWebPageDir, laterdecide that you don’t want theHello.htmlfile any more, and modify your.xmlfile accordingly You can individually specify the content files to add by usingthe-contentFiles flag:
packager -webArchive myWebPageDir -contentFiles Hello.jsp myWebPage.xml myWebPage.warWithout the -contentFiles option, the following command will produce thesame WAR file because it includes everything under the directorymyWebPage- Dir:
packager -webArchive myWebPageDir -contentFiles Hello.jsp:Hello.html myWebPage.xml myWebPage.war
Example: Specifying Servlets and JSP Files
Suppose that you write a servlet and compile it into your classes directory, ifying the.xmlfile for its deployment attributes Its class file isclasses/pack- age/Servlet1.class The following command includes the servlet class filebecause it is under theclasses directory:
mod-packager -webArchive -classpath classes myWebPageDir -contentFiles Hello.jsp myWebPage.xml myWebPage.war.
Trang 2The following command specifies that only thepackage/Servlet1.classandpackageB/Servlet.class files are to be included:
packager -webArchive -classpath classes -classFiles package/Servlet1.class:packageB/Servlet.class myWebPageDir
-contentFiles Hello.jsp myWebPage.xml myWebPage.warThe next command adds theHello.html file back into the WAR file:
packager -webArchive -classpath classes -classFiles package/Servlet1.class:packageB/Servlet.class myWebPageDir
-contentFiles Hello.jsp:Hello.html myWebPage.xml myWebPage.war
Application Client JAR File
Syntax
packager -applicationClient <root-directory>
package/Class1.class:package/Main.class:pics/me.gif package.Main client.xml appClient.jar
Example
The following command creates theappClient.jar file:
packager classes hello/HelloClient.class:hello/HelloUtil.class package.Main client.xml appClient.jar
J2EE Application EAR File
Syntax
packager -enterpriseArchive myWeb.war:myEJB.jar:myOtherApp.ear [-alternativeDescriptorEntries myWeb/web.xml:myEjb/myEjb.xml:]
[-libraryJars ejblib.jar:ejblib1.jar]
myAppName myApp.ear
Trang 3Example: Creating an EAR File
In the following command, the optional-alternativeDescriptorEntriesflagallows you to specify the external descriptor entry name of each component asyou wish it to appear in the EAR file:
packager -enterpriseArchive myWeb.war:myEJB.jar:appClient.ear -alternativeDescriptorEntries myWeb/web.xml:myEjb/myEjb.xml:client/client.xml myAppName myApp.ear
After packaging, any manipulation of the deployment information will not bewritten back into the component files inside the EAR file, but to the entry names
in the EAR file that you specified
Example: Specifying the Runtime Deployment Descriptor
The preceding example specified the-enterpriseArchiveflag to create a table J2EE application EAR file This file is portable because you can import it
por-into any J2EE environment that conforms to the J2EE Specification Although
you can import the file into thedeploytool, you cannot deploy it on the J2EEserver until it contains a runtime deployment descriptor This deploymentdescriptor is an XML file that contains information such as the JNDI names ofthe application’s enterprise beans
In the following command, the-setRuntimeflag instructs the packager to insertthe runtime deployment descriptor (sun-j2ee-ri.xml) into themyApp.ear file:packager -setRuntime MyApp.ear sun-j2ee-ri.xml
To obtain an example of the runtime deployment descriptor, extract it from aEAR file that you’ve already deployed:
jar -xvf SomeApp.earThe DTD of the runtime deployment descriptor is in the lib/dtds/ sun-j2ee-ri-dtd file of your J2EE SDK installation
Note: The runtime deployment descriptor (sun-j2ee-ri.xml) is not required by
the J2EE Specification This descriptor is unique to the J2EE SDK and may change
in future releases
Trang 4Resource Adapter RAR File
Examples in the section Managing J2EE Users and Groups (page 256) show how
to run therealmtool utility
Table 44 realmtool Options
-list <realm-name> Lists the users in the specified realm This release
has two realms: default and certificate
-add <username password group[,group]>
Adds the specified user to the default realm.
-addGroup <group> Adds a group to the default realm.
Trang 5Theverifier validates J2EE component files (EAR, WAR, JAR).
You can run theverifier three ways:
• From within thedeploytool GUI
• As a command-line utility
• As a stand-alone GUI utility
To run theverifierfrom within thedeploytoolGUI, choose Verifier from theTools menu The following sections explain how to run the verifier the other twoways
Command-Line Verifier
The command-line verifier has the following syntax:
verifier [options] <filename>
Table 45 runclient Options
-client <appjar> The J2EE application EAR file.
<name> The display name of the J2EE application client component.
<app-args> Any arguments required by the J2EE application.
Trang 6The filenameargument is the name of a J2EE component file The followingtable lists the options.
Stand-Alone GUI Verifier
To run the stand-alone GUIverifier, follow these steps:
1 From the command-line prompt, type:
verifier -u
2 To select a file for verification, click Add
3 Select the radio button to indicate the report level:
• All Results
• Failures Only
• Failures and Warnings Only
4 Click OK
5 Theverifier lists the details in the lower portion of the screen
Table 46 verifier Options
-v Displays a verbose version of output.
-o <output-file> Writes the results to the specified <output-file> , overriding the
default Results.txt file
-u Runs the stand-alone GUI version.
-<report-level> Determines whether warnings or failures are reported The
<report-level> may be either a , w , or f :
Trang 8Glossary
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z access control
The methods by which interactions with resources are limited to collections
of users or programs for the purpose of enforcing integrity, confidentiality,
applet container
A container that includes support for the applet programming model
Application Component Provider
A vendor that provides the Java classes that implement components’ ods, JSP page definitions, and any required deployment descriptors
meth-Application Assembler
A person that combines components and modules into deployable tion units
Trang 9applica-application client
A first-tier client component that executes in its own Java virtual machine.Application clients have access to some (JNDI, JDBC, RMI-IIOP, JMS)J2EE platform APIs
application client container
A container that supports application client components
application client module
A software unit that consists of one or more classes and an application clientdeployment descriptor
authentication
The process by which an entity proves to another entity that it is acting onbehalf of a specific identity The J2EE platform requires three types ofauthentication: basic, form-based, and mutual, and supports digest authenti-cation
authorization
The process by which access to a method or resource is determined rization in the J2EE platform depends upon the determination of whether theprincipal associated with a request through authentication is in a given secu-rity role A security role is a logical grouping of users defined by an Applica-tion Component Provider or Assembler A Deployer maps security roles tosecurity identities Security identities may be principals or groups in theoperational environment
Autho-authorization constraint
An authorization rule that determines who is permitted to access a webresource collection
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z basic authentication
An authentication mechanism in which a web server authenticates an entitywith a user name and password obtained using the web client’s built-inauthentication mechanism
Trang 10business logic
The code that implements the functionality of an application In the prise JavaBeans model, this logic is implemented by the methods of anenterprise bean
Enter-business method
A method of an enterprise bean that implements the business logic or rules
of an application
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z callback methods
Component methods called by the container to notify the component ofimportant events in its life cycle
caller
Same as caller principal
caller principal
The principal that identifies the invoker of the enterprise bean method
client certificate authentication
An authentication mechanism in which a client uses a X.509 certificate toestablish its identity
component contract
The contract between a component and its container The contract includes:life cycle management of the component, a context interface that theinstance uses to obtain various information and services from its container,and a list of services that every container must provide for its components
Trang 11A standard extension mechanism for containers to provide connectivity toenterprise information systems A connector is specific to an enterpriseinformation system and consists of a resource adapter and application devel-opment tools for enterprise information system connectivity The resourceadapter is plugged in to a container through its support for system-level con-tracts defined in the connector architecture
container
An entity that provides life cycle management, security, deployment, andruntime services to components Each type of container (EJB, web, JSP,servlet, applet, and application client) also provides component-specific ser-vices
Trang 12The information describing the security attributes of a principal
CSS
Cascading Style Sheet A stylesheet used with HTML and XML documents
to add a style to all elements marked with a particular tag, for the direction
of browsers or other presentation mechanisms
CTS
Compatibility Test Suite A suite of compatibility tests for verifying that aJ2EE product complies with the J2EE platform specification
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z delegation
An act whereby one principal authorizes another principal to use its identity
or privileges with some restrictions
destination
A JMS administered object that encapsulates the identity of a JMS queue ortopic See point-to-point messaging system, publish/subscribe messagingsystem
digest authentication
An authentication mechanism in which a web client authenticates to a webserver by sending the server a message digest along its HTTP request mes-sage The digest is computed by employing a one-way hash algorithm to aconcatenation of the HTTP request message and the client’s password Thedigest is typically much smaller than the HTTP request, and doesn’t containthe password
distributed application
An application made up of distinct components running in separate runtimeenvironments, usually on different platforms connected via a network Typi-
Trang 13cal distributed applications are two-tier server), three-tier middleware-server), and multitier (client-multiple middleware-multipleservers).
In a JMS publish/subscribe messaging system, a subscription that continues
to exist whether or not there is a current active subscriber object If there is
no active subscriber, JMS retains the subscription’s messages until they arereceived by the subscription or until they expire
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z EAR file
A JAR archive that contains a J2EE application
archi-EJB Container Provider
A vendor that supplies an EJB container
EJB context
An object that allows an enterprise bean to invoke services provided by thecontainer and to obtain the information about the caller of a client-invokedmethod
EJB home object
An object that provides the life cycle operations (create, remove, find) for anenterprise bean The class for the EJB home object is generated by the con-tainer’s deployment tools The EJB home object implements the enterprisebean’s home interface The client references an EJB home object to perform
Trang 14life cycle operations on an EJB object The client uses JNDI to locate an EJBhome object.
EJB JAR file
A JAR archive that contains an EJB module
man-EJB Server Provider
A vendor that supplies an EJB server
enterprise bean
A component that implements a business task or business entity and resides
in an EJB container; either an entity bean, session bean, or message-drivenbean
enterprise information system
The applications that comprise an enterprise’s existing system for handlingcompany-wide information These applications provide an informationinfrastructure for an enterprise An enterprise information system offers awell defined set of services to its clients These services are exposed to cli-ents as local and/or remote interfaces Examples of enterprise informationsystems include: enterprise resource planning systems, mainframe transac-tion processing systems, and legacy database systems
enterprise information system resource
An entity that provides enterprise information system-specific functionality
to its clients Examples are: a record or set of records in a database system, abusiness object in an enterprise resource planning system, and a transactionprogram in a transaction processing system
Trang 15Enterprise Bean Provider
An application programmer who produces enterprise bean classes, remoteand home interfaces, and deployment descriptor files, and packages them in
an EJB JAR file
Enterprise JavaBeans™ (EJB™)
A component architecture for the development and deployment of oriented, distributed, enterprise-level applications Applications writtenusing the Enterprise JavaBeans architecture are scalable, transactional, andsecure
object-entity bean
An enterprise bean that represents persistent data maintained in a database
An entity bean can manage its own persistence or it can delegate this tion to its container An entity bean is identified by a primary key If the con-tainer in which an entity bean is hosted crashes, the entity bean, its primarykey, and any remote references survive the crash
func-A B C D E F G H I J K L M N O P Q R S T U V W X Y Z filter
An object that can transform the header and/or content of a request orresponse Filters differ from web components in that they usually do notthemselves create responses but rather they modify or adapt the requests for
a resource, and modify or adapt responses from a resource A filter shouldnot have any dependencies on a web resource for which it is acting as a filter
so that it can be composable with more than one type of web resource
A collection of principals within a given security policy domain
Trang 16A B C D E F G H I J K L M N O P Q R S T U V W X Y Z handle
An object that identifies an enterprise bean A client may serialize the dle, and then later deserialize it to obtain a reference to the enterprise bean
Hypertext Markup Language A markup language for hypertext documents
on the Internet HTML enables the embedding of images, sounds, videostreams, form fields, references to other objects with URLs and basic textformatting
HTTP
Hypertext Transfer Protocol The Internet protocol used to fetch hypertextobjects from remote hosts HTTP messages consist of requests from client toserver and responses from server to client
HTTPS
HTTP layered over the SSL protocol
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z impersonation
An act whereby one entity assumes the identity and privileges of anotherentity without restrictions and without any indication visible to the recipients
of the impersonator’s calls that delegation has taken place Impersonation is
a case of simple delegation
IDL
Interface Definition Language A language used to define interfaces toremote CORBA objects The interfaces are independent of operating sys-tems and programming languages
Trang 17See Java 2 Platform, Enterprise Edition.
J2EE product
An implementation that conforms to the J2EE platform specification
J2EE Product Provider
A vendor that supplies a J2EE product
J2EE server
The runtime portion of a J2EE product A J2EE server provides EJB and/orweb containers
JAR Java ARchive
A platform-independent file format that permits many files to be aggregatedinto one file
Java™ 2 Platform, Enterprise Edition (J2EE)
An environment for developing and deploying enterprise applications TheJ2EE platform consists of a set of services, application programming inter-faces (APIs), and protocols that provide the functionality for developingmultitiered, web-based applications