Package one.nio.http
Class HttpClient
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.AbstractSequentialList<E>
-
- java.util.LinkedList<T>
-
- one.nio.pool.Pool<Socket>
-
- one.nio.pool.SocketPool
-
- one.nio.http.HttpClient
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Serializable,java.lang.AutoCloseable,java.lang.Cloneable,java.lang.Iterable<Socket>,java.util.Collection<Socket>,java.util.Deque<Socket>,java.util.List<Socket>,java.util.Queue<Socket>,SocketPoolMXBean
public class HttpClient extends SocketPool
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classHttpClient.ChunkedLineReader(package private) static classHttpClient.EventImpl(package private) static classHttpClient.ResponseReader(package private) classHttpClient.ServerSentEventsReader
-
Field Summary
Fields Modifier and Type Field Description protected intbufferSizeprivate static org.slf4j.Loggerlogprotected java.lang.String[]permanentHeaders-
Fields inherited from class one.nio.pool.SocketPool
connectTimeout, host, port, proxy, readTimeout, sslContext, thinLto, tos
-
Fields inherited from class one.nio.pool.Pool
closed, createdCount, fifo, initialCount, keepEmpty, maxCount, timeout, timeouts, waitingThreads
-
-
Constructor Summary
Constructors Constructor Description HttpClient(ConnectionString conn)HttpClient(ConnectionString conn, java.lang.String... permanentHeaders)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Responseconnect(java.lang.String uri, java.lang.String... headers)RequestcreateRequest(int method, java.lang.String uri, java.lang.String... headers)Responsedelete(java.lang.String uri, java.lang.String... headers)Responseget(java.lang.String uri, java.lang.String... headers)Responsehead(java.lang.String uri, java.lang.String... headers)Responseinvoke(Request request)Responseinvoke(Request request, int timeout)EventSourceResponseopenEvents(java.lang.String uri, java.lang.String... headers)EventSourceResponseopenEvents(Request request, int timeout)Responseoptions(java.lang.String uri, java.lang.String... headers)Responsepatch(java.lang.String uri, byte[] body, java.lang.String... headers)Responsepatch(java.lang.String uri, java.lang.String... headers)Responsepost(java.lang.String uri, byte[] body, java.lang.String... headers)Responsepost(java.lang.String uri, java.lang.String... headers)Responseput(java.lang.String uri, byte[] body, java.lang.String... headers)Responseput(java.lang.String uri, java.lang.String... headers)EventSourceResponsereopenEvents(Request request, java.lang.String lastId, int timeout)protected voidsetProperties(ConnectionString conn)Responsetrace(java.lang.String uri, java.lang.String... headers)-
Methods inherited from class one.nio.pool.SocketPool
createObject, destroyObject, getBusyCount, getConnectTimeout, getFifo, getIdleCount, getMaxCount, getProxy, getReadTimeout, getSslContext, getTimeout, getTimeouts, getWaitingThreads, name, setConnectTimeout, setFifo, setMaxCount, setProxy, setReadTimeout, setSslContext, setTimeout
-
Methods inherited from class one.nio.pool.Pool
borrowObject, close, initialize, invalidateAll, invalidateObject, isClosed, returnObject
-
Methods inherited from class java.util.LinkedList
add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, descendingIterator, element, get, getFirst, getLast, indexOf, lastIndexOf, listIterator, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, remove, remove, remove, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence, set, size, spliterator, toArray, toArray
-
Methods inherited from class java.util.AbstractList
equals, hashCode, listIterator, removeRange, subList
-
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, removeAll, retainAll, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.List
containsAll, equals, hashCode, isEmpty, iterator, listIterator, removeAll, replaceAll, retainAll, sort, subList
-
Methods inherited from interface one.nio.pool.SocketPoolMXBean
invalidateAll, isClosed
-
-
-
-
Constructor Detail
-
HttpClient
public HttpClient(ConnectionString conn)
-
HttpClient
public HttpClient(ConnectionString conn, java.lang.String... permanentHeaders)
-
-
Method Detail
-
setProperties
protected void setProperties(ConnectionString conn)
- Overrides:
setPropertiesin classSocketPool
-
invoke
public Response invoke(Request request) throws java.lang.InterruptedException, PoolException, java.io.IOException, HttpException
- Throws:
java.lang.InterruptedExceptionPoolExceptionjava.io.IOExceptionHttpException
-
invoke
public Response invoke(Request request, int timeout) throws java.lang.InterruptedException, PoolException, java.io.IOException, HttpException
- Throws:
java.lang.InterruptedExceptionPoolExceptionjava.io.IOExceptionHttpException
-
get
public Response get(java.lang.String uri, java.lang.String... headers) throws java.lang.InterruptedException, PoolException, java.io.IOException, HttpException
- Throws:
java.lang.InterruptedExceptionPoolExceptionjava.io.IOExceptionHttpException
-
openEvents
public EventSourceResponse openEvents(java.lang.String uri, java.lang.String... headers) throws java.lang.InterruptedException, PoolException, java.io.IOException, HttpException
- Throws:
java.lang.InterruptedExceptionPoolExceptionjava.io.IOExceptionHttpException
-
delete
public Response delete(java.lang.String uri, java.lang.String... headers) throws java.lang.InterruptedException, PoolException, java.io.IOException, HttpException
- Throws:
java.lang.InterruptedExceptionPoolExceptionjava.io.IOExceptionHttpException
-
post
public Response post(java.lang.String uri, java.lang.String... headers) throws java.lang.InterruptedException, PoolException, java.io.IOException, HttpException
- Throws:
java.lang.InterruptedExceptionPoolExceptionjava.io.IOExceptionHttpException
-
post
public Response post(java.lang.String uri, byte[] body, java.lang.String... headers) throws java.lang.InterruptedException, PoolException, java.io.IOException, HttpException
- Throws:
java.lang.InterruptedExceptionPoolExceptionjava.io.IOExceptionHttpException
-
put
public Response put(java.lang.String uri, java.lang.String... headers) throws java.lang.InterruptedException, PoolException, java.io.IOException, HttpException
- Throws:
java.lang.InterruptedExceptionPoolExceptionjava.io.IOExceptionHttpException
-
put
public Response put(java.lang.String uri, byte[] body, java.lang.String... headers) throws java.lang.InterruptedException, PoolException, java.io.IOException, HttpException
- Throws:
java.lang.InterruptedExceptionPoolExceptionjava.io.IOExceptionHttpException
-
patch
public Response patch(java.lang.String uri, java.lang.String... headers) throws java.lang.InterruptedException, PoolException, java.io.IOException, HttpException
- Throws:
java.lang.InterruptedExceptionPoolExceptionjava.io.IOExceptionHttpException
-
patch
public Response patch(java.lang.String uri, byte[] body, java.lang.String... headers) throws java.lang.InterruptedException, PoolException, java.io.IOException, HttpException
- Throws:
java.lang.InterruptedExceptionPoolExceptionjava.io.IOExceptionHttpException
-
head
public Response head(java.lang.String uri, java.lang.String... headers) throws java.lang.InterruptedException, PoolException, java.io.IOException, HttpException
- Throws:
java.lang.InterruptedExceptionPoolExceptionjava.io.IOExceptionHttpException
-
options
public Response options(java.lang.String uri, java.lang.String... headers) throws java.lang.InterruptedException, PoolException, java.io.IOException, HttpException
- Throws:
java.lang.InterruptedExceptionPoolExceptionjava.io.IOExceptionHttpException
-
trace
public Response trace(java.lang.String uri, java.lang.String... headers) throws java.lang.InterruptedException, PoolException, java.io.IOException, HttpException
- Throws:
java.lang.InterruptedExceptionPoolExceptionjava.io.IOExceptionHttpException
-
connect
public Response connect(java.lang.String uri, java.lang.String... headers) throws java.lang.InterruptedException, PoolException, java.io.IOException, HttpException
- Throws:
java.lang.InterruptedExceptionPoolExceptionjava.io.IOExceptionHttpException
-
openEvents
public EventSourceResponse openEvents(Request request, int timeout) throws java.lang.InterruptedException, PoolException, java.io.IOException, HttpException
- Throws:
java.lang.InterruptedExceptionPoolExceptionjava.io.IOExceptionHttpException
-
reopenEvents
public EventSourceResponse reopenEvents(Request request, java.lang.String lastId, int timeout) throws java.lang.InterruptedException, PoolException, java.io.IOException, HttpException
- Throws:
java.lang.InterruptedExceptionPoolExceptionjava.io.IOExceptionHttpException
-
createRequest
public Request createRequest(int method, java.lang.String uri, java.lang.String... headers)
-
-