public class HttpTransaction extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULTCS |
static String |
METHOD_GET |
static String |
METHOD_POST |
| Constructor and Description |
|---|
HttpTransaction()
Default constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
clearParameters()
Empty the parameter list
|
int |
doTransaction()
Perform one command transaction
|
int |
doTransaction(String url)
Perform one command transaction - add parameters and build the URL
|
int |
doTransaction(URL url)
Perform one command transaction
|
String |
getBaseUrlSpecification()
Get the basic url specification for this connection
|
HttpURLConnection |
getConnection()
Get an HttpURLConnection for this transaction
|
String |
getDefaultCharacterSet()
Get the default character set (use if none supplied by server)
|
String |
getInputCharacterSet()
Get the default character set (use if none supplied by server)
|
String |
getParameter(String name)
Get a named parameter
|
String |
getParameterName(String value)
Get parameter the name of first occurance of the supplied value
|
byte[] |
getResponseBytes()
Get the unfiltered response as sent by the server (debug)
|
String |
getResponseCharacterSet()
Get the response document character set (supplied by the server)
|
int |
getResponseCode()
Get the response status
|
List |
getResponseCookies()
Get all provided cookies
|
String |
getResponseHeader(String key)
Get a named HTTP response
|
CaseBlindHashMap |
getResponseHeaders()
Get all HTTP response headers
|
String |
getResponseString()
Get the character-set-encoded String rendition of the server response
|
String |
getUrl()
Get the URL text sent to the server
|
void |
initialize(List cookieList)
Initialize
|
void |
initialize(URL url,
List cookieList)
Initialize.
|
void |
setDefaultCharacterSet(String cs)
Set the default character set
|
void |
setFollowRedirects(boolean follow)
Honor redirects?
|
void |
setInputCharacterSet(String cs)
Set the input character set
|
void |
setParameter(String name,
String value)
Set up a name=value pair
|
void |
setPreserveBaseUrlFile(boolean state)
Set the "preserve URL file" flag
|
void |
setTransactionType(String type)
Set the transaction type
|
public static final String METHOD_GET
public static final String METHOD_POST
public static final String DEFAULTCS
public void initialize(List cookieList)
public void setTransactionType(String type)
type - (GET or POST)public void setFollowRedirects(boolean follow)
follow - Set as true to follow any redirects suggestedpublic void setParameter(String name, String value)
name - Parameter namevalue - Parameter valuepublic String getParameter(String name)
name - Parameter namepublic String getParameterName(String value)
value - Parameter valuepublic void clearParameters()
public int getResponseCode()
public String getUrl()
public void setPreserveBaseUrlFile(boolean state)
state - true to preserve the URL file portion (default is false)public String getBaseUrlSpecification() throws MalformedURLException
MalformedURLExceptionpublic byte[] getResponseBytes()
public String getResponseString()
public CaseBlindHashMap getResponseHeaders()
public String getResponseHeader(String key)
public List getResponseCookies()
public String getResponseCharacterSet()
public void setDefaultCharacterSet(String cs)
cs - Character set (utf-8, etc)
Note: the character set defaults to DEFAULTCS (above) if not overriddenpublic String getDefaultCharacterSet()
public void setInputCharacterSet(String cs)
cs - Character set (utf-8, etc)
Note: the character set defaults to DEFAULTCS (above) if not overriddenpublic String getInputCharacterSet()
public HttpURLConnection getConnection() throws IOException
IOExceptionpublic int doTransaction(String url) throws IOException, DomException
url - URL string to server-side resourceIOExceptionDomExceptionpublic int doTransaction(URL url) throws IOException, DomException
url - URL for server-sideIOExceptionDomExceptionpublic int doTransaction()
throws IOException,
DomException
IOExceptionDomExceptionCopyright © 2004–2019 Indiana University Library Information Technology. All rights reserved.