web.xml 配置参考文档
Use a separate <resource-ref>
element to define each external resource name. The external resource name is mapped to the actual location name of the resource at deployment time in the WebLogic-specific deployment descriptor weblogic.xml
.
The following table describes the elements you can define within a resource-ref
element.
Element
Required/
Optional
Description
<description>
Optional
A text description.
<res-ref-name>
Required
The name of the resource used in the JNDI tree. Servlets in the Web application use this name to look up a reference to the resource.
<res-type>
Required
The Java type of the resource that corresponds to the reference name. Use the full package name of the Java type.
<res-auth>
Required
Used to control the resource sign on for security.
If set to APPLICATION,
indicates that the application component code performs resource sign on programmatically. If set to CONTAINER
, WebLogic Server uses the security context established with the login-config
element. See login-config.
<res-sharing-scope>
Optional
Specifies whether connections obtained through the given resource manager connection factory reference can be shared.
Valid values:
Shareable
Unshareable
?
?
The security-constraint
element defines the access privileges to a collection of resources defined by the <web-resource-collection>
element.
For detailed instructions and an example on configuring security in Web applications, see Securing WebLogic Resources. Also, for more information on WebLogic Security, refer to Programming WebLogic Security.
The following table describes the elements you can define within a security-constraint element.
Element
Required/
Optional
Description
<web-resource-
collection>
Required
Defines the components of the Web application to which this security constraint is applied.
<auth-constraint>
Optional
Defines which groups or principals have access to the collection of web resources defined in this security constraint. See also auth-constraint.
<user-data-
constraint>
Optional
Defines how the client should communicate with the server.
See also user-data-constraint
?
Each <security-constraint>
element must have one or more <web-resource-collection>
elements. These define the area of the Web application to which this security constraint is applied.
This is an element within the security-constraint.
The following table describes the elements you can define within a web-resource-collection element.
Element
Required/
Optional
Description
<web-resource-
name>
Required
The name of this Web resource collection.
<description>
Optional
A text description of this security constraint.
<url-pattern>
Optional
Use one or more of the <url-pattern
> elements to declare to which URL patterns this security constraint applies. If you do not use at least one of these elements, this <web-resource-collection
> is ignored by WebLogic Server.
<http-method>
Optional
Use one or more of the <http-method
> elements to declare which HTTP methods (usually, GET
or POST
) are subject to the authorization constraint. If you omit the <http-method
> element, the default behavior is to apply the security constraint to all HTTP methods.
?
This is an element within the security-constraint.
The optional auth-constraint
element defines which groups or principals have access to the collection of Web resources defined in this security constraint.
The following table describes the elements you can define within an auth-constraint
element.
Element
Required/
Optional
Description
<description>
Optional
A text description of this security constraint.
?
This is an element within the security-constraint.
The user-data-constraint
element defines how the client should communicate with the server.
The following table describes the elements you may define within a user-data-constraint
element.
Element
Required/
Optional
Description
<description>
Optional
A text description.
<transport-
guarantee>
Required
Specifies that the communication between client and server.
WebLogic Server establishes a Secure Sockets Layer (SSL) connection when the user is authenticated using the INTEGRAL
or CONFIDENTIAL
transport guarantee.
Range of values:
NONE—
The application does not require any transport guarantees.
INTEGRAL—
The application requires that the data be sent between the client and server in such a way that it cannot be changed in transit.
CONFIDENTIAL—
The application requires that data be transmitted so as to prevent other entities from observing the contents of the transmission.
?
?
Use the optional login-config
element to configure how the user is authenticated; the realm name that should be used for this application; and the attributes that are needed by the form login mechanism.
If this element is present, the user must be authenticated in order to access any resource that is constrained by a <security-constraint>
defined in the Web application. Once authenticated, the user can be authorized to access other resources with access privileges.
The following table describes the elements you can define within a login-config
element.
Element
Required/
Optional
Description
<auth-method>
Optional
Specifies the method used to authenticate the user. Possible values:
BASIC
—uses browser authentication. (This is the default value.)FORM
—uses a user-written HTML form.CLIENT-CERT
<realm-name>
Optional
The name of the realm that is referenced to authenticate the user credentials. If omitted, the realm defined with the Auth Realm Name field on the Web application—> Configuration—>Other tab of the Administration Console is used by default. For more information, see Managing WebLogic Security.
Note: The <realm-name>
element does not refer to system security realms within WebLogic Server. This element defines the realm name to use in HTTP Basic authorization. The system security realm is a collection of security information that is checked when certain operations are performed in the server. The servlet security realm is a different collection of security information that is checked when a page is accessed and basic authentication is used.
<form-login-
config>
Optional
Use this element if you configure the <auth-method>
to FORM. See form-login-config.
?
This is an element within the login-config.
Use the <form-login-config>
element if you configure the <auth-method>
to FORM
.
.
Element
Required/
Optional
Description
<form-login-page>
Required
The URI of a Web resource relative to the document root, used to authenticate the user. This can be an HTML page, JSP, or HTTP servlet, and must return an HTML page containing a FORM-based authentication that conforms to a specific naming convention.
<form-error-page>
Required
The URI of a Web resource relative to the document root, sent to the user in response to a failed authentication login.
?
?
The following table describes the elements you can define within a security-role
element.
Element
Required/
Optional
Description
<description>
Optional
A text description of this security role.
<role-name>
Required
The role name. The name you use here must have a corresponding entry in the WebLogic-specific deployment descriptor, weblogic.xml,
which maps roles to principals in the security realm. For more information, see security-role-assignment.
?
?
The optional env-entry
element declares an environment entry for an application. Use a separate element for each environment entry.
The following table describes the elements you can define within an env-entry
element.
Element
Required/
Optional
Description
<description>
Optional
A textual description.
<env-entry-name>
Required
The name of the environment entry.
<env-entry-value>
Required
The value of the environment entry.
<env-entry-type>
Required
The type of the environment entry.
Can be set to one of the following Java types:
java.lang.Boolean
java.lang.String
java.lang.Integer
java.lang.Double
java.lang.Float
?
?
The optional ejb-ref
element defines a reference to an EJB resource. This reference is mapped to the actual location of the EJB at deployment time by defining the mapping in the WebLogic-specific deployment descriptor file, weblogic.xml
. Use a separate <ejb-ref>
element to define each reference EJB name.
The following table describes the elements you can define within an ejb-ref
element.
Element
Required/
Optional
Description
<description>
Optional
A text description of the reference.
<ejb-ref-name>
Required
The name of the EJB used in the Web application. This name is mapped to the JNDI tree in the WebLogic-specific deployment descriptor weblogic.xml
. For more information, see ejb-reference-description.
<ejb-ref-type>
Required
The expected Java class type of the referenced EJB.
<home>
Required
The fully qualified class name of the EJB home interface.
<remote>
Required
The fully qualified class name of the EJB remote interface.
<ejb-link>
Optional
The <ejb-name>
of an EJB in an encompassing J2EE application package.
<run-as>
Optional
A security role whose security context is applied to the referenced EJB. Must be a security role defined with the <security-role>
element.
?
?
The ejb-local-ref element is used for the declaration of a reference to an enterprise bean's local home. The declaration consists of:
An optional description The EJB reference name used in the code of the Web application that references the enterprise bean. The expected type of the referenced enterprise bean The expected local home and local interfaces of the referenced enterprise bean Optional ejb-link information, used to specify the referenced enterprise beanThe following table describes the elements you can define within an ejb-local-ref
element.
Element
Required/
Optional
Description
<description>
Optional
A text description of the reference.
<ejb-ref-name>
Required
Contains the name of an EJB reference. The EJB reference is an entry in the Web application's environment and is relative to the java:comp/env context. The name must be unique within the Web application. It is recommended that name is prefixed with ejb/.
For example:
<ejb-ref-name>ejb/Payroll</ejb-ref-name>
<ejb-ref-type>
Required
The ejb-ref-type
element contains the expected type of the referenced enterprise bean. The ejb-ref-type
element must be one of the following:
<ejb-ref-type>Entity</ejb-ref-type>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>
Required
Contains the fully-qualified name of the enterprise bean's local home interface.
<local>
Required
Contains the fully-qualified name of the enterprise bean's local interface.
<ejb-link>
Optional
The ejb-link
element is used in the ejb-ref
or ejb-local-ref
elements to specify that an EJB reference is linked to an
EJB.
The name in the ejb-link
element is composed of a path name. This path name specifies the ejb-jar
containing the referenced EJB with the ejb-name
of the target bean appended and separated from the path name by #.
The path name is relative to the WAR file containing the Web application that is referencing the EJB. This allows multiple EJBs with the same ejb-name
to be uniquely identified.
Used in: ejb-local-ref
and ejb-ref
elements
Examples:
<ejb-link>EmployeeRecord</ejb-link>
<ejb-link>../products/product.jar#ProductEJB</ejb-link>
Element
Required/
Optional
Description
<description>
Optional
A text description of the reference.
<ejb-ref-name>
Required
Contains the name of an EJB reference. The EJB reference is an entry in the Web application's environment and is relative to the java:comp/env context. The name must be unique within the Web application. It is recommended that name is prefixed with ejb/.
For example:
<ejb-ref-name>ejb/Payroll</ejb-ref-name>
<ejb-ref-type>
Required
The ejb-ref-type
element contains the expected type of the referenced enterprise bean. The ejb-ref-type
element must be one of the following:
<ejb-ref-type>Entity</ejb-ref-type>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>
Required
Contains the fully-qualified name of the enterprise bean's local home interface.
<local>
Required
Contains the fully-qualified name of the enterprise bean's local interface.
<ejb-link>
Optional
The ejb-link
element is used in the ejb-ref
or ejb-local-ref
elements to specify that an EJB reference is linked to an
EJB.
The name in the ejb-link
element is composed of a path name. This path name specifies the ejb-jar
containing the referenced EJB with the ejb-name
of the target bean appended and separated from the path name by #.
The path name is relative to the WAR file containing the Web application that is referencing the EJB. This allows multiple EJBs with the same ejb-name
to be uniquely identified.
Used in: ejb-local-ref
and ejb-ref
elements
Examples:
<ejb-link>EmployeeRecord</ejb-link>
<ejb-link>../products/product.jar#ProductEJB</ejb-link>
??