Package org.apache.ftpserver.ftplet

Examples of org.apache.ftpserver.ftplet.FileSystemView


        if (request.hasArgument()) {
            dirName = request.getArgument();
        }

        // change directory
        FileSystemView fsview = session.getFileSystemView();
        boolean success = false;
        try {
            success = fsview.changeWorkingDirectory(dirName);
        } catch (Exception ex) {
            LOG.debug("Failed to change directory in file system", ex);
        }
        FtpFile cwd = fsview.getWorkingDirectory();
        if (success) {
            dirName = cwd.getAbsolutePath();
            session.write(LocalizedFileActionFtpReply.translate(session, request, context,
                    FtpReply.REPLY_250_REQUESTED_FILE_ACTION_OKAY, "CWD",
                    dirName, cwd));
View Full Code Here


                return;
            }

            // update different objects
            FileSystemFactory fmanager = context.getFileSystemManager();
            FileSystemView fsview = fmanager
                    .createFileSystemView(authenticatedUser);
            session.setLogin(fsview);
            stat.setLogin(session);

            // everything is fine - send login ok message
View Full Code Here

        } catch (Exception e) {
            // swallow the exception, we're closing down the session anyways
            LOG.warn("Data connection threw an exception on disconnect", e);
        }
       
        FileSystemView fs = session.getFileSystemView();
        if(fs != null) {
            try  {
                fs.dispose();
            } catch (Exception e) {
                LOG.warn("FileSystemView threw an exception on disposal", e);
            }
        }
View Full Code Here

        // reset state variables
        session.resetState();

        // change directory
        FileSystemView fsview = session.getFileSystemView();
        boolean success = false;
        try {
            success = fsview.changeWorkingDirectory("..");
        } catch (Exception ex) {
            LOG.debug("Failed to change directory in file system", ex);
        }
        FtpFile cwd = fsview.getWorkingDirectory();
        if (success) {
            String dirName = cwd.getAbsolutePath();
            session.write(LocalizedFileActionFtpReply.translate(session, request, context,
                    FtpReply.REPLY_250_REQUESTED_FILE_ACTION_OKAY, "CDUP",
                    dirName, cwd));
View Full Code Here

     */
    public void execute(final FtpIoSession session,
            final FtpServerContext context, final FtpRequest request)
            throws IOException, FtpException {
        session.resetState();
        FileSystemView fsview = session.getFileSystemView();
        String currDir = fsview.getWorkingDirectory().getAbsolutePath();
        session.write(LocalizedFtpReply.translate(session, request, context,
                FtpReply.REPLY_257_PATHNAME_CREATED, "PWD", currDir));
    }
View Full Code Here

      varVal = session.getUser().getHomeDirectory();
    }

    // client directory
    else if (varName.equals(CLIENT_DIR)) {
      FileSystemView fsView = session.getFileSystemView();
      if (fsView != null) {
        try {
          varVal = fsView.getWorkingDirectory().getAbsolutePath();
        }
        catch (Exception ex) {
          varVal = "";
        }
      }
View Full Code Here

     */
    //TODO may need synchronization
    protected FtpFile getUniqueFile(FtpIoSession session, FtpFile oldFile)
            throws FtpException {
        FtpFile newFile = oldFile;
        FileSystemView fsView = session.getFileSystemView();
        String fileName = newFile.getAbsolutePath();
        while (newFile.doesExist()) {
            newFile = fsView.getFile(fileName + '.'
                    + System.currentTimeMillis());
            if (newFile == null) {
                break;
            }
        }
View Full Code Here

        if (request.hasArgument()) {
            dirName = request.getArgument();
        }
       
        // change directory
        FileSystemView fsview = session.getFileSystemView();
        boolean success = false;
        try {
            success = fsview.changeDirectory(dirName);
        }
        catch(Exception ex) {
            LOG.debug("Failed to change directory in file system", ex);
        }
        if(success) {
            dirName = fsview.getCurrentDirectory().getFullName();
            session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_250_REQUESTED_FILE_ACTION_OKAY, "CWD", dirName));
        }
        else {
            session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "CWD", null));
        }
View Full Code Here

                return;
            }
           
            // update different objects
            FileSystemManager fmanager = context.getFileSystemManager();
            FileSystemView fsview = fmanager.createFileSystemView(authenticatedUser);
            session.setLogin(fsview);
            stat.setLogin(session);

            // everything is fine - send login ok message
            session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_230_USER_LOGGED_IN, "PASS", userName));
View Full Code Here

            varVal = session.getUser().getHomeDirectory();
        }
       
        // client directory
        else if(varName.equals(CLIENT_DIR)) {
            FileSystemView fsView = session.getFileSystemView();
            if(fsView != null) {
                try {
                    varVal = fsView.getCurrentDirectory().getFullName();
                }
                catch(Exception ex) {
                    varVal = "";
                }
            }
View Full Code Here

TOP

Related Classes of org.apache.ftpserver.ftplet.FileSystemView

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.