|
Secure iNet Factory | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jscape.inet.http.Http
public class Http
Implements the basic functionality of a HTTP client.
Example Usage:
Http http = new Http(); // build HTTP request HttpRequest request = new HttpRequest("http://www.myserver.com"); // get HTTP response try { HttpResponse response = http.getResponse(request); System.out.println(new String(response.getBody())); } catch(Exception e) { System.out.println(e); }
Constructor Summary | |
---|---|
Http()
Constructs a new Http instance. |
Method Summary | |
---|---|
void |
addHttpListener(HttpListener listener)
Adds an event listener for events implemented by HttpListener interface. |
void |
clearProxySettings()
Clears proxy server values. |
java.io.PrintStream |
getDebugStream()
Gets PrintStream used in reporting debug statements. |
int |
getReadBlockSize()
Gets the number of bytes read in each block of data read from server |
HttpResponse |
getResponse(HttpFileUpload request)
Gets response to HTTP request. |
HttpResponse |
getResponse(HttpRequest request)
Gets response to HTTP request. |
HttpResponse |
getResponseToFile(HttpRequest request,
java.io.File file)
Gets response to HTTP request and writes contents to file. |
int |
getTimeout()
Gets the timeout used when opening a HTTP connection. |
int |
getWriteBlockSize()
Gets number of bytes written in each block to server |
boolean |
isDebug()
Gets debug level of HTTP session. |
void |
removeHttpListener(HttpListener listener)
Removes instance of HttpListener . |
void |
setDebug(boolean debug)
Sets debugging state. |
void |
setDebugStream(java.io.PrintStream debugStream)
Sets PrintStream used in reporting debug statements. |
void |
setProxyAuthentication(java.lang.String proxyUsername,
java.lang.String proxyPassword)
Sets the username and password to use when for authentication with proxy server. |
void |
setProxyHost(java.lang.String proxyHostname,
int proxyPort)
Sets the proxy hostname and port for this connection. |
void |
setProxyType(java.lang.String proxyType)
Sets the proxy type will be used for this connection. |
void |
setReadBlockSize(int i)
Sets the number of bytes read in each block of data read from server |
void |
setTimeout(int timeout)
Sets the timeout for opening a HTTP connection. |
void |
setWriteBlockSize(int i)
Sets number of bytes written in each block to server |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Http()
Http
instance.
Method Detail |
---|
public void addHttpListener(HttpListener listener)
HttpListener
interface.
listener
- an HttpListener
HttpListener
public void removeHttpListener(HttpListener listener)
HttpListener
.
listener
- an HttpListener
HttpListener
public HttpResponse getResponse(HttpFileUpload request) throws HttpException
request
- the HttpFileUpload to perform
HttpResponse
HttpException
- thrown if an I/O or HTTP related error occursHttpResponse
,
HttpException
public HttpResponse getResponse(HttpRequest request) throws HttpException
request
- the HttpRequest to perform
HttpResponse
HttpException
- thrown if an I/O or HTTP related error occursHttpResponse
,
HttpException
public HttpResponse getResponseToFile(HttpRequest request, java.io.File file) throws HttpException
request
- the HttpRequest to performfile
- the file to write the response to
HttpResponse
written to file
HttpException
- thrown if an I/O or HTTP related error occursHttpResponse
,
HttpException
public java.io.PrintStream getDebugStream()
PrintStream
public void setDebugStream(java.io.PrintStream debugStream)
debugStream
- the PrintStream to send debug statements toPrintStream
public void setDebug(boolean debug)
debug
- true
to turn debugging onsetDebugStream(java.io.PrintStream)
public boolean isDebug()
true
if debugging is onsetDebugStream(java.io.PrintStream)
public void setTimeout(int timeout)
timeout
- in millisecondspublic int getTimeout()
public int getWriteBlockSize()
public void setWriteBlockSize(int i)
i
- block sizepublic int getReadBlockSize()
public void setReadBlockSize(int i)
i
- block sizepublic void setProxyAuthentication(java.lang.String proxyUsername, java.lang.String proxyPassword)
#clearProxySettings
method.
proxyUsername
- the proxy usernameproxyPassword
- the proxy passwordclearProxySettings()
public void setProxyHost(java.lang.String proxyHostname, int proxyPort)
#clearProxySettings
method.
proxyHostname
- the hostname or ip address of the proxy serverproxyPort
- the port of the proxy serverclearProxySettings()
public void setProxyType(java.lang.String proxyType)
proxyType
- The proxy type. Valid values: HTTP, SOCKS5public void clearProxySettings()
|
Secure iNet Factory | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |