public class HttpSession extends Object implements ClientCommunicationInterface
Modifier and Type | Field and Description |
---|---|
ClientSession |
clientSession
The client session that this HTTP session is tied to (null if none).
|
HttpUserEnvironment |
environment
The user environment.
|
int |
errCode
The current error code (zero if none yet, or 200 if OK).
|
String |
errExtra
The current extra error text (empty string if none yet).
|
String |
errText
The current error text (empty string if none yet).
|
Hashtable<String,String> |
formData
The table of decoded form data in name/value pairs (or null if no posted data).
|
String |
fullServerName
The protocol, name and port of this server (http[s]://hostName[:port].
|
HttpHeaderFields |
headerFields
The header fields.
|
static String |
hexes
Hex characters.
|
String |
hostAddress
The address of this server.
|
String |
hostName
The name of this server.
|
String |
httpMethod
The HTTP method used (GET, POST or n/a).
|
String |
httpVersion
The http protocol version.
|
boolean |
isKeepAlive
Indicates that this connection is of keep-alive state.
|
boolean |
isReplyDataCgiGenerated
Boolean value that is set to true if the reply data is CGI-generated.
|
HttpSession |
previousHttpSession
The previous HTTP session (saved for the state-less communication).
|
String |
replyContentType
Reply Content-type (null is default).
|
String |
requestLine
The request line.
|
HttpRequestParser |
requestParser
The current request parser.
|
HttpResource |
resource
The current HTTP resource to be sent or that has been sent to
the client (null if none).
|
String |
resourceName
The requested resource name.
|
int |
serverPort
The server port number.
|
ServerSocketInterface |
serverSocket
The server socket interface (null if none).
|
Date |
sessionEstablishedTime
Time when the session was first established.
|
ISocket |
socket
The current socket (null if none).
|
String |
uriParams
The URI parameters (after '?', may be null if not specified).
|
AdminConfigWebApplication |
webApplication
The web application data.
|
HttpWebServer |
webServer
The Web Server.
|
Constructor and Description |
---|
HttpSession(HttpWebServer webServer)
Creates a new ....
|
Modifier and Type | Method and Description |
---|---|
void |
addReplyExtraHeader(String header)
Add reply extra header (from CGI).
|
boolean |
close()
Closes an open client connection.
|
void |
createConstAppAction()
Create constant AppAction session ID.
|
void |
createSessionCookie(HttpSession httpSetSession)
Creates and sets a cookie identification string to be used
for this session and for further checks when new GET or POST
data is sent from a client.
|
void |
createSingleSessionCookie(boolean doRemove)
Creates (or removes) a single-session special cookie.
|
boolean |
dispose()
The session is disposed of.
|
boolean |
doesCookieSessionMatch()
Verifies that the current session originates from a previously created
cookie session identification string.
|
String |
getApplicationAction()
Get application action = server name + resource name + current digest code.
|
BrowserCapabilities |
getBrowserCapabilities()
Gets the browser capabilities.
|
String |
getClientDNSName()
Gets the DNS name of this client connection.
|
InetAddress |
getClientInetAddress()
Gets the address of the client or null if socket is not connected.
|
String |
getClientIPAddress()
Gets the IP address of this client connection (as 1.2.3.4).
|
String |
getConstAppAction()
Access the constant AppAction session ID.
|
VirtualInterface |
getControl(String id)
Gets a virtual "control" from an ID (can also be a menu item).
|
int |
getControlMaximumLength(String id)
Gets the control ID maximum length.
|
String |
getControlText(String id)
Gets the control ID text.
|
String |
getControlText(String id,
int col,
int row)
Gets the control ID text.
|
String |
getCurrentSequencedDigestCode()
Gets the session identifier digest code of the current sequence ID.
|
String |
getDigestCode()
Gets the session identifier digest code.
|
String |
getGlobalVariable(String name)
Gets a NetPhantom global variable.
|
static char |
getHex(int v)
Gets the hex representation of a number 0-15.
|
String |
getHostField(String name)
Gets the host field by name.
|
String |
getHostField(String name,
int line)
Gets the host field by name.
|
static long |
getLongRandom()
Gets a random long value.
|
HttpSession |
getMessageDigestSession()
Gets the session used for message digests.
|
String |
getNextSequencedDigestCode()
Gets the session identifier digest code of the next sequence ID.
|
Enumeration<String> |
getReplyExtraHeaders()
Get reply extra headers (or null if none).
|
String |
getSecureLoginCookie(String resourceName)
Checks if there is a SecureLogin cookie set for this session.
|
String |
getSequenceID()
Access current sequence number (ID).
|
InetAddress |
getServerInetAddress()
Gets the address of the server or null if no connection exists.
|
ServerSocketInterface |
getServerSocket()
Gets the server socket interface associated with the accept of this socket.
|
static HttpSession |
getSession(String hashCode,
boolean checkDigestCode)
Looks up an existing httpSession from a hash code.
|
String |
getSessionCookieID()
Get cookie session ID.
|
boolean |
getSetCookies(StringBuilder buf)
Gets the cookies set to send to the client for this session (if any).
|
HttpSession |
getSingleSessionForUser()
Gets the single-session cookie (if this is allowed).
|
ISocket |
getSocket()
Gets socket associated with this communication.
|
String |
getTextID(String id)
Gets a text ID from the current runtime application.
|
String |
getTranslatedHostField(String name)
Gets the host field by name after it has undergone translation using the
application translation table.
|
String |
getTranslatedHostField(String name,
int line)
Gets the host field by name after it has undergone translation using the
application translation table.
|
HashMap<String,String> |
getURIParams()
Gets the URI parameters without regards to case.
|
HashMap<String,String> |
getURIParams(boolean keepCase)
Gets the URI parameters without regards to case.
|
static HashMap<String,String> |
getURIParams(String uriParams,
boolean keepCase)
Parses the URI params.
|
String |
getVisibleControlText(String id,
int col,
int row)
Gets the control ID text.
|
void |
hardClose()
Hard-closes the current socket connection to the client.
|
boolean |
hasSessionTimedOut()
Checks if a session has been inactive for a certain amount of time.
|
boolean |
isCookieUsed()
Check if cookie is used.
|
boolean |
isHTTP10()
Checks if this HTTP session is of version 1.0 or lower.
|
boolean |
isHTTP11()
Checks if this HTTP session is of version 1.1 or higher.
|
static String |
md5Digest(MessageDigest md,
String string)
MD5-Digests a String to a hex code.
|
String |
md5Digest(String string)
MD5-Digests a String to a hex code.
|
byte[] |
receiveTransaction()
Reads a transaction from the client.
|
byte[] |
receiveTransaction(Object[] isCompressed)
Reads a transaction from the client.
|
void |
removeSessionCookie()
Remove session cookie.
|
void |
saveSession()
Saves this session to be used for state-less HTTP communication.
|
void |
sendTransaction(byte[] data)
Sends a transaction to the client.
|
void |
sendTransaction(byte[] data,
int type)
Sends a transaction to the client.
|
void |
setCookie(HttpCookie cookie)
Sets a cookie to send to the client.
|
void |
setSecureLoginCookie(String value,
String resourceName)
Sets the SecureLogin cookie value for this session to a string.
|
void |
transferSession(HttpSession newSession)
Transfers control of a NetPhantom Application from the session specified
as a parameter to an existing one.
|
void |
varDelete(String name)
Deletes a HTTP session variable.
|
void |
varDeleteAll()
Deletes all variables.
|
String |
varGet(String name)
Gets the contents of a HTTP session variable.
|
void |
varSet(String name,
String data)
Sets a HTTP session variable.
|
public static final String hexes
public boolean isReplyDataCgiGenerated
public boolean isKeepAlive
public String replyContentType
public final HttpWebServer webServer
public HttpUserEnvironment environment
public ISocket socket
public ServerSocketInterface serverSocket
public String hostName
public String hostAddress
public int serverPort
public String fullServerName
public String httpVersion
public String requestLine
public String httpMethod
public String uriParams
public String resourceName
public HttpHeaderFields headerFields
public final Date sessionEstablishedTime
public int errCode
public String errText
public String errExtra
public Hashtable<String,String> formData
public ClientSession clientSession
public HttpSession previousHttpSession
public HttpResource resource
public AdminConfigWebApplication webApplication
public HttpRequestParser requestParser
public HttpSession(HttpWebServer webServer)
public void setCookie(HttpCookie cookie)
public boolean getSetCookies(StringBuilder buf)
public boolean isHTTP10()
public boolean isHTTP11()
public void varSet(String name, String data)
public String varGet(String name)
public void varDelete(String name)
public void varDeleteAll()
public String getHostField(String name)
public String getHostField(String name, int line)
public String getTranslatedHostField(String name)
public String getTranslatedHostField(String name, int line)
public String getTextID(String id)
public int getControlMaximumLength(String id)
public String getControlText(String id)
public String getControlText(String id, int col, int row)
The following combination of parameters apply:
Parameter Normal control Combobox List box --------------- -------------- ------------ ------------------ x and y omitted text text n/a x omitted n/a line in list n/a y omitted n/a n/a Header column text both x,y n/a n/a List box cellNote that the text for the control is returned even if it is not visible.
public String getVisibleControlText(String id, int col, int row)
The following combination of parameters apply:
Parameter Normal control Combobox List box --------------- -------------- ------------ ------------------ x and y omitted text text n/a x omitted n/a line in list n/a y omitted n/a n/a Header column text both x,y n/a n/a List box cellNote that the text for the control is empty if the control is not visible.
public VirtualInterface getControl(String id)
public String getGlobalVariable(String name)
public String getClientDNSName()
getClientDNSName
in interface SocketNameInterface
public String getClientIPAddress()
getClientIPAddress
in interface SocketNameInterface
public String getDigestCode()
public String getCurrentSequencedDigestCode()
public String getNextSequencedDigestCode()
public String getSequenceID()
public static String md5Digest(MessageDigest md, String string)
public static char getHex(int v)
public boolean isCookieUsed()
public void createSessionCookie(HttpSession httpSetSession)
Note: if the web application is not using cookies, this method will do nothing.
public void createSingleSessionCookie(boolean doRemove)
public HttpSession getSingleSessionForUser()
public String getSessionCookieID()
public boolean doesCookieSessionMatch()
public void removeSessionCookie()
public String getSecureLoginCookie(String resourceName)
public void setSecureLoginCookie(String value, String resourceName)
public BrowserCapabilities getBrowserCapabilities()
public void saveSession()
public String getApplicationAction()
public void createConstAppAction()
public String getConstAppAction()
public static HttpSession getSession(String hashCode, boolean checkDigestCode)
public void transferSession(HttpSession newSession)
public HttpSession getMessageDigestSession()
public boolean dispose()
public boolean hasSessionTimedOut()
public InetAddress getClientInetAddress()
getClientInetAddress
in interface ClientCommunicationInterface
public InetAddress getServerInetAddress()
getServerInetAddress
in interface ClientCommunicationInterface
public byte[] receiveTransaction()
receiveTransaction
in interface ClientCommunicationInterface
public byte[] receiveTransaction(Object[] isCompressed)
receiveTransaction
in interface ClientCommunicationInterface
public void sendTransaction(byte[] data)
sendTransaction
in interface ClientCommunicationInterface
public void sendTransaction(byte[] data, int type)
sendTransaction
in interface ClientCommunicationInterface
public boolean close()
close
in interface ClientCommunicationInterface
public void hardClose()
hardClose
in interface ClientCommunicationInterface
public ISocket getSocket()
getSocket
in interface ClientCommunicationInterface
public ServerSocketInterface getServerSocket()
getServerSocket
in interface ClientCommunicationInterface
public void addReplyExtraHeader(String header)
public Enumeration<String> getReplyExtraHeaders()
public static long getLongRandom()
public static HashMap<String,String> getURIParams(String uriParams, boolean keepCase)
uriParams
- the URI parameters to parse, null for none.keepCase
- If every parameter is case sensitive, otherwise they are
converted to lower case.public HashMap<String,String> getURIParams()
public HashMap<String,String> getURIParams(boolean keepCase)
keepCase
- If every parameter is case sensitive, otherwise they are
converted to lower case.Phantom® and NetPhantom® are registered trademarks of Mindus SARL.
© © Mindus SARL, 2024. All rights reserved.