EepHead
, I2PSocketEepGet
, PartialEepGet
, SSLEepGet
public class EepGet
extends java.lang.Object
修飾子とタイプ | クラス | 説明 |
---|---|---|
protected static class |
EepGet.AUTH_MODE |
|
protected class |
EepGet.AuthState |
Manage the authentication parameters
Ref: RFC 2617
Supports both Basic and Digest, however i2ptunnel HTTP proxy
has migrated all previous Basic support to Digest.
|
protected class |
EepGet.CLIStatusListener |
|
protected class |
EepGet.Gunzipper |
Decompressor thread.
|
static interface |
EepGet.StatusListener |
修飾子とタイプ | フィールド | 説明 |
---|---|---|
protected boolean |
_aborted |
|
protected java.lang.String |
_actualURL |
the URL we actually fetch from (may differ from the _url in case of redirect)
|
protected long |
_alreadyTransferred |
|
protected EepGet.AuthState |
_authState |
|
protected long |
_bytesRemaining |
|
protected long |
_bytesTransferred |
|
protected java.lang.String |
_contentType |
|
protected I2PAppContext |
_context |
|
protected int |
_currentAttempt |
|
protected java.io.IOException |
_decompressException |
|
protected boolean |
_encodingChunked |
|
protected java.lang.String |
_etag |
|
protected java.lang.String |
_etagOrig |
|
protected java.util.List<java.lang.String> |
_extraHeaders |
|
protected int |
_fetchHeaderTimeout |
|
protected int |
_fetchInactivityTimeout |
|
protected boolean |
_isGzippedResponse |
|
protected boolean |
_keepFetching |
|
protected java.lang.String |
_lastModified |
|
protected java.lang.String |
_lastModifiedOrig |
|
protected java.util.List<EepGet.StatusListener> |
_listeners |
|
protected Log |
_log |
|
protected boolean |
_notModified |
|
protected int |
_numRetries |
|
protected java.io.OutputStream |
_out |
|
protected java.lang.String |
_outputFile |
|
protected java.io.OutputStream |
_outputStream |
|
protected java.net.Socket |
_proxy |
|
protected java.lang.String |
_proxyHost |
|
protected java.io.InputStream |
_proxyIn |
|
protected java.io.OutputStream |
_proxyOut |
|
protected int |
_proxyPort |
|
protected java.lang.String |
_redirectLocation |
|
protected int |
_redirects |
|
protected int |
_responseCode |
|
protected java.lang.String |
_responseText |
|
protected boolean |
_shouldProxy |
|
protected boolean |
_shouldWriteErrorToOutput |
|
protected boolean |
_transferFailed |
|
protected java.lang.String |
_url |
url we were asked to fetch
|
protected static int |
CONNECT_TIMEOUT |
|
protected static int |
INACTIVITY_TIMEOUT |
|
protected static int |
MAX_COMPLETE_FAILS |
maximum times to try without getting any data at all, even if numRetries is higher @since 0.7.14
|
protected static java.lang.String |
USER_AGENT |
this will be replaced by the HTTP Proxy if we are using it
|
コンストラクタ | 説明 |
---|---|
EepGet(I2PAppContext ctx,
boolean shouldProxy,
java.lang.String proxyHost,
int proxyPort,
int numRetries,
long minSize,
long maxSize,
java.lang.String outputFile,
java.io.OutputStream outputStream,
java.lang.String url,
boolean allowCaching,
java.lang.String etag,
java.lang.String postData) |
|
EepGet(I2PAppContext ctx,
boolean shouldProxy,
java.lang.String proxyHost,
int proxyPort,
int numRetries,
long minSize,
long maxSize,
java.lang.String outputFile,
java.io.OutputStream outputStream,
java.lang.String url,
boolean allowCaching,
java.lang.String etag,
java.lang.String lastModified,
java.lang.String postData) |
|
EepGet(I2PAppContext ctx,
boolean shouldProxy,
java.lang.String proxyHost,
int proxyPort,
int numRetries,
java.lang.String outputFile,
java.lang.String url) |
|
EepGet(I2PAppContext ctx,
boolean shouldProxy,
java.lang.String proxyHost,
int proxyPort,
int numRetries,
java.lang.String outputFile,
java.lang.String url,
boolean allowCaching,
java.lang.String etag) |
|
EepGet(I2PAppContext ctx,
boolean shouldProxy,
java.lang.String proxyHost,
int proxyPort,
int numRetries,
java.lang.String outputFile,
java.lang.String url,
boolean allowCaching,
java.lang.String etag,
java.lang.String lastModified) |
|
EepGet(I2PAppContext ctx,
boolean shouldProxy,
java.lang.String proxyHost,
int proxyPort,
int numRetries,
java.lang.String outputFile,
java.lang.String url,
java.lang.String postData) |
|
EepGet(I2PAppContext ctx,
int numRetries,
java.lang.String outputFile,
java.lang.String url) |
|
EepGet(I2PAppContext ctx,
int numRetries,
java.lang.String outputFile,
java.lang.String url,
boolean allowCaching) |
|
EepGet(I2PAppContext ctx,
java.lang.String proxyHost,
int proxyPort,
int numRetries,
java.lang.String outputFile,
java.lang.String url) |
|
EepGet(I2PAppContext ctx,
java.lang.String proxyHost,
int proxyPort,
int numRetries,
java.lang.String outputFile,
java.lang.String url,
boolean allowCaching) |
修飾子とタイプ | メソッド | 説明 |
---|---|---|
void |
addAuthorization(java.lang.String userName,
java.lang.String password) |
Add basic authorization header for the proxy.
|
void |
addHeader(java.lang.String name,
java.lang.String value) |
Add an extra header to the request.
|
void |
addStatusListener(EepGet.StatusListener lsnr) |
|
protected void |
doFetch(SocketTimeout timeout) |
single fetch
|
boolean |
fetch() |
Blocking fetch, returning true if the URL was retrieved, false if all retries failed.
|
boolean |
fetch(long fetchHeaderTimeout) |
Blocking fetch, timing out individual attempts if the HTTP response headers
don't come back in the time given.
|
boolean |
fetch(long fetchHeaderTimeout,
long totalTimeout,
long inactivityTimeout) |
Blocking fetch.
|
java.lang.String |
getContentType() |
After fetch, the received value from the server, or null if none.
|
java.lang.String |
getETag() |
After fetch, the received value from the server, or null if none.
|
java.lang.String |
getLastModified() |
After fetch, the received value from the server, or null if none.
|
boolean |
getNotModified() |
|
protected java.lang.String |
getRequest() |
|
int |
getStatusCode() |
The server response (200, etc).
|
java.lang.String |
getStatusText() |
The server text ("OK", "Not Found", etc).
|
static void |
main(java.lang.String[] args) |
EepGet [-p 127.0.0.1:4444] [-n #retries] [-e etag] [-o outputFile] [-m markSize lineLen] url
|
static java.util.Map<java.lang.String,java.lang.String> |
parseAuthArgs(java.lang.String args) |
Parse the args in an authentication header.
|
protected long |
readChunkLength() |
|
protected void |
readHeaders() |
|
protected void |
sendRequest(SocketTimeout timeout) |
|
void |
setWriteErrorToOutput() |
If called (before calling fetch()),
data from the server or proxy will be written to the
output file or stream even on an error response code (4xx, 5xx, etc).
|
void |
stopFetching() |
|
static java.lang.String |
suggestName(java.lang.String url) |
Parse URL for a viable filename.
|
protected final I2PAppContext _context
protected final Log _log
protected final boolean _shouldProxy
protected final java.lang.String _proxyHost
protected final int _proxyPort
protected final int _numRetries
protected final java.lang.String _outputFile
protected final java.io.OutputStream _outputStream
protected final java.lang.String _url
protected java.lang.String _actualURL
protected final java.util.List<EepGet.StatusListener> _listeners
protected java.util.List<java.lang.String> _extraHeaders
protected boolean _keepFetching
protected java.net.Socket _proxy
protected java.io.OutputStream _proxyOut
protected java.io.InputStream _proxyIn
protected java.io.OutputStream _out
protected long _alreadyTransferred
protected long _bytesTransferred
protected long _bytesRemaining
protected int _currentAttempt
protected int _responseCode
protected java.lang.String _responseText
protected boolean _shouldWriteErrorToOutput
protected java.lang.String _etag
protected java.lang.String _lastModified
protected final java.lang.String _etagOrig
protected final java.lang.String _lastModifiedOrig
protected boolean _encodingChunked
protected boolean _notModified
protected java.lang.String _contentType
protected boolean _transferFailed
protected boolean _aborted
protected int _fetchHeaderTimeout
protected int _fetchInactivityTimeout
protected int _redirects
protected java.lang.String _redirectLocation
protected boolean _isGzippedResponse
protected java.io.IOException _decompressException
protected EepGet.AuthState _authState
protected static final java.lang.String USER_AGENT
protected static final int CONNECT_TIMEOUT
protected static final int INACTIVITY_TIMEOUT
protected static final int MAX_COMPLETE_FAILS
public EepGet(I2PAppContext ctx, java.lang.String proxyHost, int proxyPort, int numRetries, java.lang.String outputFile, java.lang.String url)
public EepGet(I2PAppContext ctx, java.lang.String proxyHost, int proxyPort, int numRetries, java.lang.String outputFile, java.lang.String url, boolean allowCaching)
public EepGet(I2PAppContext ctx, int numRetries, java.lang.String outputFile, java.lang.String url)
public EepGet(I2PAppContext ctx, int numRetries, java.lang.String outputFile, java.lang.String url, boolean allowCaching)
public EepGet(I2PAppContext ctx, boolean shouldProxy, java.lang.String proxyHost, int proxyPort, int numRetries, java.lang.String outputFile, java.lang.String url)
public EepGet(I2PAppContext ctx, boolean shouldProxy, java.lang.String proxyHost, int proxyPort, int numRetries, java.lang.String outputFile, java.lang.String url, java.lang.String postData)
public EepGet(I2PAppContext ctx, boolean shouldProxy, java.lang.String proxyHost, int proxyPort, int numRetries, java.lang.String outputFile, java.lang.String url, boolean allowCaching, java.lang.String etag)
public EepGet(I2PAppContext ctx, boolean shouldProxy, java.lang.String proxyHost, int proxyPort, int numRetries, java.lang.String outputFile, java.lang.String url, boolean allowCaching, java.lang.String etag, java.lang.String lastModified)
public EepGet(I2PAppContext ctx, boolean shouldProxy, java.lang.String proxyHost, int proxyPort, int numRetries, long minSize, long maxSize, java.lang.String outputFile, java.io.OutputStream outputStream, java.lang.String url, boolean allowCaching, java.lang.String etag, java.lang.String postData)
public EepGet(I2PAppContext ctx, boolean shouldProxy, java.lang.String proxyHost, int proxyPort, int numRetries, long minSize, long maxSize, java.lang.String outputFile, java.io.OutputStream outputStream, java.lang.String url, boolean allowCaching, java.lang.String etag, java.lang.String lastModified, java.lang.String postData)
public static void main(java.lang.String[] args)
public static java.lang.String suggestName(java.lang.String url)
url
- a URL giving the location of an online resourcepublic void addStatusListener(EepGet.StatusListener lsnr)
public void stopFetching()
public boolean fetch()
public boolean fetch(long fetchHeaderTimeout)
public boolean fetch(long fetchHeaderTimeout, long totalTimeout, long inactivityTimeout)
fetchHeaderTimeout
- <= 0 for none (proxy will timeout if none, none isn't recommended if no proxy)totalTimeout
- <= 0 for default noneinactivityTimeout
- <= 0 for default 60 secprotected void doFetch(SocketTimeout timeout) throws java.io.IOException
timeout
- may be nulljava.io.IOException
protected void readHeaders() throws java.io.IOException
java.io.IOException
protected long readChunkLength() throws java.io.IOException
java.io.IOException
protected void sendRequest(SocketTimeout timeout) throws java.io.IOException
timeout
- may be nulljava.io.IOException
protected java.lang.String getRequest() throws java.io.IOException
java.io.IOException
public java.lang.String getETag()
public java.lang.String getLastModified()
public boolean getNotModified()
public java.lang.String getContentType()
public int getStatusCode()
public java.lang.String getStatusText()
public void setWriteErrorToOutput()
public void addHeader(java.lang.String name, java.lang.String value)
public void addAuthorization(java.lang.String userName, java.lang.String password)
public static java.util.Map<java.lang.String,java.lang.String> parseAuthArgs(java.lang.String args)
args
- non-null, starting after "Digest " or "Basic "