Datasheet
Patrick c01.tex V3 - 09/18/2009 12:15pm Page 6
Chapter 1: Building Web Applications in WebLogic
session ID has the name
JSESSIONID
by default and consists of a long hash identifying the client
plus creation-time and cluster information. The format of the session ID is
JSESSIONID=SESSION_ID!PRIMARY_JVMID_HASH!SECONDARY_JVM_HASH!CREATION_TIME
Table 1-1: Information Available in the HttpServletRequest
Type of Information Access Methods
Parameters passed in the query string or
through form input fields
getParameterNames()
,
getParameter()
,
getParameterValues()
,
getQueryString()
Server information
getServerName()
,
getServerPort()
Client characteristics
getRemoteAddr()
,
getRemoteHost()
,
getAuthType()
,
getRemoteUser()
Request information
getContentType()
,
getContentLength()
,
getProtocol()
,
getScheme()
,
getRequestURI()
HTTP headers
getHeaderNames()
,
getHeader()
,
getIntHeader()
,
getDateHeader()
Cookies sent by browser
getCookies()
Session information
getSession()
,
getRequestedSessionId()
,
isRequestedSessionIdValid()
,
...
WebLogic Server uses exclamation marks to separate portions of the session ID. The first portion is
used by the session tracking implementation in WebLogic Server to look up the client’s
HttpSession
object in the web application context. Subsequent portions of the session ID are used to identify pri-
mary and secondary servers for this client in a WebLogic Server cluster and to track the creation time
for this session. Chapter 12 discusses WebLogic Server clustering in detail as part of the discussion
of administration best practices.
Using session tracking in a servlet is as simple as calling the
getSession()
method on the passed-
in
HttpServletRequest
object to retrieve or create the
HttpSession
object for this client and then
utilizing the
HttpSession
interface to get and set attributes in the session.
6