|
||||||||||
| PREV CLASS NEXT CLASS | 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
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 | |
|---|---|
static class |
Session.SecurityLevel
Specifies a value to use for security, either Low, Medium, or High. |
| Constructor Summary | |
|---|---|
Session()
Creates a new Session. |
|
Session(boolean installCookieManager)
Creates a new Session. |
|
| Method Summary | |
|---|---|
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)
Executes the given Request, and returns a Response. |
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()
|
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. |
void |
setSslSecurityLevel(Session.SecurityLevel level)
Sets the security level to use with SSL. |
protected void |
setState(State s)
|
| Methods inherited from class org.jdesktop.beans.AbstractBean |
|---|
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, clone, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, hasPropertyChangeListeners, hasVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Session()
CookieManager.
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.
installCookieManager - | Method Detail |
|---|
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.public final Session.SecurityLevel getSslSecurityLevel()
setSslSecurityLevel(org.jdesktop.http.Session.SecurityLevel)public final long getTotalBytes()
public final long getBytesSoFar()
public final float getProgress()
public final State getState()
protected void setState(State s)
public final Response get(String url)
throws Exception
Request using the Method.GET method.
This method blocks.
url - The url to hit. This url may contain a query string (ie: params).
The url cannot be null.
Response to the Request.
Exception - if an error occurs while creating or executing the
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,
Parameter... params)
throws Exception
Request using the Method.GET method.
This method blocks.
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.
Response to the Request.
Exception - if an error occurs while creating or executing the
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 post(String url)
throws Exception
Request using the Method.POST method.
This method blocks.
url - The url to hit. This url may contain a query string (ie: params).
The url cannot be null.
Response to the Request.
Exception - if an error occurs while creating or executing the
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 post(String url,
Parameter... params)
throws Exception
Request using the Method.POST method.
This method blocks.
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.
Response to the Request.
Exception - if an error occurs while creating or executing the
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 put(String url)
throws Exception
Request using the Method.PUT method.
This method blocks.
url - The url to hit. This url may contain a query string (ie: params).
The url cannot be null.
Response to the Request.
Exception - if an error occurs while creating or executing the
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 put(String url,
Parameter... params)
throws Exception
Request using the Method.PUT method.
This method blocks.
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.
Response to the Request.
Exception - if an error occurs while creating or executing the
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 execute(Method method,
String url)
throws Exception
Request, and returns the Response.
This method blocks. The given method, url
will be used to construct the Request.
All other Request properties are left in their default state.
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.
Response to the Request.
Exception - if an error occurs while creating or executing the
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 execute(Method method,
String url,
Parameter... params)
throws Exception
Request, and returns the Response.
This method blocks. The given method, url, and
params will be used to construct the Request.
All other Request properties are left in their default state.
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.
Response to the Request.
Exception - if an error occurs while creating or executing the
Request on the client machine. That is, if normal
http errors occur, they will not throw an exception (such as BAD_GATEWAY, etc).
public Response execute(Request req)
throws Exception
Request, and returns a Response.
This method blocks.
Response to the Request.
Exception - if an error occurs while creating or executing the
Request on the client machine. That is, if normal
http errors occur, they will not throw an exception (such as BAD_GATEWAY, etc).
protected URL createURL(String surl)
throws MalformedURLException
conn -
IOException
MalformedURLException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||