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 simply go though the list of available network
interfaces and will return the final address of the final interface
available in the list. This workes fine for the simple cases where
1.) there's only the loopback interface, where the ip is 127.0.0.1
2.) there's an additional interface availbale which is used to
access an external network and has only one ip assigned to it.
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