org.apache.axis2.transport.http.server
Class SimpleHttpServerConnection
java.lang.Object
org.apache.axis2.transport.http.server.SimpleHttpServerConnection
- public class SimpleHttpServerConnection
- extends Object
A connection to the SimpleHttpServer.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_TIMEOUT
public static final int DEFAULT_TIMEOUT
- See Also:
- Constant Field Values
SimpleHttpServerConnection
public SimpleHttpServerConnection(Socket socket)
throws IOException
close
public void close()
readRequest
public SimpleRequest readRequest()
throws IOException
- Throws:
IOException
readResponse
public SimpleResponse readResponse()
throws IOException
- Throws:
IOException
writeRequest
public void writeRequest(SimpleRequest request)
throws IOException
- Throws:
IOException
writeResponse
public void writeResponse(SimpleResponse response)
throws IOException
- Throws:
IOException
getInputStream
public InputStream getInputStream()
getOutputStream
public OutputStream getOutputStream()
getSocketTimeout
public int getSocketTimeout()
throws SocketException
- Throws:
SocketException
getWriter
public ResponseWriter getWriter()
throws UnsupportedEncodingException
- Returns the ResponseWriter used to write the output to the socket.
- Returns:
- Returns this connection's ResponseWriter.
- Throws:
UnsupportedEncodingException
isKeepAlive
public boolean isKeepAlive()
isOpen
public boolean isOpen()
setKeepAlive
public void setKeepAlive(boolean b)
setSocketTimeout
public void setSocketTimeout(int timeout)
throws SocketException
- Throws:
SocketException
getURL
public String getURL(String suffix)
throws Exception
- Throws:
Exception
getIpAddress
public static String getIpAddress()
throws SocketException
- Returns the ip address to be used for the replyto epr
CAUTION:
This will go through all the available network interfaces and will try to return an ip address.
First this will try to get the first IP which is not loopback address (127.0.0.1). If none is found
then this will return this will return 127.0.0.1.
This will not consider IPv6 addresses.
TODO:
- Improve this logic to genaralize it a bit more
- Obtain the ip to be used here from the Call API
- Returns:
- Returns String.
- Throws:
SocketException