1 28 29 package com.caucho.server.port; 30 31 import com.caucho.server.connection.Connection; 32 33 import java.net.InetAddress ; 34 import java.nio.channels.SelectableChannel ; 35 36 44 public abstract class PortConnection extends Connection 45 { 46 private static int _connectionCount; 47 48 private Port _port; 49 50 private ServerRequest _request; 51 52 private int _connectionId; private long _accessTime; 55 58 protected PortConnection() 59 { 60 synchronized (PortConnection.class) { 61 _connectionId = _connectionCount++; 62 } 63 } 64 65 68 public int getId() 69 { 70 return _connectionId; 71 } 72 73 76 public Port getPort() 77 { 78 return _port; 79 } 80 81 84 public void setPort(Port port) 85 { 86 _port = port; 87 } 88 89 92 public final ServerRequest getRequest() 93 { 94 return _request; 95 } 96 97 100 public final void setRequest(ServerRequest request) 101 { 102 _request = request; 103 } 104 105 108 public boolean isSecure() 109 { 110 return false; 111 } 112 115 public String getVirtualHost() 116 { 117 return null; 118 } 119 120 123 public abstract InetAddress getLocalAddress(); 124 125 128 public abstract int getLocalPort(); 129 130 133 public abstract InetAddress getRemoteAddress(); 134 135 138 public abstract int getRemotePort(); 139 140 147 public void setAccessTime(long now) 148 { 149 _accessTime = now; 150 } 151 152 155 public long getAccessTime() 156 { 157 return _accessTime; 158 } 159 160 163 public SelectableChannel getSelectableChannel() 164 { 165 throw new UnsupportedOperationException (); 166 } 167 168 171 public void close() 172 { 173 } 174 } 175 | Popular Tags |