home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / VPage / Java.bin / CLASSES.ZIP / sun / rmi / transport / proxy / HttpReceiveSocket.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-07-08  |  1.8 KB  |  52 lines

  1. package sun.rmi.transport.proxy;
  2.  
  3. import java.io.DataOutputStream;
  4. import java.io.IOException;
  5. import java.io.InputStream;
  6. import java.io.OutputStream;
  7. import java.net.InetAddress;
  8. import java.net.Socket;
  9.  
  10. class HttpReceiveSocket extends WrappedSocket implements RMISocketInfo {
  11.    private boolean headerSent = false;
  12.  
  13.    public HttpReceiveSocket(Socket var1, InputStream var2, OutputStream var3) throws IOException {
  14.       super(var1, var2, var3);
  15.       super.in = new HttpInputStream(var2 != null ? var2 : var1.getInputStream());
  16.       super.out = var3 != null ? var3 : var1.getOutputStream();
  17.    }
  18.  
  19.    public boolean isReusable() {
  20.       return false;
  21.    }
  22.  
  23.    public InetAddress getInetAddress() {
  24.       return null;
  25.    }
  26.  
  27.    public int getPort() {
  28.       return super.socket.getPort();
  29.    }
  30.  
  31.    public OutputStream getOutputStream() throws IOException {
  32.       if (!this.headerSent) {
  33.          DataOutputStream var1 = new DataOutputStream(super.out);
  34.          var1.writeBytes("HTTP/1.0 200 OK\r\n");
  35.          var1.flush();
  36.          this.headerSent = true;
  37.          super.out = new HttpOutputStream(super.out);
  38.       }
  39.  
  40.       return super.out;
  41.    }
  42.  
  43.    public synchronized void close() throws IOException {
  44.       this.getOutputStream().close();
  45.       super.socket.close();
  46.    }
  47.  
  48.    public String toString() {
  49.       return "HttpReceive" + super.socket.toString();
  50.    }
  51. }
  52.