|
Groovy Documentation | |||||||
| FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.jdesktop.beans.AbstractBean
org.jdesktop.http.Session
public class Session extends org.jdesktop.beans.AbstractBean
Represents a user's "session" on the web. Think of it as a "tab" in a tabbed web browser. It may access multiple web sites during one "session", but remembers the cookies for all of them.
Sessions also contain all the information needed to keep track of the progress of a request/response cycle (including uploading and downloading of data). The values are reset at the beginning of a request and maintain their values until the next request is made. The property change events are fired on whatever thread called the execute method -- most likely a background thread (not the EDT). Be careful of that when binding GUI widgets to these properties.
| Nested Class Summary | |
|---|---|
enum |
Session.SecurityLevel
Specifies a value to use for security, either Low, Medium, or High. |
| Field Summary | |
|---|---|
private long |
bytesSoFar
Keeps track of the total number of bytes transfered upstream or downstream. |
private SecurityHandler |
handler
|
private Session.SecurityLevel |
sslSecurity
|
private State |
state
Keeps track of the state of the Session when performing a request/response cycle. |
private long |
totalBytes
Keeps track of the total number of bytes that are to be sent or receieved. |
| Constructor Summary | |
Session()
Creates a new Session. |
|
Session(boolean installCookieManager)
Creates a new Session. |
|
| Method Summary | |
|---|---|
private SSLSocketFactory
|
createSocketFactory(String host)
|
protected URL
|
createURL(String surl)
This method exists for the sake of testing. |
Response
|
execute(Method method, String url)
Constructs and executes a Request, and returns the Response. |
Response
|
execute(Method method, String url, Parameter... params)
Constructs and executes a Request, and returns the Response. |
Response
|
execute(Request req)
|
Response
|
get(String url)
Constructs and executes a Request using the Method.GET method. |
Response
|
get(String url, Parameter... params)
Constructs and executes a Request using the Method.GET method. |
long
|
getBytesSoFar()
|
SecurityHandler
|
getMediumSecurityHandler()
|
float
|
getProgress()
|
Session.SecurityLevel
|
getSslSecurityLevel()
Gets the SecurityLevel used for SSL connections. |
State
|
getState()
|
long
|
getTotalBytes()
|
Response
|
post(String url)
Constructs and executes a Request using the Method.POST method. |
Response
|
post(String url, Parameter... params)
Constructs and executes a Request using the Method.POST method. |
Response
|
put(String url)
Constructs and executes a Request using the Method.PUT method. |
Response
|
put(String url, Parameter... params)
Constructs and executes a Request using the Method.PUT method. |
private byte[]
|
readFully(InputStream in)
|
private void
|
setBytesSoFar(long bytes)
|
void
|
setMediumSecurityHandler(SecurityHandler h)
|
void
|
setSslSecurityLevel(Session.SecurityLevel level)
Sets the security level to use with SSL. |
protected void
|
setState(State s)
|
private void
|
setTotalBytes(long bytes)
|
Session
|
valueOf(String name)
Returns the enum constant of this type with the specified name. |
Session[]
|
values()
Returns an array containing the constants of this enum type, in the order they are declared. |
| Methods inherited from class org.jdesktop.beans.AbstractBean | |
|---|---|
| org.jdesktop.beans.AbstractBean#clone(), org.jdesktop.beans.AbstractBean#addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener), org.jdesktop.beans.AbstractBean#addPropertyChangeListener(java.beans.PropertyChangeListener), org.jdesktop.beans.AbstractBean#removePropertyChangeListener(java.beans.PropertyChangeListener), org.jdesktop.beans.AbstractBean#removePropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener), org.jdesktop.beans.AbstractBean#getPropertyChangeListeners(java.lang.String), org.jdesktop.beans.AbstractBean#getPropertyChangeListeners(), org.jdesktop.beans.AbstractBean#addVetoableChangeListener(java.lang.String, java.beans.VetoableChangeListener), org.jdesktop.beans.AbstractBean#addVetoableChangeListener(java.beans.VetoableChangeListener), org.jdesktop.beans.AbstractBean#removeVetoableChangeListener(java.lang.String, java.beans.VetoableChangeListener), org.jdesktop.beans.AbstractBean#removeVetoableChangeListener(java.beans.VetoableChangeListener), org.jdesktop.beans.AbstractBean#getVetoableChangeListeners(java.lang.String), org.jdesktop.beans.AbstractBean#getVetoableChangeListeners(), org.jdesktop.beans.AbstractBean#wait(), org.jdesktop.beans.AbstractBean#wait(long), org.jdesktop.beans.AbstractBean#wait(long, int), org.jdesktop.beans.AbstractBean#equals(java.lang.Object), org.jdesktop.beans.AbstractBean#toString(), org.jdesktop.beans.AbstractBean#hashCode(), org.jdesktop.beans.AbstractBean#getClass(), org.jdesktop.beans.AbstractBean#notify(), org.jdesktop.beans.AbstractBean#notifyAll() |
| Methods inherited from class Object | |
|---|---|
| wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
| Field Detail |
|---|
private long bytesSoFar
private SecurityHandler handler
private Session.SecurityLevel sslSecurity
Represents a user's "session" on the web. Think of it as a "tab" in a tabbed web browser. It may access multiple web sites during one "session", but remembers the cookies for all of them.
Sessions also contain all the information needed to keep track of the progress of a request/response cycle (including uploading and downloading of data). The values are reset at the beginning of a request and maintain their values until the next request is made. The property change events are fired on whatever thread called the execute method -- most likely a background thread (not the EDT). Be careful of that when binding GUI widgets to these properties.
private State state
private long totalBytes
| Constructor Detail |
|---|
public Session()
public Session(boolean installCookieManager)
installCookieManager is true,
then the CookieManager is installed automatically. Otherwise, the
CookieManager will not be installed, allowing you to use some
other cookie manager.
| Method Detail |
|---|
private SSLSocketFactory createSocketFactory(String host)
protected URL createURL(String surl)
public final Response execute(Method method, String url)
method, url
will be used to construct the Request.
All other Request properties are left in their default state.Request on the client machine. That is, if normal
http errors occur, they will not throw an exception (such as BAD_GATEWAY, etc).method - The HTTP Method to use. This must not be null.url - The url to hit. This url may contain a query string (ie: params).
The url cannot be null.
public final Response execute(Method method, String url, Parameter... params)
method, url, and
params will be used to construct the Request.
All other Request properties are left in their default state.Request on the client machine. That is, if normal
http errors occur, they will not throw an exception (such as BAD_GATEWAY, etc).method - The HTTP Method to use. This must not be null.url - The url to hit. This url may contain a query string (ie: params).
The url cannot be null.params - The params to include in the request. This may be null.
public Response execute(Request req)
Request on the client machine. That is, if normal
http errors occur, they will not throw an exception (such as BAD_GATEWAY, etc).
public final Response get(String url)
Request on the client machine. That is, if normal
http errors occur, they will not throw an exception (such as BAD_GATEWAY, etc).url - The url to hit. This url may contain a query string (ie: params).
The url cannot be null.
public final Response get(String url, Parameter... params)
Request on the client machine. That is, if normal
http errors occur, they will not throw an exception (such as BAD_GATEWAY, etc).url - The url to hit. This url may contain a query string (ie: params).
The url cannot be null.params - The params to include in the request. This may be null.
public final long getBytesSoFar()
SecurityHandler getMediumSecurityHandler()
public final float getProgress()
public final Session.SecurityLevel getSslSecurityLevel()
public final State getState()
public final long getTotalBytes()
public final Response post(String url)
Request on the client machine. That is, if normal
http errors occur, they will not throw an exception (such as BAD_GATEWAY, etc).url - The url to hit. This url may contain a query string (ie: params).
The url cannot be null.
public final Response post(String url, Parameter... params)
Request on the client machine. That is, if normal
http errors occur, they will not throw an exception (such as BAD_GATEWAY, etc).url - The url to hit. This url may contain a query string (ie: params).
The url cannot be null.params - The params to include in the request. This may be null.
public final Response put(String url)
Request on the client machine. That is, if normal
http errors occur, they will not throw an exception (such as BAD_GATEWAY, etc).url - The url to hit. This url may contain a query string (ie: params).
The url cannot be null.
public final Response put(String url, Parameter... params)
Request on the client machine. That is, if normal
http errors occur, they will not throw an exception (such as BAD_GATEWAY, etc).url - The url to hit. This url may contain a query string (ie: params).
The url cannot be null.params - The params to include in the request. This may be null.
private byte[] readFully(InputStream in)
private void setBytesSoFar(long bytes)
void setMediumSecurityHandler(SecurityHandler h)
public void setSslSecurityLevel(Session.SecurityLevel level)
level - one of High, Medium, or Low. Low will not prompt or fail for self signed certs.
Medium will prompt for self signed certs. High will fall back on the default
behavior, and simply fail for self signed certs.
protected void setState(State s)
private void setTotalBytes(long bytes)
Session valueOf(String name)
Session[] values()
Groovy Documentation