public String getProperty(String key) { return env.getEnv().get(key); } }
public int getWidth() { String s = env.getEnv().get(Environment.ENV_COLUMNS); int width = -1; if (s != null) { try { width = Integer.parseInt(s); } catch (NumberFormatException e) { log.log(Level.WARNING, "Could not parse ssh term width " + s); } } return width; }
public int getHeight() { String s = env.getEnv().get(Environment.ENV_LINES); int height = -1; if (s != null) { try { height = Integer.parseInt(s); } catch (NumberFormatException e) { log.log(Level.WARNING, "Could not parse ssh term height " + s); } } return height; }
public SSHContext(Environment env) { if (env == null) { throw new NullPointerException("No null env"); } // Integer verase = env.getPtyModes().get(PtyMode.VERASE); String LC_CTYPE = env.getEnv().get("LC_CTYPE"); Charset encoding; if (LC_CTYPE != null) { encoding = parseEncoding(LC_CTYPE); } else { encoding = null; } // this.env = env; this.verase = verase != null ? verase : -1; this.encoding = encoding; }
public String getProperty(String key) { return env.getEnv().get(key); } }
public String getProperty(String key) { return env.getEnv().get(key); } }
public String getProperty(String key) { return env.getEnv().get(key); } }
public int getHeight() { String s = env.getEnv().get(Environment.ENV_LINES); int height = -1; if (s != null) { try { height = Integer.parseInt(s); } catch (NumberFormatException e) { log.log(Level.WARNING, "Could not parse ssh term height " + s); } } return height; }
public int getWidth() { String s = env.getEnv().get(Environment.ENV_COLUMNS); int width = -1; if (s != null) { try { width = Integer.parseInt(s); } catch (NumberFormatException e) { log.log(Level.WARNING, "Could not parse ssh term width " + s); } } return width; }
public int getWidth() { String s = env.getEnv().get(Environment.ENV_COLUMNS); int width = -1; if (s != null) { try { width = Integer.parseInt(s); } catch (NumberFormatException e) { log.log(Level.WARNING, "Could not parse ssh term width " + s); } } return width; }
public int getHeight() { String s = env.getEnv().get(Environment.ENV_LINES); int height = -1; if (s != null) { try { height = Integer.parseInt(s); } catch (NumberFormatException e) { log.log(Level.WARNING, "Could not parse ssh term height " + s); } } return height; }
@Override public void start(org.apache.sshd.server.Environment env) { terminalType = env.getEnv().get("TERM"); sshThread = new Thread(this, "ssh-session-" + System.nanoTime()); sshThread.start(); }
public int getWidth() { String s = env.getEnv().get(Environment.ENV_COLUMNS); int width = -1; if (s != null) { try { width = Integer.parseInt(s); } catch (NumberFormatException e) { log.log(Level.WARNING, "Could not parse ssh term width " + s); } } return width; }
public int getHeight() { String s = env.getEnv().get(Environment.ENV_LINES); int height = -1; if (s != null) { try { height = Integer.parseInt(s); } catch (NumberFormatException e) { log.log(Level.WARNING, "Could not parse ssh term height " + s); } } return height; }
public void start(Environment env) throws IOException { this.environment = env; this.session = new SpashSession(environment.getEnv().get(Environment.ENV_USER)); this.thread = new Thread(this); this.thread.start(); }
/** * Get the default encoding. Will first look at the LC_CTYPE environment variable, then the input.encoding * system property, then the default charset according to the JVM. * * @return The default encoding to use when none is specified. */ public static String getEncoding(Environment env) { // LC_CTYPE is usually in the form en_US.UTF-8 String ctype = env.getEnv().getOrDefault("LC_TYPE", System.getenv("LC_CTYPE")); String envEncoding = extractEncodingFromCtype(ctype); if (envEncoding != null) { return envEncoding; } return System.getProperty("input.encoding", Charset.defaultCharset().name()); }
@Override public int getHeight() { String linesAsString = retrieveEnvironment().getEnv().get("LINES"); try { if (isNullOrEmpty(linesAsString)) return DEFAULT_HEIGHT; int lines = parseInt(linesAsString); return lines > 0 ? lines : DEFAULT_HEIGHT; } catch (NumberFormatException e) { return DEFAULT_HEIGHT; } }
@Override public int getWidth() { String columnsAsString = retrieveEnvironment().getEnv().get("COLUMNS"); try { if (isNullOrEmpty(columnsAsString)) return DEFAULT_WIDTH; int columns = parseInt(columnsAsString); return columns > 0 ? columns : DEFAULT_WIDTH; } catch (NumberFormatException e) { return DEFAULT_WIDTH; } }
@Override public void start(Environment env) throws IOException { terminalType = env.getEnv().get(Environment.ENV_TERM); sshThread = new Thread(this, "ssh-cli " + session.getSession().getIoSession().getAttribute(Constants.USER)); sshThread.start(); }
protected void handleSignal(org.apache.sshd.server.Signal signal) { if (signal == org.apache.sshd.server.Signal.INT) { raise(Signal.INT); } else if (signal == org.apache.sshd.server.Signal.QUIT) { raise(Signal.QUIT); } else if (signal == org.apache.sshd.server.Signal.TSTP) { raise(Signal.TSTP); } else if (signal == org.apache.sshd.server.Signal.CONT) { raise(Signal.CONT); } else if (signal == org.apache.sshd.server.Signal.WINCH) { int w = Integer.valueOf(this.environment.getEnv().get(Environment.ENV_COLUMNS)); int h = Integer.valueOf(this.environment.getEnv().get(Environment.ENV_LINES)); setSize(new Size(w, h)); raise(Signal.WINCH); } }