if (RequestHandler.Result.Unsupported.equals(result)) { if (traceEnabled) { log.trace("globalRequest({}) {}#process({})[want-reply={}] : {}",
if (this.type == null) { RequestHandler.Result r = handleShell(requestType, buffer, wantReply); if (RequestHandler.Result.ReplySuccess.equals(r) || RequestHandler.Result.Replied.equals(r)) { this.type = requestType; if (this.type == null) { RequestHandler.Result r = handleExec(requestType, buffer, wantReply); if (RequestHandler.Result.ReplySuccess.equals(r) || RequestHandler.Result.Replied.equals(r)) { this.type = requestType; if (this.type == null) { RequestHandler.Result r = handleSubsystem(requestType, buffer, wantReply); if (RequestHandler.Result.ReplySuccess.equals(r) || RequestHandler.Result.Replied.equals(r)) { this.type = requestType;
if (this.type == null) { RequestHandler.Result r = handleShell(requestType, buffer, wantReply); if (RequestHandler.Result.ReplySuccess.equals(r) || RequestHandler.Result.Replied.equals(r)) { this.type = requestType; if (this.type == null) { RequestHandler.Result r = handleExec(requestType, buffer, wantReply); if (RequestHandler.Result.ReplySuccess.equals(r) || RequestHandler.Result.Replied.equals(r)) { this.type = requestType; if (this.type == null) { RequestHandler.Result r = handleSubsystem(requestType, buffer, wantReply); if (RequestHandler.Result.ReplySuccess.equals(r) || RequestHandler.Result.Replied.equals(r)) { this.type = requestType;
if (RequestHandler.Result.Unsupported.equals(result)) { if (traceEnabled) { log.trace("globalRequest({}) {}#process({})[want-reply={}] : {}",
if (RequestHandler.Result.Unsupported.equals(result)) { if (traceEnabled) { log.trace("handleRequest({})[{}#process({})[want-reply={}]]: {}",
if (RequestHandler.Result.Unsupported.equals(result)) { if (traceEnabled) { log.trace("handleRequest({})[{}#process({})[want-reply={}]]: {}",
@Override protected IoWriteFuture sendResponse(Buffer buffer, String req, Result result, boolean wantReply) throws IOException { IoWriteFuture future = super.sendResponse(buffer, req, result, wantReply); if (!RequestHandler.Result.ReplySuccess.equals(result)) { return future;
@Override protected IoWriteFuture sendResponse(Buffer buffer, String req, Result result, boolean wantReply) throws IOException { IoWriteFuture future = super.sendResponse(buffer, req, result, wantReply); if (!RequestHandler.Result.ReplySuccess.equals(result)) { return future;
protected IoWriteFuture sendGlobalResponse(Buffer buffer, String req, RequestHandler.Result result, boolean wantReply) throws IOException { if (log.isDebugEnabled()) { log.debug("sendGlobalResponse({})[{}] result={}, want-reply={}", this, req, result, wantReply); } if (RequestHandler.Result.Replied.equals(result) || (!wantReply)) { return new AbstractIoWriteFuture(req, null) { { setValue(Boolean.TRUE); } }; } byte cmd = RequestHandler.Result.ReplySuccess.equals(result) ? SshConstants.SSH_MSG_REQUEST_SUCCESS : SshConstants.SSH_MSG_REQUEST_FAILURE; AbstractSession session = getSession(); Buffer rsp = session.createBuffer(cmd, 2); return session.writePacket(rsp); }
/** * Called when none of the register request handlers reported handling the request * * @param req The request type * @param wantReply Whether reply is requested * @param buffer The {@link Buffer} containing extra request-specific data * @throws IOException If failed to send the response (if needed) * @see #handleInternalRequest(String, boolean, Buffer) */ protected void handleUnknownChannelRequest(String req, boolean wantReply, Buffer buffer) throws IOException { RequestHandler.Result r = handleInternalRequest(req, wantReply, buffer); if ((r == null) || RequestHandler.Result.Unsupported.equals(r)) { log.warn("handleUnknownChannelRequest({}) Unknown channel request: {}[want-reply={}]", this, req, wantReply); sendResponse(buffer, req, RequestHandler.Result.Unsupported, wantReply); } else { sendResponse(buffer, req, r, wantReply); } }
protected IoWriteFuture sendResponse(Buffer buffer, String req, RequestHandler.Result result, boolean wantReply) throws IOException { if (log.isDebugEnabled()) { log.debug("sendResponse({}) request={} result={}, want-reply={}", this, req, result, wantReply); } if (RequestHandler.Result.Replied.equals(result) || (!wantReply)) { return new AbstractIoWriteFuture(req, null) { { setValue(Boolean.TRUE); } }; } byte cmd = RequestHandler.Result.ReplySuccess.equals(result) ? SshConstants.SSH_MSG_CHANNEL_SUCCESS : SshConstants.SSH_MSG_CHANNEL_FAILURE; Session session = getSession(); Buffer rsp = session.createBuffer(cmd, Integer.BYTES); rsp.putInt(recipient); return session.writePacket(rsp); }
protected IoWriteFuture sendResponse(Buffer buffer, String req, RequestHandler.Result result, boolean wantReply) throws IOException { if (log.isDebugEnabled()) { log.debug("sendResponse({}) request={} result={}, want-reply={}", this, req, result, wantReply); } if (RequestHandler.Result.Replied.equals(result) || (!wantReply)) { return new AbstractIoWriteFuture(req, null) { { setValue(Boolean.TRUE); } }; } byte cmd = RequestHandler.Result.ReplySuccess.equals(result) ? SshConstants.SSH_MSG_CHANNEL_SUCCESS : SshConstants.SSH_MSG_CHANNEL_FAILURE; Session session = getSession(); Buffer rsp = session.createBuffer(cmd, Integer.BYTES); rsp.putInt(recipient); return session.writePacket(rsp); }
/** * @param name The result name - ignored if {@code null}/empty * @return The matching {@link Result} value (case <U>insensitive</U>) * or {@code null} if no match found */ public static Result fromName(String name) { if (GenericUtils.isEmpty(name)) { return null; } for (Result r : VALUES) { if (name.equalsIgnoreCase(r.name())) { return r; } } return null; } }
protected IoWriteFuture sendGlobalResponse(Buffer buffer, String req, RequestHandler.Result result, boolean wantReply) throws IOException { if (log.isDebugEnabled()) { log.debug("sendGlobalResponse({})[{}] result={}, want-reply={}", this, req, result, wantReply); } if (RequestHandler.Result.Replied.equals(result) || (!wantReply)) { return new AbstractIoWriteFuture(req, null) { { setValue(Boolean.TRUE); } }; } byte cmd = RequestHandler.Result.ReplySuccess.equals(result) ? SshConstants.SSH_MSG_REQUEST_SUCCESS : SshConstants.SSH_MSG_REQUEST_FAILURE; AbstractSession session = getSession(); Buffer rsp = session.createBuffer(cmd, 2); return session.writePacket(rsp); }
/** * @param name The result name - ignored if {@code null}/empty * @return The matching {@link Result} value (case <U>insensitive</U>) * or {@code null} if no match found */ public static Result fromName(String name) { if (GenericUtils.isEmpty(name)) { return null; } for (Result r : VALUES) { if (name.equalsIgnoreCase(r.name())) { return r; } } return null; } }
/** * Called when none of the register request handlers reported handling the request * * @param req The request type * @param wantReply Whether reply is requested * @param buffer The {@link Buffer} containing extra request-specific data * @throws IOException If failed to send the response (if needed) * @see #handleInternalRequest(String, boolean, Buffer) */ protected void handleUnknownChannelRequest(String req, boolean wantReply, Buffer buffer) throws IOException { RequestHandler.Result r = handleInternalRequest(req, wantReply, buffer); if ((r == null) || RequestHandler.Result.Unsupported.equals(r)) { log.warn("handleUnknownChannelRequest({}) Unknown channel request: {}[want-reply={}]", this, req, wantReply); sendResponse(buffer, req, RequestHandler.Result.Unsupported, wantReply); } else { sendResponse(buffer, req, r, wantReply); } }