private static URIish createURI(Session session) { URIish uri = new URIish(); uri = uri.setScheme("ssh"); //$NON-NLS-1$ uri = uri.setUser(session.getUserName()); uri = uri.setHost(session.getHost()); uri = uri.setPort(session.getPort()); return uri; }
/** * Creates a {@link URIish} from the given remote address and user name. * * @param userName * for the uri * @param remote * address of the remote host * @return the uri, with {@link SshConstants#SSH_SCHEME} as scheme */ public static URIish toURI(String userName, InetSocketAddress remote) { String host = remote.getHostString(); int port = remote.getPort(); return new URIish() // .setScheme(SshConstants.SSH_SCHEME) // .setHost(host) // .setPort(port) // .setUser(userName); }
private void setDefaults(URIish uri, String targetBranch) { URIish newPushURI = uri; if (Protocol.SSH.handles(uri)) { newPushURI = newPushURI.setPort(GERRIT_DEFAULT_SSH_PORT); } else if (Protocol.GIT.handles(uri)) { newPushURI = newPushURI.setScheme(Protocol.SSH.getDefaultScheme()); newPushURI = newPushURI.setPort(GERRIT_DEFAULT_SSH_PORT); } uriText.setText(newPushURI.toString()); final String uriScheme = newPushURI.getScheme(); if (uriScheme != null) scheme.select(scheme.indexOf(uriScheme)); branch.setText(targetBranch != null ? targetBranch : Constants.MASTER); }
public void widgetSelected(final SelectionEvent e) { final int idx = scheme.getSelectionIndex(); pushURI = pushURI.setScheme(scheme.getItem(idx)); if (Protocol.SSH.handles(pushURI)) pushURI = pushURI.setPort(GERRIT_DEFAULT_SSH_PORT); else pushURI = pushURI.setPort(-1); uriText.setText(pushURI.toString()); scheme.setToolTipText(Protocol.values()[idx].getTooltip()); } });
/** * Start the server * * @throws Exception */ public void start() throws Exception { ServletContextHandler sBasic = server.authBasic(smart("/sbasic")); server.setUp(); final String srcName = db.getDirectory().getName(); uri = toURIish(sBasic, srcName); int sslPort = server.getSecurePort(); if (sslPort > 0) { secureUri = uri.setPort(sslPort).setScheme("https"); } }
private static URIish createURI(Session session) { URIish uri = new URIish(); uri = uri.setScheme("ssh"); //$NON-NLS-1$ uri = uri.setUser(session.getUserName()); uri = uri.setHost(session.getHost()); uri = uri.setPort(session.getPort()); return uri; }
private static URIish createURI(Session session) { URIish uri = new URIish(); uri = uri.setScheme("ssh"); //$NON-NLS-1$ uri = uri.setUser(session.getUserName()); uri = uri.setHost(session.getHost()); uri = uri.setPort(session.getPort()); return uri; }