Interface FtpSession


public interface FtpSession
Defines an client session with the FTP server. The session is born when the client connects and dies when the client disconnects. Ftplet methods will always get the same session for one user and one connection. So the attributes set by setAttribute() will be always available later unless that attribute is removed or the client disconnects.
Author:
Apache MINA Project
  • Method Details

    • getClientAddress

      InetSocketAddress getClientAddress()
      Returns the IP address of the client that sent the request.
      Returns:
      The client InetAddress
    • getServerAddress

      InetSocketAddress getServerAddress()
      Returns the IP address of the server
      Returns:
      The server InetAddress
    • getDataConnection

      DataConnectionFactory getDataConnection()
      Get FTP data connection factory, used to transfer data to and from the client.
      Returns:
      The DataConnectionFactory
    • getClientCertificates

      Certificate[] getClientCertificates()
      Retrieve the certificates for the client, if running over SSL and with client authentication
      Returns:
      The Certificate chain, or null if the certificates are not avialble
    • getConnectionTime

      Date getConnectionTime()
      Get connection time.
      Returns:
      Time when the client connected to the server
    • getLoginTime

      Date getLoginTime()
      Get the login time.
      Returns:
      Time when the client logged into the server
    • getFailedLogins

      int getFailedLogins()
      Get the number of failed logins.
      Returns:
      The number of failed logins. When login succeeds, this will return 0.
    • getLastAccessTime

      Date getLastAccessTime()
      Get last access time.
      Returns:
      The last time the session performed any action
    • getMaxIdleTime

      int getMaxIdleTime()
      Returns maximum idle time. This time equals to User.getMaxIdleTime() after user login.
      Returns:
      The number of seconds the client is allowed to be idle before disconnected.
    • setMaxIdleTime

      void setMaxIdleTime(int maxIdleTimeSec)
      Set maximum idle time in seconds. This time equals to User.getMaxIdleTime() after user login.
      Parameters:
      maxIdleTimeSec - The number of seconds the client is allowed to be idle before disconnected.
    • getUser

      User getUser()
      Get user object.
      Returns:
      The current User
    • getUserArgument

      String getUserArgument()
      Returns user name entered in USER command
      Returns:
      user name entered in USER command
    • getLanguage

      String getLanguage()
      Get the requested language.
      Returns:
      The language requested by the client
    • isLoggedIn

      boolean isLoggedIn()
      Is the user logged in?
      Returns:
      true if the user is logged in
    • getFileSystemView

      FileSystemView getFileSystemView()
      Get user file system view.
      Returns:
      The FileSystemView for this session/user
    • getFileOffset

      long getFileOffset()
      Get file upload/download offset.
      Returns:
      The current file transfer offset, or 0 if non is set
    • getRenameFrom

      FtpFile getRenameFrom()
      Get rename from file object.
      Returns:
      The current rename from, or null if non is set
    • getDataType

      DataType getDataType()
      Get the data type.
      Returns:
      The current DataType for this session
    • getStructure

      Structure getStructure()
      Get structure.
      Returns:
      The current Structure for this session
    • getAttribute

      Object getAttribute(String name)
      Returns the value of the named attribute as an Object.
      Parameters:
      name - The attribute name
      Returns:
      The attribute value, or null if no attribute of the given name exists.
    • setAttribute

      void setAttribute(String name, Object value)
      Stores an attribute in this request. It will be available until it was removed or when the connection ends.
      Parameters:
      name - The attribute name
      value - The attribute value
    • removeAttribute

      void removeAttribute(String name)
      Removes an attribute from this request.
      Parameters:
      name - The attribute name
    • write

      void write(FtpReply reply) throws FtpException
      Write a reply to the client
      Parameters:
      reply - The reply that will be sent to the client
      Throws:
      FtpException - If the write failed
    • isSecure

      boolean isSecure()
      Indicates whether the control socket for this session is secure, that is, running over SSL/TLS
      Returns:
      true if the control socket is secured
    • getSessionId

      UUID getSessionId()
      Get the unique ID for this session. This ID will be maintained for the entire session and is also available to MDC logging using the "session" identifier.
      Returns:
      The unique ID for this session