/[storm]/storm/org/nongnu/storm/http/server/HTTPConnection.java
ViewVC logotype

Diff of /storm/org/nongnu/storm/http/server/HTTPConnection.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by benja, Mon Apr 21 21:07:41 2003 UTC revision 1.3 by hemppah, Mon May 5 13:57:09 2003 UTC
# Line 44  public class HTTPConnection { Line 44  public class HTTPConnection {
44      static public boolean dbg = false;      static public boolean dbg = false;
45      static private void p(String s) { if(dbg) System.out.println(s); }      static private void p(String s) { if(dbg) System.out.println(s); }
46      static private void pa(String s) { System.out.println(s); }      static private void pa(String s) { System.out.println(s); }
47        static private String remoteaddress;
48        
49      /** A factory of application-specific HTTP connection objects.      /** A factory of application-specific HTTP connection objects.
50       * @see HTTPConnection       * @see HTTPConnection
51       */       */
# Line 55  public class HTTPConnection { Line 55  public class HTTPConnection {
55           * @throws IOException XXX           * @throws IOException XXX
56          */          */
57          public HTTPConnection newConnection(Socket s) throws IOException {          public HTTPConnection newConnection(Socket s) throws IOException {
58              p("httpconn");              p("httpconn");                  
59              return new HTTPConnection(s);              return new HTTPConnection(s);
60          }          }
61      }      }
# Line 65  public class HTTPConnection { Line 65  public class HTTPConnection {
65       * @throws IOException Indicates a problem with the socket       * @throws IOException Indicates a problem with the socket
66       */       */
67      protected HTTPConnection(Socket s) throws IOException {      protected HTTPConnection(Socket s) throws IOException {
68          this(s.getInputStream(), s.getOutputStream());          this(s.getInputStream(), s.getOutputStream(),
69            s.getInetAddress().toString().substring(1));    
70      }      }
71    
72      /** Create a new connection object.      /** Create a new connection object.
73       * @param is The input stream for this connection       * @param is The input stream for this connection
74       * @param os The output stream for this connection       * @param os The output stream for this connection
75       */       */
76      protected HTTPConnection(InputStream is, OutputStream os) {      protected HTTPConnection(InputStream is, OutputStream os, String ipaddress) {
77          this.is = is;          this.is = is;
78          this.os = os;          this.os = os;
79            this.remoteaddress = ipaddress;
80          thread.start();          thread.start();
81      }      }
82            
83      /** Close this connection forcefully.  This ends the thread      /** Close this connection forcefully.  This ends the thread
84       * handling this connection and sends a notice to the client if       * handling this connection and sends a notice to the client if
85       * necessary.  */       * necessary.  */
# Line 92  public class HTTPConnection { Line 94  public class HTTPConnection {
94              }              }
95          }          }
96      }      }
97        
98         /** Return the IP-address of remote host */
99        
100        public String getRemoteIPAddress() {
101            
102            return this.remoteaddress;
103            
104        }    
105      
106    
107      /** An end-of-connection hook.  A subclass can override this      /** An end-of-connection hook.  A subclass can override this
108       * method and thus be informed when the connection is closed for       * method and thus be informed when the connection is closed for
# Line 355  public class HTTPConnection { Line 366  public class HTTPConnection {
366              // XXX not only when dbg is on?              // XXX not only when dbg is on?
367              if(dbg) e.printStackTrace();              if(dbg) e.printStackTrace();
368          }          }
369      }      }    
370        
371    
372    
373  }  }

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26