1 29 30 package com.caucho.server.connection; 31 32 import com.caucho.vfs.VfsStream; 33 34 import java.io.InputStream ; 35 import java.io.OutputStream ; 36 import java.net.InetAddress ; 37 38 42 public class StreamConnection extends Connection { 43 private int _id = 1; 44 private InetAddress _localAddress; 45 private int _localPort; 46 private String _virtualHost; 47 private InetAddress _remoteAddress; 48 private int _remotePort; 49 private boolean _isSecure; 50 51 public StreamConnection() 52 { 53 } 54 55 public StreamConnection(InputStream is, OutputStream os) 56 { 57 setStream(is, os); 58 } 59 60 public int getId() 61 { 62 return _id; 63 } 64 65 public InetAddress getLocalAddress() 66 { 67 return _localAddress; 68 } 69 70 public int getLocalPort() 71 { 72 return _localPort; 73 } 74 75 public InetAddress getRemoteAddress() 76 { 77 return _remoteAddress; 78 } 79 80 public int getRemotePort() 81 { 82 return _remotePort; 83 } 84 85 public void setRemotePort(int port) 86 { 87 _remotePort = port; 88 } 89 90 public String getVirtualHost() 91 { 92 return _virtualHost; 93 } 94 95 public void setVirtualHost(String virtualHost) 96 { 97 _virtualHost = virtualHost; 98 } 99 100 public void setStream(InputStream is, OutputStream os) 101 { 102 VfsStream _vfsStream = new VfsStream(is, os); 103 getWriteStream().init(_vfsStream); 104 getReadStream().init(_vfsStream, getWriteStream()); 105 } 106 107 public void setSecure(boolean isSecure) 108 { 109 _isSecure = isSecure; 110 } 111 112 public boolean isSecure() 113 { 114 return _isSecure; 115 } 116 117 public void setLocalAddress(InetAddress addr) 118 { 119 _localAddress = addr; 120 } 121 122 public void setLocalPort(int port) 123 { 124 _localPort = port; 125 } 126 127 public void setRemoteAddress(InetAddress addr) 128 { 129 _remoteAddress = addr; 130 } 131 } 132 | Popular Tags |