Mercurial > 510Connectbot
comparison src/org/tn5250j/framework/tn5250/tnvt.java @ 10:e773d0952613 tn5250
adding tn5250 files
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Thu, 22 May 2014 16:11:14 -0700 |
parents | 3b760b39962a |
children | f3b3bbd227b8 |
comparison
equal
deleted
inserted
replaced
9:731e70088af0 | 10:e773d0952613 |
---|---|
81 import javax.net.ssl.SSLSocket; | 81 import javax.net.ssl.SSLSocket; |
82 | 82 |
83 import com.five_ten_sg.connectbot.service.TerminalBridge; | 83 import com.five_ten_sg.connectbot.service.TerminalBridge; |
84 import com.five_ten_sg.connectbot.service.TerminalManager; | 84 import com.five_ten_sg.connectbot.service.TerminalManager; |
85 | 85 |
86 import org.tn5250j.Session5250; | |
87 import org.tn5250j.TN5250jConstants; | 86 import org.tn5250j.TN5250jConstants; |
88 import org.tn5250j.encoding.CharMappings; | 87 import org.tn5250j.encoding.CharMappings; |
89 import org.tn5250j.encoding.ICodePage; | 88 import org.tn5250j.encoding.ICodePage; |
90 import org.tn5250j.framework.transport.SocketConnector; | 89 import org.tn5250j.framework.transport.SocketConnector; |
91 import org.tn5250j.tools.logging.TN5250jLogFactory; | 90 import org.tn5250j.tools.logging.TN5250jLogFactory; |
131 private Thread me; | 130 private Thread me; |
132 private Thread pthread; | 131 private Thread pthread; |
133 private int readType; | 132 private int readType; |
134 private boolean enhanced = true; | 133 private boolean enhanced = true; |
135 private boolean cursorOn = false; | 134 private boolean cursorOn = false; |
136 private String session = ""; | 135 private String hostname = ""; |
137 private int port = 23; | 136 private int port = 23; |
138 private boolean connected = false; | 137 private boolean connected = false; |
139 private boolean support132 = true; | 138 private boolean support132 = true; |
140 private ByteArrayOutputStream baosp = null; | 139 private ByteArrayOutputStream baosp = null; |
141 private ByteArrayOutputStream baosrsp = null; | 140 private ByteArrayOutputStream baosrsp = null; |
164 private TerminalManager manager; | 163 private TerminalManager manager; |
165 | 164 |
166 private final TN5250jLogger log = TN5250jLogFactory.getLogger(this.getClass()); | 165 private final TN5250jLogger log = TN5250jLogFactory.getLogger(this.getClass()); |
167 | 166 |
168 /** | 167 /** |
169 * @param session | |
170 * @param screen52 | 168 * @param screen52 |
171 * @param type | 169 * @param enhanced |
172 * @param support132 | 170 * @param support132 |
171 * @param bridge | |
172 * @param manager | |
173 */ | 173 */ |
174 public tnvt(Screen5250 screen52, boolean enhanced, boolean support132, TerminalBridge bridge, TerminalManager manager) { | 174 public tnvt(Screen5250 screen52, boolean enhanced, boolean support132, TerminalBridge bridge, TerminalManager manager) { |
175 if (log.isInfoEnabled()) { | 175 if (log.isInfoEnabled()) { |
176 log.info(" new session -> " + controller.getSessionName()); | 176 log.info(" new session -> " + controller.getSessionName()); |
177 } | 177 } |
201 | 201 |
202 baosp = new ByteArrayOutputStream(); | 202 baosp = new ByteArrayOutputStream(); |
203 baosrsp = new ByteArrayOutputStream(); | 203 baosrsp = new ByteArrayOutputStream(); |
204 } | 204 } |
205 | 205 |
206 public void showURL(String url) { | |
207 if (url.indexOf("://") < 0) url = "http://" + url; | |
208 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); | |
209 manager.startActivity(intent); | |
210 } | |
211 | |
206 public String getHostName() { | 212 public String getHostName() { |
207 | 213 |
208 return session; | 214 return hostname; |
209 } | 215 } |
210 | 216 |
211 | 217 |
212 public void setSSLType(String type) { | 218 public void setSSLType(String type) { |
213 sslType = type; | 219 sslType = type; |
255 log.info(" socks set "); | 261 log.info(" socks set "); |
256 } | 262 } |
257 | 263 |
258 public final boolean connect() { | 264 public final boolean connect() { |
259 | 265 |
260 return connect(session, port); | 266 return connect(hostname, port); |
261 | 267 |
262 } | 268 } |
263 | 269 |
264 | 270 |
265 public final boolean connect(String s, int port) { | 271 public final boolean connect(String hostname, int port) { |
266 | 272 |
267 // We will now see if there are any bypass signon parameters to be | 273 // We will now see if there are any bypass signon parameters to be |
268 // processed. The system properties override these parameters so | 274 // processed. The system properties override these parameters so |
269 // have precidence if specified. | 275 // have precidence if specified. |
270 Properties props = controller.getConnectionProperties(); | 276 Properties props = controller.getConnectionProperties(); |
281 program = props.getProperty("SESSION_CONNECT_PROGRAM"); | 287 program = props.getProperty("SESSION_CONNECT_PROGRAM"); |
282 } | 288 } |
283 | 289 |
284 | 290 |
285 try { | 291 try { |
286 session = s; | 292 this.hostname = hostname; |
287 this.port = port; | 293 this.port = port; |
288 | 294 |
289 try { | 295 try { |
290 screen52.getOIA().setInputInhibited(ScreenOIA.INPUTINHIBITED_SYSTEM_WAIT, | 296 screen52.getOIA().setInputInhibited(ScreenOIA.INPUTINHIBITED_SYSTEM_WAIT, |
291 ScreenOIA.OIA_LEVEL_INPUT_INHIBITED,"X - Connecting"); | 297 ScreenOIA.OIA_LEVEL_INPUT_INHIBITED,"X - Connecting"); |
292 } catch (Exception exc) { | 298 } catch (Exception exc) { |
295 | 301 |
296 // sock = new Socket(s, port); | 302 // sock = new Socket(s, port); |
297 //smk - For SSL compability | 303 //smk - For SSL compability |
298 SocketConnector sc = new SocketConnector(); | 304 SocketConnector sc = new SocketConnector(); |
299 if (sslType != null) sc.setSSLType(sslType); | 305 if (sslType != null) sc.setSSLType(sslType); |
300 sock = sc.createSocket(s, port, bridge, manager); | 306 sock = sc.createSocket(hostname, port, bridge, manager); |
301 | 307 |
302 if (sock == null) { | 308 if (sock == null) { |
303 log.warn("I did not get a socket"); | 309 log.warn("I did not get a socket"); |
304 disconnect(); | 310 disconnect(); |
305 return false; | 311 return false; |