public class ChannelSession extends AbstractServerChannel
Modifier and Type | Class and Description |
---|---|
class |
ChannelSession.CommandCloseable |
AbstractChannel.GracefulChannelCloseable, AbstractChannel.GracefulState
AbstractCloseable.State
Modifier and Type | Field and Description |
---|---|
protected ChannelAsyncOutputStream |
asyncErr |
protected ChannelAsyncOutputStream |
asyncOut |
protected Command |
command |
protected CloseFuture |
commandExitFuture |
protected StandardEnvironment |
env |
protected OutputStream |
err |
protected OutputStream |
out |
protected ChannelDataReceiver |
receiver |
protected Buffer |
tempBuffer |
protected String |
type |
exitStatusSent
channelListenerProxy, channelListeners, eof, executor, gracefulFuture, gracefulState, handlers, localWindow, remoteWindow, RESPONSE_BUFFER_GROWTH_FACTOR, service, shutdownExecutor
closeFuture, lock, state
log
CHANNEL_EXEC, CHANNEL_SHELL, CHANNEL_SUBSYSTEM
Constructor and Description |
---|
ChannelSession() |
Modifier and Type | Method and Description |
---|---|
protected void |
addEnvVariable(String name,
String value) |
protected void |
closeShell(int exitValue) |
protected void |
doCloseImmediately()
doCloseImmediately is called once and only once
with state == Immediate
|
protected void |
doWriteData(byte[] data,
int off,
int len) |
protected void |
doWriteExtendedData(byte[] data,
int off,
int len) |
StandardEnvironment |
getEnvironment() |
protected Closeable |
getInnerCloseable() |
protected int |
getPtyModeValue(PtyMode mode) |
protected RequestHandler.Result |
handleAgentForwarding(Buffer buffer,
boolean wantReply) |
protected RequestHandler.Result |
handleBreak(Buffer buffer,
boolean wantReply) |
protected RequestHandler.Result |
handleEnv(Buffer buffer,
boolean wantReply) |
void |
handleEof() |
protected RequestHandler.Result |
handleExec(Buffer buffer,
boolean wantReply) |
protected RequestHandler.Result |
handleInternalRequest(String requestType,
boolean wantReply,
Buffer buffer)
Called by
AbstractChannel.handleUnknownChannelRequest(String, boolean, Buffer)
in order to allow channel request handling if none of the registered handlers
processed the request - last chance. |
protected RequestHandler.Result |
handlePtyReq(Buffer buffer,
boolean wantReply) |
protected RequestHandler.Result |
handleShell(Buffer buffer,
boolean wantReply) |
protected RequestHandler.Result |
handleSignal(Buffer buffer,
boolean wantReply) |
protected RequestHandler.Result |
handleSubsystem(Buffer buffer,
boolean wantReply) |
void |
handleWindowAdjust(Buffer buffer) |
protected RequestHandler.Result |
handleWindowChange(Buffer buffer,
boolean wantReply) |
protected RequestHandler.Result |
handleX11Forwarding(Buffer buffer,
boolean wantReply) |
protected void |
prepareCommand() |
void |
setDataReceiver(ChannelDataReceiver receiver)
For
Command to install ChannelDataReceiver . |
doInit, getServerSession, handleOpenFailure, handleOpenSuccess, open, sendExitStatus
addChannelListener, addPendingRequest, addRequestHandler, configureWindow, getChannelListenerProxy, getExecutorService, getId, getLocalWindow, getParentPropertyResolver, getProperties, getRecipient, getRemoteWindow, getSession, handleChannelRequest, handleClose, handleData, handleExtendedData, handleFailure, handleRequest, handleSuccess, handleUnknownChannelRequest, init, isEofSignalled, isShutdownOnExit, notifyStateChanged, preClose, removeChannelListener, removePendingRequest, sendEof, sendResponse, sendWindowAdjust, setEofSignalled, setExecutorService, setRecipient, setShutdownOnExit, toString, writePacket
doCloseGracefully
builder, close, isClosed, isClosing
close, isOpen
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getId, getLocalWindow, getRecipient, getRemoteWindow, getSession, handleClose, handleData, handleExtendedData, handleFailure, handleRequest, handleSuccess, init
addChannelListener, getChannelListenerProxy, removeChannelListener
getParentPropertyResolver, getProperties
protected String type
protected ChannelAsyncOutputStream asyncOut
protected ChannelAsyncOutputStream asyncErr
protected OutputStream out
protected OutputStream err
protected Command command
protected ChannelDataReceiver receiver
protected Buffer tempBuffer
protected final StandardEnvironment env
protected final CloseFuture commandExitFuture
public void handleWindowAdjust(Buffer buffer) throws IOException
handleWindowAdjust
in class AbstractChannel
IOException
protected Closeable getInnerCloseable()
getInnerCloseable
in class AbstractChannel
protected void doCloseImmediately()
AbstractCloseable
doCloseImmediately is called once and only once with state == Immediate
Overriding methods should always call the base implementation. It may be called concurrently while preClose() or doCloseGracefully is executing
doCloseImmediately
in class AbstractChannel
public void handleEof() throws IOException
handleEof
in class AbstractChannel
IOException
protected void doWriteData(byte[] data, int off, int len) throws IOException
doWriteData
in class AbstractChannel
IOException
protected void doWriteExtendedData(byte[] data, int off, int len) throws IOException
doWriteExtendedData
in class AbstractChannel
IOException
protected RequestHandler.Result handleInternalRequest(String requestType, boolean wantReply, Buffer buffer) throws IOException
AbstractChannel
AbstractChannel.handleUnknownChannelRequest(String, boolean, Buffer)
in order to allow channel request handling if none of the registered handlers
processed the request - last chance.handleInternalRequest
in class AbstractChannel
requestType
- The request typewantReply
- Whether reply is requestedbuffer
- The Buffer
containing extra request-specific datanull
or Unsupported
and reply is required then a failure message will be sentIOException
- If failed to process the request internallyprotected RequestHandler.Result handleEnv(Buffer buffer, boolean wantReply) throws IOException
IOException
protected RequestHandler.Result handlePtyReq(Buffer buffer, boolean wantReply) throws IOException
IOException
protected RequestHandler.Result handleWindowChange(Buffer buffer, boolean wantReply) throws IOException
IOException
protected RequestHandler.Result handleSignal(Buffer buffer, boolean wantReply) throws IOException
IOException
protected RequestHandler.Result handleBreak(Buffer buffer, boolean wantReply) throws IOException
IOException
protected RequestHandler.Result handleShell(Buffer buffer, boolean wantReply) throws IOException
IOException
protected RequestHandler.Result handleExec(Buffer buffer, boolean wantReply) throws IOException
IOException
protected RequestHandler.Result handleSubsystem(Buffer buffer, boolean wantReply) throws IOException
IOException
public void setDataReceiver(ChannelDataReceiver receiver)
Command
to install ChannelDataReceiver
.
When you do this, Command.setInputStream(java.io.InputStream)
or
AsyncCommand.setIoInputStream(org.apache.sshd.common.io.IoInputStream)
will no longer be invoked. If you call this method from CommandLifecycle.start(Environment)
,
the input stream you received in Command.setInputStream(java.io.InputStream)
will
not read any data.receiver
- The ChannelDataReceiver
instanceprotected void prepareCommand() throws IOException
IOException
protected int getPtyModeValue(PtyMode mode)
protected RequestHandler.Result handleAgentForwarding(Buffer buffer, boolean wantReply) throws IOException
IOException
protected RequestHandler.Result handleX11Forwarding(Buffer buffer, boolean wantReply) throws IOException
IOException
public StandardEnvironment getEnvironment()
protected void closeShell(int exitValue) throws IOException
IOException
Copyright © 2008–2016 The Apache Software Foundation. All rights reserved.