Package jodd.http.net
Class SocketHttpConnection
- java.lang.Object
-
- jodd.http.net.SocketHttpConnection
-
- All Implemented Interfaces:
HttpConnection
- Direct Known Subclasses:
SocketHttpSecureConnection
public class SocketHttpConnection extends java.lang.Object implements HttpConnection
Socket-basedHttpConnection.- See Also:
SocketHttpConnectionProvider
-
-
Constructor Summary
Constructors Constructor Description SocketHttpConnection(java.net.Socket socket)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes connection.java.io.InputStreamgetInputStream()Returns connection input stream.java.io.OutputStreamgetOutputStream()Returns connection output stream.java.net.SocketgetSocket()ReturnsSocketused by this connection.voidinit()Initializes http connection after socket is created.voidsetTimeout(int milliseconds)Sets the timeout for connections, in milliseconds.
-
-
-
Method Detail
-
init
public void init() throws java.io.IOExceptionDescription copied from interface:HttpConnectionInitializes http connection after socket is created. Applies configurations, likeHttpConnection.setTimeout(int).- Specified by:
initin interfaceHttpConnection- Throws:
java.io.IOException
-
getOutputStream
public java.io.OutputStream getOutputStream() throws java.io.IOExceptionDescription copied from interface:HttpConnectionReturns connection output stream.- Specified by:
getOutputStreamin interfaceHttpConnection- Throws:
java.io.IOException
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOExceptionDescription copied from interface:HttpConnectionReturns connection input stream.- Specified by:
getInputStreamin interfaceHttpConnection- Throws:
java.io.IOException
-
close
public void close()
Description copied from interface:HttpConnectionCloses connection. Ignores all exceptions.- Specified by:
closein interfaceHttpConnection
-
setTimeout
public void setTimeout(int milliseconds)
Description copied from interface:HttpConnectionSets the timeout for connections, in milliseconds. With this option set to a non-zero timeout, connection will block for only this amount of time. If the timeout expires, an Exception is raised. The timeout must be > 0. A timeout of zero is interpreted as an infinite timeout.- Specified by:
setTimeoutin interfaceHttpConnection
-
getSocket
public java.net.Socket getSocket()
ReturnsSocketused by this connection.
-
-