public class InternetExplorer
extends java.lang.Object
destroy
to free the native memory associated with this object when you are done
with it. In addition, when passing POST data to loadURL
, make sure the following header is specified:
Content-Type: application/x-www-form-urlencoded
Modifier and Type | Field and Description |
---|---|
static org.apache.log4j.Logger |
log
Used for logging.
|
static int |
NUM_REQUESTS |
Constructor and Description |
---|
InternetExplorer()
Constructs a new (invisible) Internet Explorer instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
create()
Creates an embedded Internet Explorer on the apartment thread.
|
void |
destroy()
Destroys this
InternetExplorer instance. |
static void |
dispatchRunnable()
Removes a
Runnable from the queue and runs its. |
static byte[] |
getCookieData(java.lang.String url)
Returns the current cookie data for the specified URL.
|
java.lang.String |
getHTML()
Retrieves the HTML for the current page.
|
java.lang.String |
getPostData() |
java.lang.String |
getURL() |
static boolean |
init()
Initializes Internet Explorer support.
|
boolean |
loadURL(java.lang.String url,
byte[] post_data,
java.lang.String headers,
int timeout)
Loads the specified URL.
|
boolean |
makeRequest() |
static void |
postQuit()
Tells the apartment thread to quit.
|
void |
resetPostData()
Resets the POST data to null.
|
static boolean |
setCookieData(java.lang.String url,
byte[] data)
Sets the current cookie data for the specified URL.
|
void |
setPostData(java.lang.String postData) |
void |
setReferer(java.lang.String referer) |
void |
setTimeout(int timeout)
Sets the timeout.
|
void |
setURL(java.lang.String url) |
static void |
shutdown()
Terminates Internet Explorer support.
|
boolean |
waitForLoad(int timeout)
Waits for the page to load completely.
|
public static int NUM_REQUESTS
public static org.apache.log4j.Logger log
public InternetExplorer()
public static boolean init()
true
if successful.public static void shutdown()
public static void postQuit()
public static byte[] getCookieData(java.lang.String url)
url
- URL to get cookie data for.null
if there is no data.public static boolean setCookieData(java.lang.String url, byte[] data)
url
- URL to set cookie data for.data
- Cookie data.true
if successful.public static void dispatchRunnable()
Runnable
from the queue and runs its. This method is called by the Win32 message pump to perform Java code on the apartment thread.public java.lang.String getURL()
public void setURL(java.lang.String url)
public void setReferer(java.lang.String referer)
public java.lang.String getPostData()
public void setPostData(java.lang.String postData)
public void resetPostData()
public void setTimeout(int timeout)
timeout
- The timeout in milliseconds.public boolean create()
true
if creation was successful.public void destroy()
InternetExplorer
instance.public boolean waitForLoad(int timeout)
timeout
- Number of milliseconds to wait before timing out.public boolean makeRequest()
public boolean loadURL(java.lang.String url, byte[] post_data, java.lang.String headers, int timeout)
url
- The URL to load.post_data
- byte[]
of POST data.headers
- String
of headers. Each header entry should be separated by a \r\n
. You must specify the correct Content-Type header for
POST data!!timeout
- Milliseconds to wait for page load before timing out.true
if the load was successful.public java.lang.String getHTML()