Femto Web Server V1.4-F

dfischer.femtowebserver.adapter
Class HttpdSocketConnection

java.lang.Object
  |
  +--dfischer.femtowebserver.httpd.HttpdConnection
        |
        +--dfischer.femtowebserver.adapter.HttpdSocketConnection

public class HttpdSocketConnection
extends HttpdConnection

Represents new TCP/IP client connections from the HttpdSocketConnectionAdapter.

 Sourcecode:

 import java.net.*;
 import java.net.*;
 import dfischer.femtowebserver.httpd.*; 

 public class HttpdSocketConnection extends HttpdConnection
 {
     private Socket clientSocket;
     private String protocol;

     public HttpdSocketConnection(Socket clientSocket)
     {
         this.clientSocket = clientSocket;
         this.protocol = protocol;
     }
 
     public InputStream getInputStream() throws IOException
     {
         return clientSocket.getInputStream();
     }
 
     public OutputStream getOutputStream() throws IOException
     {
         return clientSocket.getOutputStream();
     }
 
     public String getClientAddress() throws IOException
     {
         return clientSocket.getInetAddress().getHostAddress();
     }
 
     public void closeConnection() throws IOException
     {
         clientSocket.close();
     }
 }
 

See Also:
HttpdConnection, HttpdSocketConnectionAdapter

Constructor Summary
HttpdSocketConnection(java.net.Socket clientSocket, java.lang.String protocol)
           
 
Method Summary
 void closeConnection()
          Closes/terminates the client connection.
 java.lang.String getClientAddress()
          Returns the identification of the remote host from which the request has been started.
 java.io.InputStream getInputStream()
          Returns the input stream of the new client connection.
 java.io.OutputStream getOutputStream()
          Returns the output stream of the new client connection.
 java.lang.String getProtocol()
          Returns the network protocol-name of the new client connection ("http", "https", ...)
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpdSocketConnection

public HttpdSocketConnection(java.net.Socket clientSocket,
                             java.lang.String protocol)
Method Detail

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Description copied from class: HttpdConnection
Returns the input stream of the new client connection.
Overrides:
getInputStream in class HttpdConnection

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
Description copied from class: HttpdConnection
Returns the output stream of the new client connection.
Overrides:
getOutputStream in class HttpdConnection

getProtocol

public java.lang.String getProtocol()
                             throws java.io.IOException
Description copied from class: HttpdConnection
Returns the network protocol-name of the new client connection ("http", "https", ...)
Overrides:
getProtocol in class HttpdConnection

getClientAddress

public java.lang.String getClientAddress()
                                  throws java.io.IOException
Description copied from class: HttpdConnection
Returns the identification of the remote host from which the request has been started. If TCP/IP is used as network protocol the remote IP Address is returned.
Overrides:
getClientAddress in class HttpdConnection

closeConnection

public void closeConnection()
                     throws java.io.IOException
Description copied from class: HttpdConnection
Closes/terminates the client connection.
Overrides:
closeConnection in class HttpdConnection

Femto Web Server V1.4-F

Copyright 2002, 2003, 2006 by Ingenieurbüro David Fischer GmbH, Switzerland. All rights reserved.