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:
Closeable,Serializable,AutoCloseable,Cloneable,Iterable<Socket>,Collection<Socket>,Deque<Socket>,List<Socket>,Queue<Socket>,SocketPoolMXBean
public class HttpClient extends SocketPool
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected intbufferSizeprotected String[]permanentHeaders-
Fields inherited from class one.nio.pool.SocketPool
connectTimeout, host, port, proxy, readTimeout, sslContext, tos
-
Fields inherited from class one.nio.pool.Pool
closed, createdCount, fifo, initialCount, keepEmpty, maxCount, timeout, timeouts, waitingThreads
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Constructor Description HttpClient(ConnectionString conn)HttpClient(ConnectionString conn, String... permanentHeaders)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Responseconnect(String uri, String... headers)RequestcreateRequest(int method, String uri, String... headers)Responsedelete(String uri, String... headers)Responseget(String uri, String... headers)Responsehead(String uri, String... headers)Responseinvoke(Request request)Responseinvoke(Request request, int timeout)Responseoptions(String uri, String... headers)Responsepatch(String uri, byte[] body, String... headers)Responsepatch(String uri, String... headers)Responsepost(String uri, byte[] body, String... headers)Responsepost(String uri, String... headers)Responseput(String uri, byte[] body, String... headers)Responseput(String uri, String... headers)protected voidsetProperties(ConnectionString conn)Responsetrace(String uri, 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.AbstractSequentialList
iterator
-
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.Collection
parallelStream, removeIf, stream, toArray
-
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
-
-
-
-
Field Detail
-
permanentHeaders
protected String[] permanentHeaders
-
bufferSize
protected int bufferSize
-
-
Constructor Detail
-
HttpClient
public HttpClient(ConnectionString conn)
-
HttpClient
public HttpClient(ConnectionString conn, String... permanentHeaders)
-
-
Method Detail
-
setProperties
protected void setProperties(ConnectionString conn)
- Overrides:
setPropertiesin classSocketPool
-
invoke
public Response invoke(Request request) throws InterruptedException, PoolException, IOException, HttpException
-
invoke
public Response invoke(Request request, int timeout) throws InterruptedException, PoolException, IOException, HttpException
-
get
public Response get(String uri, String... headers) throws InterruptedException, PoolException, IOException, HttpException
-
delete
public Response delete(String uri, String... headers) throws InterruptedException, PoolException, IOException, HttpException
-
post
public Response post(String uri, String... headers) throws InterruptedException, PoolException, IOException, HttpException
-
post
public Response post(String uri, byte[] body, String... headers) throws InterruptedException, PoolException, IOException, HttpException
-
put
public Response put(String uri, String... headers) throws InterruptedException, PoolException, IOException, HttpException
-
put
public Response put(String uri, byte[] body, String... headers) throws InterruptedException, PoolException, IOException, HttpException
-
patch
public Response patch(String uri, String... headers) throws InterruptedException, PoolException, IOException, HttpException
-
patch
public Response patch(String uri, byte[] body, String... headers) throws InterruptedException, PoolException, IOException, HttpException
-
head
public Response head(String uri, String... headers) throws InterruptedException, PoolException, IOException, HttpException
-
options
public Response options(String uri, String... headers) throws InterruptedException, PoolException, IOException, HttpException
-
trace
public Response trace(String uri, String... headers) throws InterruptedException, PoolException, IOException, HttpException
-
connect
public Response connect(String uri, String... headers) throws InterruptedException, PoolException, IOException, HttpException
-
-