All Request elements which require or allow for additional information allow
you to provide the information as either an attribute or a child element. These
attributes/child elements are listed in the "Attributes/Child Elements" column
of the table below. Unless noted, these are required for the given element;
their absence will result in Java compilation errors or exceptions.
All Request elements which get data from the request can output the data
in two ways. The as
attribute of the element is used to switch
between the different output options. The choice is always between some
default value for as
and the value "node". Using the default
value for as
(which is most easily achieved by leaving out the
attribute altogether), the Request element will put the result of its operation
in an <xsp:expr> node. This allows you to use the result in a Java expression,
or converts it to text in the output DOM tree. If you use as="node"
,
however, the output is embedded in a node or nodes, as appropriate. For instance,
the following code fragment:
This is especially useful with elements that return multiple pieces of
information, such as xsp-request:get-parameter-values
. Without using
as="node"
, the returned values are written out end to end
without separation. If node output is requested, however, each value
is written out in a separate node, which may then be referenced separately.
The elements which provide for node output are marked with a "yes" in the
"Node?" column of the table below. Unlike the other attributes used in
Request elements, as
cannot be supplied as a child element; it
must be supplied as an attribute, if it is used at all.
All of the Request logicsheet elements, in alphabetic order.
Element Name
|
Attributes/Child Elements
|
Node?
|
Description
|
xsp-request:get-attribute
|
name
|
yes
|
Gets a named attribute set by the servlet container or by a previous
xsp-request:set-attribute operation.
|
xsp-request:get-attribute-names
|
|
yes
|
Gets the names of all available request attributes.
|
xsp-request:get-auth-type
|
|
yes
|
Gets the name of the authentication scheme used to protect this request
location, if used, e.g., BASIC or SSL.
|
xsp-request:get-character-encoding
|
|
yes
|
Gets the name of the character encoding used in the body of this request.
|
xsp-request:get-content-length
|
|
yes
|
Gets the length, in bytes, of the request body, or -1 if the length is unknown.
|
xsp-request:get-content-type
|
|
yes
|
Gets the MIME type of the body of the request.
|
xsp-request:get-context-path
|
|
yes
|
Gets the portion of the request URI that indicates the context of the request.
|
xsp-request:get-cookies
|
|
yes
|
Gets all cookie objects supplied by the client with this request.
|
xsp-request:get-date-header
|
name, format (optional)
|
yes
|
Gets the value of the named request header that represents a date. Use this
method with headers that contain dates, such as If-Modified-Since. The as attribute
for this element may be "long" (default), "string", "date", or "node". If "long",
the returned value is a Java long that represents a Java Date
value. If "date", the returned value is a Java Date object. If "string" or
"node", the optional format attribute may be used
to supply a format string for a Java SimpleDateFormat to format the resulting
string.
|
xsp-request:get-header
|
name
|
yes
|
Gets the string value of the named request header.
|
xsp-request:get-headers
|
name
|
yes
|
Gets all values of the named request header.
|
xsp-request:get-header-names
|
|
yes
|
Gets the names of all available request headers.
|
xsp-request:get-int-header
|
name
|
yes
|
Gets the value of the named request header which represents an integer,
or -1 if the named header doesn't exist. The as attribute may
be set to "int" (default), "string", or "node".
|
xsp-request:get-locale
|
|
yes
|
Gets the preferred locale for the client browser, or the default
server locale if not provided by the client.
|
xsp-request:get-locales
|
|
yes
|
Gets the locales accepted by the client in order of preference.
|
xsp-request:get-method
|
|
yes
|
Gets the name of the method associated with this request, e.g., GET, POST, or PUT.
|
xsp-request:get-parameter
|
name
|
yes
|
Gets the value of the named request parameter. This is a value from
the request string (e.g., ?fruit=apple) or from POSTed form data. If the parameter
has more than one value, (e.g, ?fruit=apple&fruit=orange), then this gets the first
value. See xsp-request:get-parameter-values.
|
xsp-request:get-parameter-names
|
|
yes
|
Gets the names of all the request parameters.
|
xsp-request:get-parameter-values
|
name
|
yes
|
Gets all values for the named request parameter.
|
xsp-request:get-path-info
|
|
yes
|
Gets any additional path information supplied by the client with this request.
|
xsp-request:get-path-translated
|
|
yes
|
Gets any additional path information after the servlet name but before the query string,
translated to a real path.
|
xsp-request:get-protocol
|
|
yes
|
Gets the name and version of the protocol the request uses, for example, HTTP/1.1.
|
xsp-request:get-query-string
|
|
yes
|
Gets the query string for this request (e.g., "?fruit=apple&bread=rye").
|
xsp-request:get-remote-addr
|
|
yes
|
Gets the IP address of the requesting client.
|
xsp-request:get-remote-host
|
|
yes
|
Gets the fully-qualified name of the requesting client, or the IP address
if the name cannot be determined.
|
xsp-request:get-remote-user
|
|
yes
|
Gets the login name of the user making the request, if a user has been
authenticated.
|
xsp-request:get-requested-session-id
|
|
yes
|
Gets the session id contained in the request.
|
xsp-request:get-request-uri
|
|
yes
|
Gets the part of the request URL from the protocol name up to the
query string.
|
xsp-request:get-scheme
|
|
yes
|
Gets the name of the scheme used in this request, e.g., http or https.
|
xsp-request:get-server-name
|
|
yes
|
Gets the name of the server that received the request.
|
xsp-request:get-server-port
|
|
yes
|
Gets the port on which the request was received, e.g., 80 or 443.
|
xsp-request:get-servlet-path
|
|
yes
|
Gets the part of the request URL that calls the servlet.
|
xsp-request:get-user-principal
|
|
yes
|
Gets a java.security.Principal object containing the name of the user,
if a user has been authenticated.
|
xsp-request:is-requested-session-id-from-cookie
|
|
yes
|
Indicates whether the requested session id was provided in a cookie.
|
xsp-request:is-requested-session-id-from-url
|
|
yes
|
Indicates whether the requested session id was provided as part of the
request URL.
|
xsp-request:is-requested-session-id-valid
|
|
yes
|
Indicates whether the requested session id is still valid.
|
xsp-request:is-secure
|
|
yes
|
Indicates whether the request was made using a secure protocol such as HTTPS.
|
xsp-request:is-user-in-role
|
role
|
yes
|
Indicates whether the authenticated user is a member in the named role.
|
xsp-request:remove-attribute
|
name
|
no
|
Removes the named attribute from the request.
|
xsp-request:set-attribute
|
name
|
no
|
Sets the named attribute to the value represented by any children of the element.
If the element has a text node as its child, the attribute will be set to the String
containing the text.
|