org.mockftpserver.core.command
Class AbstractStaticReplyCommandHandler

java.lang.Object
  extended by org.mockftpserver.core.command.AbstractCommandHandler
      extended by org.mockftpserver.core.command.AbstractTrackingCommandHandler
          extended by org.mockftpserver.core.command.AbstractStaticReplyCommandHandler
All Implemented Interfaces:
CommandHandler, InvocationHistory, ReplyTextBundleAware
Direct Known Subclasses:
AbstractStubCommandHandler, ConnectCommandHandler, StaticReplyCommandHandler, UnsupportedCommandHandler

public abstract class AbstractStaticReplyCommandHandler
extends AbstractTrackingCommandHandler

The abstract superclass for CommandHandler classes that default to sending back a configured reply code and text. You can customize the returned reply code by setting the required replyCode property. If only the replyCode property is set, then the default reply text corresponding to that reply code is used in the response. You can optionally configure the reply text by setting the replyMessageKey or replyText property.

Subclasses can optionally override the reply code and/or text for the reply by calling setReplyCode(int), setReplyMessageKey(String) and setReplyText(String).

Version:
$Revision: 184 $ - $Date: 2008-12-03 17:52:39 -0500 (Wed, 03 Dec 2008) $
Author:
Chris Mair

Field Summary
protected  int replyCode
           
protected  String replyMessageKey
           
protected  String replyText
           
 
Fields inherited from class org.mockftpserver.core.command.AbstractCommandHandler
LOG
 
Constructor Summary
AbstractStaticReplyCommandHandler()
           
 
Method Summary
protected  void sendReply(Session session)
          Send the reply using the replyCode and message key/text configured for this command handler.
protected  void sendReply(Session session, Object messageParameter)
          Send the reply using the replyCode and message key/text configured for this command handler.
 void setReplyCode(int replyCode)
          Set the reply code.
 void setReplyMessageKey(String replyMessageKey)
          Set the message key for the reply text.
 void setReplyText(String replyText)
          Set the reply text.
 
Methods inherited from class org.mockftpserver.core.command.AbstractTrackingCommandHandler
clearInvocations, getInvocation, handleCommand, 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
 

Field Detail

replyCode

protected int replyCode

replyText

protected String replyText

replyMessageKey

protected String replyMessageKey
Constructor Detail

AbstractStaticReplyCommandHandler

public AbstractStaticReplyCommandHandler()
Method Detail

setReplyCode

public void setReplyCode(int replyCode)
Set the reply code.

Parameters:
replyCode - - the replyCode
Throws:
AssertFailedException - - if the replyCode is not valid

setReplyText

public void setReplyText(String replyText)
Set the reply text. If null, then use the (default) message key for the replyCode.

Parameters:
replyText - - the replyText

setReplyMessageKey

public void setReplyMessageKey(String replyMessageKey)
Set the message key for the reply text. If null, then use the default message key.

Parameters:
replyMessageKey - - the replyMessageKey to set

sendReply

protected void sendReply(Session session)
Send the reply using the replyCode and message key/text configured for this command handler.

Parameters:
session - - the Session
Throws:
AssertFailedException - if the replyCode is not valid

sendReply

protected void sendReply(Session session,
                         Object messageParameter)
Send the reply using the replyCode and message key/text configured for this command handler.

Parameters:
session - - the Session
messageParameter - - message parameter; may be null
Throws:
AssertFailedException - if the replyCode is not valid


Copyright © 2014. All rights reserved.