final class URLLoader
extends java.lang.Object
implements java.lang.Runnable
Modifier and Type | Class and Description |
---|---|
private static class |
URLLoader.InvalidResponseException
Signals an invalid response from the server.
|
private static class |
URLLoader.Redirect
A holder for redirect information.
|
private static class |
URLLoader.TooManyRedirectsException
Signals that too many redirects have been encountered
while processing the request.
|
Modifier and Type | Field and Description |
---|---|
static int |
ALLOW_UNASSIGNED |
private boolean |
asynchronous |
private ByteBufferPool |
byteBufferPool |
private boolean |
canceled |
private long |
data |
private static java.lang.String |
DELETE |
private FormDataElement[] |
formDataElements |
private static java.lang.String |
GET |
private static java.lang.String |
HEAD |
private java.lang.String |
headers |
private static java.util.logging.Logger |
logger |
private static int |
MAX_BUF_COUNT |
private static int |
MAX_REDIRECTS |
private java.lang.String |
method |
private java.lang.String |
url |
private WebPage |
webPage |
Constructor and Description |
---|
URLLoader(WebPage webPage,
ByteBufferPool byteBufferPool,
boolean asynchronous,
java.lang.String url,
java.lang.String method,
java.lang.String headers,
FormDataElement[] formDataElements,
long data)
Creates a new
URLLoader . |
Modifier and Type | Method and Description |
---|---|
private static java.lang.String |
adjustUrlForWebKit(java.lang.String url)
Adjust a URL string for passing into WebKit.
|
private void |
callBack(java.lang.Runnable runnable) |
private static void |
close(java.net.URLConnection c)
Releases the resources that may be associated with a connection.
|
private void |
didFail(int errorCode,
java.lang.String message) |
private void |
didFinishLoading() |
private void |
didReceiveData(java.nio.ByteBuffer byteBuffer,
ByteBufferAllocator allocator) |
private void |
didReceiveResponse(java.net.URLConnection c) |
private void |
didSendData(long totalBytesSent,
long totalBytesToBeSent) |
private void |
doRun()
Executes this loader.
|
private static java.lang.String |
extractContentEncoding(java.net.URLConnection c)
Given a
URLConnection , returns the content encoding
for passing into native callbacks. |
private static long |
extractContentLength(java.net.URLConnection c)
Given a
URLConnection , returns the content length
for passing into native callbacks. |
private static java.lang.String |
extractHeaders(java.net.URLConnection c)
Given a
URLConnection , returns the headers string
for passing into native callbacks. |
private static int |
extractStatus(java.net.URLConnection c)
Given a
URLConnection , returns the connection status
for passing into native callbacks. |
private void |
fwkCancel()
Cancels this loader.
|
private void |
notifyDidFail(int errorCode,
java.lang.String url,
java.lang.String message) |
private void |
notifyDidFinishLoading() |
private void |
notifyDidReceiveData(java.nio.ByteBuffer byteBuffer,
int position,
int remaining) |
private void |
notifyDidReceiveResponse(int status,
java.lang.String contentType,
java.lang.String contentEncoding,
long contentLength,
java.lang.String headers,
java.lang.String url) |
private void |
notifyDidSendData(long totalBytesSent,
long totalBytesToBeSent) |
private boolean |
notifyWillSendRequest(java.lang.String newUrl,
java.lang.String newMethod,
int status,
java.lang.String contentType,
java.lang.String contentEncoding,
long contentLength,
java.lang.String headers,
java.lang.String url) |
private void |
prepareConnection(java.net.URLConnection c)
Prepares a connection.
|
private URLLoader.Redirect |
receiveResponse(java.net.URLConnection c)
Receives response from the server.
|
void |
run() |
private void |
sendRequest(java.net.URLConnection c,
boolean streaming)
Sends request to the server.
|
private static void |
twkDidFail(int errorCode,
java.lang.String url,
java.lang.String message,
long data) |
private static void |
twkDidFinishLoading(long data) |
private static void |
twkDidReceiveData(java.nio.ByteBuffer byteBuffer,
int position,
int remaining,
long data) |
private static void |
twkDidReceiveResponse(int status,
java.lang.String contentType,
java.lang.String contentEncoding,
long contentLength,
java.lang.String headers,
java.lang.String url,
long data) |
private static void |
twkDidSendData(long totalBytesSent,
long totalBytesToBeSent,
long data) |
private static boolean |
twkWillSendRequest(java.lang.String newUrl,
java.lang.String newMethod,
int status,
java.lang.String contentType,
java.lang.String contentEncoding,
long contentLength,
java.lang.String headers,
java.lang.String url,
long data) |
private void |
willSendRequest(java.lang.String newUrl,
java.lang.String newMethod,
java.net.URLConnection c) |
private static void |
workaround7177996(java.net.URL url) |
@Native public static final int ALLOW_UNASSIGNED
private static final java.util.logging.Logger logger
private static final int MAX_REDIRECTS
private static final int MAX_BUF_COUNT
private static final java.lang.String GET
private static final java.lang.String HEAD
private static final java.lang.String DELETE
private final WebPage webPage
private final ByteBufferPool byteBufferPool
private final boolean asynchronous
private java.lang.String url
private java.lang.String method
private final java.lang.String headers
private FormDataElement[] formDataElements
private final long data
private volatile boolean canceled
URLLoader(WebPage webPage, ByteBufferPool byteBufferPool, boolean asynchronous, java.lang.String url, java.lang.String method, java.lang.String headers, FormDataElement[] formDataElements, long data)
URLLoader
.private void fwkCancel()
public void run()
run
in interface java.lang.Runnable
private void doRun()
private static void workaround7177996(java.net.URL url) throws java.io.FileNotFoundException
java.io.FileNotFoundException
private void prepareConnection(java.net.URLConnection c) throws java.io.IOException
java.io.IOException
private void sendRequest(java.net.URLConnection c, boolean streaming) throws java.io.IOException
java.io.IOException
private URLLoader.Redirect receiveResponse(java.net.URLConnection c) throws java.io.IOException, java.lang.InterruptedException
java.io.IOException
java.lang.InterruptedException
private static void close(java.net.URLConnection c)
private void didSendData(long totalBytesSent, long totalBytesToBeSent)
private void notifyDidSendData(long totalBytesSent, long totalBytesToBeSent)
private void willSendRequest(java.lang.String newUrl, java.lang.String newMethod, java.net.URLConnection c) throws java.lang.InterruptedException
java.lang.InterruptedException
private boolean notifyWillSendRequest(java.lang.String newUrl, java.lang.String newMethod, int status, java.lang.String contentType, java.lang.String contentEncoding, long contentLength, java.lang.String headers, java.lang.String url)
private void didReceiveResponse(java.net.URLConnection c)
private void notifyDidReceiveResponse(int status, java.lang.String contentType, java.lang.String contentEncoding, long contentLength, java.lang.String headers, java.lang.String url)
private void didReceiveData(java.nio.ByteBuffer byteBuffer, ByteBufferAllocator allocator)
private void notifyDidReceiveData(java.nio.ByteBuffer byteBuffer, int position, int remaining)
private void didFinishLoading()
private void notifyDidFinishLoading()
private void didFail(int errorCode, java.lang.String message)
private void notifyDidFail(int errorCode, java.lang.String url, java.lang.String message)
private void callBack(java.lang.Runnable runnable)
private static void twkDidSendData(long totalBytesSent, long totalBytesToBeSent, long data)
private static boolean twkWillSendRequest(java.lang.String newUrl, java.lang.String newMethod, int status, java.lang.String contentType, java.lang.String contentEncoding, long contentLength, java.lang.String headers, java.lang.String url, long data)
private static void twkDidReceiveResponse(int status, java.lang.String contentType, java.lang.String contentEncoding, long contentLength, java.lang.String headers, java.lang.String url, long data)
private static void twkDidReceiveData(java.nio.ByteBuffer byteBuffer, int position, int remaining, long data)
private static void twkDidFinishLoading(long data)
private static void twkDidFail(int errorCode, java.lang.String url, java.lang.String message, long data)
private static int extractStatus(java.net.URLConnection c)
URLConnection
, returns the connection status
for passing into native callbacks.private static java.lang.String extractContentEncoding(java.net.URLConnection c)
URLConnection
, returns the content encoding
for passing into native callbacks.private static long extractContentLength(java.net.URLConnection c)
URLConnection
, returns the content length
for passing into native callbacks.private static java.lang.String extractHeaders(java.net.URLConnection c)
URLConnection
, returns the headers string
for passing into native callbacks.private static java.lang.String adjustUrlForWebKit(java.lang.String url)