public class HttpSession
extends java.lang.Object
HttpSession session = new HttpSession(); HttpResponse response1 = session.getResponse("http://www.mydomain.com/page1"); HttpResponse response2 = session.getResponse("http://www.mydomain.com/page2"); HttpRequest page3 = new HttpRequest("http://www.mydomain.com/page3"); page3.addParameter("username","jsmith"); page3.addParameter("password","secret"); * HttpResponse response3 = session.getResponse(page3);
Constructor and Description |
---|
HttpSession()
Creates a new HttpSession instance.
|
HttpSession(Http http)
Creates a new HttpSession instance.
|
Modifier and Type | Method and Description |
---|---|
java.util.Vector |
getCookiesForHost(java.lang.String host)
Gets all cookies for the specified hostname
|
java.io.PrintStream |
getDebugStream()
Gets debug stream used for debug messages.
|
HttpResponse |
getResponse(HttpRequest request)
Gets response from HTTP server.
|
HttpResponse |
getResponse(java.lang.String url)
Gets response from HTTP server.
|
HttpResponse |
getResponse(java.lang.String url,
java.lang.String method)
Gets response from HTTP server.
|
boolean |
isAllowCookies()
Checks if cookies are allowed to be stored in memory.
|
boolean |
isDebug()
Checks if debugging is enabled.
|
void |
setAllowCookies(boolean allowCookies)
Sets whether cookies are allowed to be stored in memory.
|
void |
setDebug(boolean debug)
Enables or disables debugging.
|
void |
setDebugStream(java.io.PrintStream debugStream)
Sets debug stream to be used for debug messages.
|
public HttpSession(Http http)
http
- an Http instance.Http
public HttpSession()
public HttpResponse getResponse(java.lang.String url, java.lang.String method) throws HttpException
url
- the web address to retrievemethod
- the method, valid values are GET and POSTHttpException
- if an I/O or HTTP related error occurspublic HttpResponse getResponse(java.lang.String url) throws HttpException
url
- the web address to retrieveHttpException
- if an I/O or HTTP related error occurspublic HttpResponse getResponse(HttpRequest request) throws HttpException
request
- an HttpRequestHttpException
- if an I/O or HTTP related error occurspublic java.util.Vector getCookiesForHost(java.lang.String host)
host
- the hostname to find cookies forpublic boolean isAllowCookies()
public void setAllowCookies(boolean allowCookies)
allowCookies
- true if cookies are allowed, false otherwisepublic void setDebug(boolean debug)
debug
- true if enabled, false otherwise.public boolean isDebug()
public void setDebugStream(java.io.PrintStream debugStream)
debugStream
- a PrintStreamPrintStream
public java.io.PrintStream getDebugStream()
PrintStream
Copyright © JSCAPE LLC. 1999-2021. All Rights Reserved