|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mockftpserver.core.command.AbstractCommandHandler
org.mockftpserver.core.command.AbstractTrackingCommandHandler
org.mockftpserver.stub.command.AbstractStubDataCommandHandler
org.mockftpserver.stub.command.RetrCommandHandler
public class RetrCommandHandler
CommandHandler for the RETR (Retrieve) command. Return the configured file contents on the data
connection, along with two replies on the control connection: a reply code of 150 and
another of 226. By default, return an empty file (i.e., a zero-length byte[]). You can
customize the returned file contents by setting the fileContents property,
specified either as a String or as a byte array.
PATHNAME_KEY ("pathname") - the pathname of the file submitted on the invocation (the first command parameter)
| Field Summary | |
|---|---|
static String |
PATHNAME_KEY
|
| Fields inherited from class org.mockftpserver.stub.command.AbstractStubDataCommandHandler |
|---|
finalReplyCode, finalReplyMessageKey, finalReplyText, preliminaryReplyCode, preliminaryReplyMessageKey, preliminaryReplyText |
| Fields inherited from class org.mockftpserver.core.command.AbstractCommandHandler |
|---|
LOG |
| Constructor Summary | |
|---|---|
RetrCommandHandler()
Create new uninitialized instance |
|
RetrCommandHandler(byte[] fileContents)
Create new instance using the specified fileContents |
|
RetrCommandHandler(String fileContents)
Create new instance using the specified fileContents |
|
| Method Summary | |
|---|---|
protected void |
beforeProcessData(Command command,
Session session,
InvocationRecord invocationRecord)
Perform any necessary logic before transferring data across the data connection. |
protected void |
processData(Command command,
Session session,
InvocationRecord invocationRecord)
Abstract method placeholder for subclass transfer of data across the data connection. |
void |
setFileContents(byte[] fileContents)
Set the file contents to return from subsequent command invocations |
void |
setFileContents(String fileContents)
Set the file contents to return from subsequent command invocations |
| Methods inherited from class org.mockftpserver.stub.command.AbstractStubDataCommandHandler |
|---|
afterProcessData, handleCommand, sendFinalReply, setFinalReplyCode, setFinalReplyMessageKey, setFinalReplyText, setPreliminaryReplyCode, setPreliminaryReplyMessageKey, setPreliminaryReplyText |
| Methods inherited from class org.mockftpserver.core.command.AbstractTrackingCommandHandler |
|---|
clearInvocations, getInvocation, handleCommand, numberOfInvocations, sendReply |
| Methods inherited from class org.mockftpserver.core.command.AbstractCommandHandler |
|---|
assertValidReplyCode, getReplyTextBundle, quotes, setReplyTextBundle |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.mockftpserver.core.command.CommandHandler |
|---|
handleCommand |
| Field Detail |
|---|
public static final String PATHNAME_KEY
| Constructor Detail |
|---|
public RetrCommandHandler()
public RetrCommandHandler(String fileContents)
fileContents - - the file contents
AssertFailedException - - if the fileContents is nullpublic RetrCommandHandler(byte[] fileContents)
fileContents - - the file contents
AssertFailedException - - if the fileContents is null| Method Detail |
|---|
protected void beforeProcessData(Command command,
Session session,
InvocationRecord invocationRecord)
throws Exception
AbstractStubDataCommandHandler
beforeProcessData in class AbstractStubDataCommandHandlercommand - - the Command to be handledsession - - the session on which the Command was submittedinvocationRecord - - the InvocationRecord; CommandHandlers are expected to add
handler-specific data to the InvocationRecord, as appropriate
ExceptionAbstractStubDataCommandHandler.beforeProcessData(org.mockftpserver.core.command.Command, org.mockftpserver.core.session.Session, org.mockftpserver.core.command.InvocationRecord)
protected void processData(Command command,
Session session,
InvocationRecord invocationRecord)
AbstractStubDataCommandHandler
processData in class AbstractStubDataCommandHandlercommand - - the Command to be handledsession - - the session on which the Command was submittedinvocationRecord - - the InvocationRecord; CommandHandlers are expected to add
handler-specific data to the InvocationRecord, as appropriateAbstractStubDataCommandHandler.processData(org.mockftpserver.core.command.Command, org.mockftpserver.core.session.Session, org.mockftpserver.core.command.InvocationRecord)public void setFileContents(String fileContents)
fileContents - - the fileContents to set
AssertFailedException - - if the fileContents is nullpublic void setFileContents(byte[] fileContents)
fileContents - - the file contents
AssertFailedException - - if the fileContents is null
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||