public class HttpClient extends NetworkClient
| Modifier and Type | Field and Description |
|---|---|
protected String |
host |
protected int |
port |
boolean |
reuse |
static String |
SOCKET_CONNECT_ACTION |
static String |
SOCKET_RESOLVE_ACTION |
protected URL |
url
Url being fetched.
|
connectTimeout, DEFAULT_CONNECT_TIMEOUT, DEFAULT_READ_TIMEOUT, defaultConnectTimeout, defaultSoTimeout, encoding, readTimeout, serverInput, serverOutput, serverSocket| Modifier | Constructor and Description |
|---|---|
protected |
HttpClient() |
protected |
HttpClient(URL url,
int to) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
available() |
static void |
checkConnect(SecurityManager sm,
String host,
int port) |
void |
closeIdleConnection() |
void |
closeServer()
Close an open connection to the server.
|
void |
finished() |
protected int |
getDefaultPort()
return default port number (subclasses may override)
|
InputStream |
getInputStream() |
OutputStream |
getOutputStream() |
String |
getURLFile() |
static HttpClient |
New(URL url) |
static HttpClient |
New(URL url,
int to,
HttpURLConnection httpuc) |
protected void |
openServer() |
void |
openServer(String server,
int port)
Open a connection to the server.
|
boolean |
parseHTTP(MessageHeader responses,
HttpURLConnection httpuc)
Parse the first line of the HTTP request.
|
void |
setDoNotRetry(boolean value) |
void |
setIgnoreContinue(boolean value) |
static String[] |
splitWhitespace(String str)
String.split("\\s+") <=> split()
|
String |
toString()
Returns a string representation of the object.
|
void |
writeRequests(MessageHeader head,
PosterOutputStream pos) |
void |
writeRequests(MessageHeader head,
PosterOutputStream pos,
boolean streaming) |
createSocket, doConnect, getConnectTimeout, getReadTimeout, serverIsOpen, setConnectTimeout, setReadTimeoutprotected String host
protected int port
public boolean reuse
public static final String SOCKET_CONNECT_ACTION
public static final String SOCKET_RESOLVE_ACTION
protected URL url
protected HttpClient()
protected HttpClient(URL url, int to) throws IOException
IOExceptionprotected boolean available()
public static void checkConnect(SecurityManager sm, String host, int port)
public void closeIdleConnection()
public void closeServer()
NetworkClientcloseServer in class NetworkClientpublic void finished()
protected int getDefaultPort()
public InputStream getInputStream()
public OutputStream getOutputStream()
public String getURLFile() throws IOException
IOExceptionpublic static HttpClient New(URL url) throws IOException
IOExceptionpublic static HttpClient New(URL url, int to, HttpURLConnection httpuc) throws IOException
IOExceptionprotected void openServer()
throws IOException
IOExceptionpublic void openServer(String server, int port) throws IOException
NetworkClientopenServer in class NetworkClientIOExceptionpublic boolean parseHTTP(MessageHeader responses, HttpURLConnection httpuc) throws IOException
IOExceptionpublic void setDoNotRetry(boolean value)
public void setIgnoreContinue(boolean value)
public String toString()
ObjecttoString method returns a
string that "textually represents" this object. The result should be a concise but informative
representation that is easy for a person to read. It is recommended that all subclasses override
this method.
The toString method for class Object returns a string consisting of the name of
the class of which the object is an instance, the at-sign character `@', and the unsigned
hexadecimal representation of the hash code of the object. In other words, this method returns a
string equal to the value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
public void writeRequests(MessageHeader head, PosterOutputStream pos) throws IOException
IOExceptionpublic void writeRequests(MessageHeader head, PosterOutputStream pos, boolean streaming) throws IOException
IOException