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, setReadTimeout
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
IOException
protected boolean available()
public static void checkConnect(SecurityManager sm, String host, int port)
public void closeIdleConnection()
public void closeServer()
NetworkClient
closeServer
in class NetworkClient
public void finished()
protected int getDefaultPort()
@Nullable public InputStream getInputStream()
@Nullable public OutputStream getOutputStream()
public String getURLFile() throws IOException
IOException
public static HttpClient New(URL url) throws IOException
IOException
public static HttpClient New(URL url, int to, @Nullable HttpURLConnection httpuc) throws IOException
IOException
protected void openServer() throws IOException
IOException
public void openServer(String server, int port) throws IOException
NetworkClient
openServer
in class NetworkClient
IOException
public boolean parseHTTP(MessageHeader responses, HttpURLConnection httpuc) throws IOException
IOException
public void setDoNotRetry(boolean value)
public void setIgnoreContinue(boolean value)
public String toString()
Object
toString
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
IOException
public void writeRequests(MessageHeader head, PosterOutputStream pos, boolean streaming) throws IOException
IOException