|
Groovy Documentation | |||||||
| FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.jdesktop.beans.AbstractBean
org.jdesktop.http.async.AsyncHttpRequest
public class AsyncHttpRequest extends org.jdesktop.beans.AbstractBean
A simple non visual bean that uses HTTP to interact with web servers. This class conforms (except for XML specific functionality) with XMLHttpRequest as defined in the W3C Working Draft Specification http://www.w3.org/TR/XMLHttpRequest/.
Several methods, such as the abort() method, cause the AsyncHttpRequest to be "reset". This means that any state associated with the response is cleared, and the readyState reset to UNINITIALIZED.
AsyncHttpRequest relies on Session for communicating with the server. It is possible to reuse an existing Session. However, if a Session is not specified, a new one is constructed for the request.
| Nested Class Summary | |
|---|---|
protected class |
AsyncHttpRequest.AsyncWorker
|
enum |
AsyncHttpRequest.ReadyState
|
| Field Summary | |
|---|---|
private boolean |
asyncFlag
|
private Exception |
exception
|
private PropertyChangeListener |
onReadyStateChange
|
private AsyncHttpRequest.ReadyState |
readyState
|
private Request |
req
|
private String |
responseText
If the statusText attribute is not available, it MUST raise an exception. |
private Session |
s
|
private int |
status
Worker class used to actually perform the background tasks. |
private String |
statusText
|
private AsyncHttpRequest.AsyncWorker |
worker
Creates a new instance of AsyncHttpRequest. |
| Constructor Summary | |
AsyncHttpRequest()
|
|
| Method Summary | |
|---|---|
void
|
abort()
|
void
|
addReadyStateChangeListener(PropertyChangeListener listener)
|
protected AsyncHttpRequest.AsyncWorker
|
createAsyncWorker(String content)
Method that provides a hook for subclasses to create concrete types (such as DOM, JSONObject, etc) when the response has been fully read. |
String
|
getAllResponseHeaders()
|
Exception
|
getException()
Adds the given parameter to the set of parameters. |
boolean
|
getFollowRedirects()
Returns the Parameter with the given name, or null if there is no such Parameter. |
PropertyChangeListener
|
getOnReadyStateChange()
|
Parameter
|
getParameter(String name)
Gets an array of all the Parameters for this Request. |
Parameter[]
|
getParameters()
|
AsyncHttpRequest.ReadyState
|
getReadyState()
Initializes the AsyncHttpRequest prior to sending a request. |
PropertyChangeListener[]
|
getReadyStateChangeListeners()
|
String
|
getResponseHeader(String headerLabel)
If the status property is not available it MUST raise an exception. |
String
|
getResponseText()
If the statusText property is not available, it MUST raise an exception. |
Session
|
getSession()
|
int
|
getStatus()
Specifies whether the request should automatically follow redirects. |
String
|
getStatusText()
|
protected void
|
handleResponse(String responseText)
This is private because statusText is a read only property. |
void
|
open(Method method, String url)
|
void
|
open(Method method, String url, boolean asyncFlag)
|
private void
|
open(Method method, String url, boolean asyncFlag, String username)
|
private void
|
open(Method method, String url, boolean asyncFlag, String username, String password)
|
void
|
removeReadyStateChangeListener(PropertyChangeListener listener)
|
protected void
|
reset()
|
void
|
send()
Sends the request to the server. |
void
|
send(String content)
|
void
|
send(org.w3c.dom.Document dom)
|
void
|
setFollowsRedirects(boolean flag)
If during the processing of this request an exception occured, then this method will return that Exception. |
void
|
setOnReadyStateChange(PropertyChangeListener listener)
Returns the ready-state change listener. |
void
|
setParameter(Parameter param)
|
void
|
setParameter(String name, String value)
|
void
|
setParameters(Parameter... params)
Clears any response state and resets the readyState to UNINITIALIZED. |
private void
|
setReadyState(AsyncHttpRequest.ReadyState state)
|
void
|
setRequestHeader(String header, String value)
Specifies a request header for the HTTP request. |
void
|
setSession(Session s)
Returns the Session used with this Request. |
private void
|
setStatus(int status)
|
private void
|
setStatusText(String text)
|
AsyncHttpRequest
|
valueOf(String name)
Returns the enum constant of this type with the specified name. |
AsyncHttpRequest[]
|
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 boolean asyncFlag
private Exception exception
private PropertyChangeListener onReadyStateChange
private AsyncHttpRequest.ReadyState readyState
A simple non visual bean that uses HTTP to interact with web servers. This class conforms (except for XML specific functionality) with XMLHttpRequest as defined in the W3C Working Draft Specification http://www.w3.org/TR/XMLHttpRequest/.
Several methods, such as the abort() method, cause the AsyncHttpRequest to be "reset". This means that any state associated with the response is cleared, and the readyState reset to UNINITIALIZED.
AsyncHttpRequest relies on Session for communicating with the server. It is possible to reuse an existing Session. However, if a Session is not specified, a new one is constructed for the request.
private Request req
private String responseText
private Session s
private int status
private String statusText
private AsyncHttpRequest.AsyncWorker worker
| Constructor Detail |
|---|
public AsyncHttpRequest()
| Method Detail |
|---|
public void abort()
public void addReadyStateChangeListener(PropertyChangeListener listener)
protected AsyncHttpRequest.AsyncWorker createAsyncWorker(String content)
public String getAllResponseHeaders()
public Exception getException()
param - the Parameter to add. This must not be null.
public final boolean getFollowRedirects()
name - the name to look for. This must not be null.
public final PropertyChangeListener getOnReadyStateChange()
public Parameter getParameter(String name)
public Parameter[] getParameters()
public final AsyncHttpRequest.ReadyState getReadyState()
public PropertyChangeListener[] getReadyStateChangeListeners()
public String getResponseHeader(String headerLabel)
public String getResponseText()
public Session getSession()
public int getStatus()
flag - indicates whether to follow redirects automatically
public String getStatusText()
protected void handleResponse(String responseText)
public void open(Method method, String url)
public void open(Method method, String url, boolean asyncFlag)
private void open(Method method, String url, boolean asyncFlag, String username)
private void open(Method method, String url, boolean asyncFlag, String username, String password)
public void removeReadyStateChangeListener(PropertyChangeListener listener)
protected void reset()
public void send()
public void send(String content)
public void send(org.w3c.dom.Document dom)
public void setFollowsRedirects(boolean flag)
public void setOnReadyStateChange(PropertyChangeListener listener)
public void setParameter(Parameter param)
public void setParameter(String name, String value)
public void setParameters(Parameter... params)
private void setReadyState(AsyncHttpRequest.ReadyState state)
public void setRequestHeader(String header, String value)
public void setSession(Session s)
private void setStatus(int status)
private void setStatusText(String text)
AsyncHttpRequest valueOf(String name)
AsyncHttpRequest[] values()
Groovy Documentation