Thread.State, Thread.UncaughtExceptionHandler
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
HttpRequest(String sUrl)
Create new request for the given URL with default method GET
|
HttpRequest(String sUrl,
URL oReferUrl,
String sMethod,
Map.Entry<String,String>[] aParams)
Create new request for the given URL
|
HttpRequest(String sUrl,
URL oReferUrl,
String sMethod,
Map.Entry<String,String>[] aParams,
String sUsr,
String sPwd)
Create new request for the given URL with basic authentication
|
Modifier and Type | Method and Description |
---|---|
void |
addCookie(String name,
String value)
Add a cookie for the next call
|
void |
addHeader(String name,
String value)
Add a header for the next call
|
Object |
call() |
String |
encoding()
Get response encoding
|
Object |
get()
Perform HTTP GET request
|
List<Map.Entry<String,String>> |
getCookies()
Get cookies read from the last get or post call
|
List<Map.Entry<String,String>> |
getHeaders()
Get headers read from the last get or post call
|
String |
getLanguage()
Get response HTML document content language
|
String |
getTitle()
Get response HTML document title
|
int |
head()
Perform HTTP HEAD request
|
Object |
post()
Perform HTTP POST request
|
int |
responseCode()
Get response code from last GET, POST or HEAD request
|
void |
run() |
void |
setCookies(List<Map.Entry<String,String>> aCookies)
Set cookies for next call to get or post method
|
void |
setCookies(Map<String,String> mCookies)
Set cookies for next call to get or post method
|
void |
setHeaders(List<Map.Entry<String,String>> aHeaders)
Set headers for next call to get or post method
|
void |
setHeaders(Map<String,String> mHeaders)
Set headers for next call to get or post method
|
String |
src()
Get response as String
|
String |
url() |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
public HttpRequest(String sUrl)
sUrl
- Stringpublic HttpRequest(String sUrl, URL oReferUrl, String sMethod, Map.Entry<String,String>[] aParams)
sUrl
- String requested URLoReferUrl
- String Referrer URLsMethod
- String Must be "get" or "post"aParams
- Array with parameters to be sent along with get or postpublic HttpRequest(String sUrl, URL oReferUrl, String sMethod, Map.Entry<String,String>[] aParams, String sUsr, String sPwd)
sUrl
- String requested URLoReferUrl
- String Referer URLsMethod
- String Must be "get" or "post"aParams
- Array with parameters to be sent along with get or postsUsr
- StringsPwd
- Stringpublic void addCookie(String name, String value)
name
- String Cookie Namevalue
- String Cookie Valuepublic void addHeader(String name, String value)
name
- String Header Namevalue
- String Header Valuepublic List<Map.Entry<String,String>> getCookies()
public List<Map.Entry<String,String>> getHeaders()
public void setCookies(List<Map.Entry<String,String>> aCookies)
aCookies
- List<Entry<String,String>>public void setCookies(Map<String,String> mCookies)
mCookies
- Map<String,String>public void setHeaders(List<Map.Entry<String,String>> aHeaders)
aHeaders
- List<Entry<String,String>>public void setHeaders(Map<String,String> mHeaders)
mHeaders
- Map<String,String>public Object post() throws IOException, URISyntaxException, MalformedURLException
IOException
- if server returned any status different from HTTP_MOVED_PERM (301), HTTP_MOVED_TEMP (302), HTTP_OK (200) or HTTP_ACCEPTED (202)URISyntaxException
MalformedURLException
public String url()
public Object get() throws IOException, URISyntaxException, MalformedURLException
IOException
- if server returned any status different from HTTP_MOVED_PERM (301), HTTP_MOVED_TEMP (302), HTTP_OK (200) or HTTP_ACCEPTED (202)URISyntaxException
MalformedURLException
public int head() throws IOException, URISyntaxException, MalformedURLException
IOException
URISyntaxException
MalformedURLException
public int responseCode()
public String src() throws IOException, UnsupportedEncodingException, URISyntaxException
IOException
UnsupportedEncodingException
URISyntaxException
public String encoding() throws IOException, UnsupportedEncodingException, URISyntaxException
IOException
UnsupportedEncodingException
URISyntaxException
public String getTitle() throws IOException, URISyntaxException, MalformedURLException, UnsupportedEncodingException
IOException
URISyntaxException
MalformedURLException
UnsupportedEncodingException
public String getLanguage() throws IOException, URISyntaxException, MalformedURLException, UnsupportedEncodingException, org.htmlparser.util.ParserException
IOException
org.htmlparser.util.ParserException
URISyntaxException
MalformedURLException
UnsupportedEncodingException
Copyright © 2019. All rights reserved.