|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.pushtotest.tool.protocolhandler.ProtocolWrapper
com.pushtotest.tool.protocolhandler.HTTPProtocol
public class HTTPProtocol
This is the implementation of the HTTP Protocol handler. This will probably reused by a lot of stuff including HTTPS and SOAP, so be careful not to make to many assumption about the way of the world, so that other code can piggy back off of it.
| Field Summary | |
|---|---|
com.sonalb.net.http.cookie.CookieJar |
cookieJar
|
static int |
GET
|
static int |
POST
|
| Fields inherited from class com.pushtotest.tool.protocolhandler.ProtocolWrapper |
|---|
body, errno, header, host, name, pass, path, port, proxyHost, proxyPass, proxyPort, proxyUser, query, response, running, scheme, timeout, type, url |
| Fields inherited from interface com.pushtotest.tool.protocolhandler.Protocol |
|---|
IOERROR, NOERROR, NOTREADY, OTHER, TIMEOUT |
| Constructor Summary | |
|---|---|
HTTPProtocol()
|
|
| Method Summary | |
|---|---|
void |
clearURLlist()
Clears the previously recorded list of visited URLs. |
Response |
connect()
Calling this method actually causes the connection to be made. |
Response |
connect(int follow)
Same as connect() plus has option to follow HTTP 302 Redirect commands. |
Response |
connect(javax.net.ssl.SSLSocketFactory sslSF)
Calling this method actually causes the connection to be made. |
java.util.Iterator |
getCookies()
Returns an iterator that returns a collection of com.sonalb.net.http.cookie.Cookie objects, each one encapusaltes a cookie. |
java.lang.String |
getHeaderField(java.lang.String headerkey)
Get a HTTP header field, based on the header key name. |
java.util.Map |
getHeaderFields()
Get the HTTP Header field list |
java.util.Enumeration |
getURLlist()
Returns an Enumeration of URLs to which this object has connected. |
java.lang.String |
id()
Returns an id for this protocol. |
void |
send()
Not needed in an HTTP context |
void |
setDisconnect(boolean flag)
|
void |
setHostnameVerifier(com.sun.net.ssl.HostnameVerifier hnv)
Sets the HostnameVerifier for an HTTPS connection. |
protected boolean |
supports(java.lang.String id)
Tests to see if this protocol will support a specific type. |
| Methods inherited from class com.pushtotest.tool.protocolhandler.ProtocolWrapper |
|---|
getBody, getErrno, getHost, getPassword, getResponse, getTimeout, getUrl, getUrl, getURL, getUsername, isRunning, parseUrl, run, setBody, setErrno, setHeader, setHost, setPassword, setPath, setPort, setProxyHost, setProxyPass, setProxyPort, setProxyUser, setQueryString, setScheme, setTimeout, setType, setUrl, setUsername, supportsBody, supportsHeader, supportsResponse |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int GET
public static final int POST
public com.sonalb.net.http.cookie.CookieJar cookieJar
| Constructor Detail |
|---|
public HTTPProtocol()
| Method Detail |
|---|
public java.lang.String id()
id in interface Protocolid in class ProtocolWrapperpublic void setDisconnect(boolean flag)
public Response connect(javax.net.ssl.SSLSocketFactory sslSF)
throws NotReadyException,
NoSuchClassException,
ToolException,
java.io.IOException
NotReadyException - If the connect is called without all of the proper
pieces set that it needs to connect to the given protocol.
ConnectionTimeoutException - If a timeout was set and that timeout is reached
before the connection is completed.
Additionally it will set the SSLSocketFactory to allow the connection to a SSL
where private certificates are used.
NoSuchClassException
ToolException
java.io.IOException
public Response connect()
throws NotReadyException,
NoSuchClassException,
ToolException,
java.io.IOException
connect in interface Protocolconnect in class ProtocolWrapperNotReadyException - If the connect is called without all of the proper
pieces set that it needs to connect to the given protocol.
ConnectionTimeoutException - If a timeout was set and that timeout is reached
before the connection is completed.
NoSuchClassException
ToolException
java.io.IOException
public Response connect(int follow)
throws NotReadyException,
NoSuchClassException,
ToolException,
java.io.IOException
follow - if set to 1 tells connect to automatically follow
HTTP 302 Redirect commands to the next URL. 1 also tells connect to follow
redirects and add base URL values when the redirect header URL does not include them.
NotReadyException
NoSuchClassException
ToolException
java.io.IOExceptionpublic java.util.Iterator getCookies()
public java.util.Enumeration getURLlist()
public void setHostnameVerifier(com.sun.net.ssl.HostnameVerifier hnv)
public void clearURLlist()
protected boolean supports(java.lang.String id)
supports in class ProtocolWrapperid - The string id to test.public void send()
send in class ProtocolWrapperpublic java.util.Map getHeaderFields()
public java.lang.String getHeaderField(java.lang.String headerkey)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||