• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java FtpletResult类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.ftpserver.ftplet.FtpletResult的典型用法代码示例。如果您正苦于以下问题:Java FtpletResult类的具体用法?Java FtpletResult怎么用?Java FtpletResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FtpletResult类属于org.apache.ftpserver.ftplet包,在下文中一共展示了FtpletResult类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: sessionOpened

import org.apache.ftpserver.ftplet.FtpletResult; //导入依赖的package包/类
public void sessionOpened(final FtpIoSession session) throws Exception {
    FtpletContainer ftplets = context.getFtpletContainer();

    FtpletResult ftpletRet;
    try {
        ftpletRet = ftplets.onConnect(session.getFtpletSession());
    } catch (Exception e) {
        LOG.debug("Ftplet threw exception", e);
        ftpletRet = FtpletResult.DISCONNECT;
    }
    if (ftpletRet == FtpletResult.DISCONNECT) {
        LOG.debug("Ftplet returned DISCONNECT, session will be closed");
        session.close(false).awaitUninterruptibly(10000);
    } else {
        session.updateLastAccessTime();
        
        session.write(LocalizedFtpReply.translate(session, null, context,
                FtpReply.REPLY_220_SERVICE_READY, null, null));
    }
}
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:21,代码来源:DefaultFtpHandler.java


示例2: onConnect

import org.apache.ftpserver.ftplet.FtpletResult; //导入依赖的package包/类
/**
 * Call ftplet onConnect.
 */
public FtpletResult onConnect(FtpSession session) throws FtpException,
        IOException {
    FtpletResult retVal = FtpletResult.DEFAULT;
    for (Entry<String, Ftplet> entry : ftplets.entrySet()) {
        retVal = entry.getValue().onConnect(session);
        if (retVal == null) {
            retVal = FtpletResult.DEFAULT;
        }

        // proceed only if the return value is FtpletResult.DEFAULT
        if (retVal != FtpletResult.DEFAULT) {
            break;
        }
    }
    return retVal;
}
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:20,代码来源:DefaultFtpletContainer.java


示例3: onDisconnect

import org.apache.ftpserver.ftplet.FtpletResult; //导入依赖的package包/类
/**
 * Call ftplet onDisconnect.
 */
public FtpletResult onDisconnect(FtpSession session) throws FtpException,
        IOException {
    FtpletResult retVal = FtpletResult.DEFAULT;
    for (Entry<String, Ftplet> entry : ftplets.entrySet()) {

        retVal = entry.getValue().onDisconnect(session);
        if (retVal == null) {
            retVal = FtpletResult.DEFAULT;
        }

        // proceed only if the return value is FtpletResult.DEFAULT
        if (retVal != FtpletResult.DEFAULT) {
            break;
        }
    }
    return retVal;
}
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:21,代码来源:DefaultFtpletContainer.java


示例4: afterCommand

import org.apache.ftpserver.ftplet.FtpletResult; //导入依赖的package包/类
public FtpletResult afterCommand(FtpSession session, FtpRequest request, FtpReply reply)
        throws FtpException, IOException {
    FtpletResult retVal = FtpletResult.DEFAULT;
    for (Entry<String, Ftplet> entry : ftplets.entrySet()) {

        retVal = entry.getValue().afterCommand(session, request, reply);
        if (retVal == null) {
            retVal = FtpletResult.DEFAULT;
        }

        // proceed only if the return value is FtpletResult.DEFAULT
        if (retVal != FtpletResult.DEFAULT) {
            break;
        }
    }
    return retVal;
}
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:18,代码来源:DefaultFtpletContainer.java


示例5: beforeCommand

import org.apache.ftpserver.ftplet.FtpletResult; //导入依赖的package包/类
public FtpletResult beforeCommand(FtpSession session, FtpRequest request)
        throws FtpException, IOException {
    FtpletResult retVal = FtpletResult.DEFAULT;
    for (Entry<String, Ftplet> entry : ftplets.entrySet()) {

        retVal = entry.getValue().beforeCommand(session, request);
        if (retVal == null) {
            retVal = FtpletResult.DEFAULT;
        }

        // proceed only if the return value is FtpletResult.DEFAULT
        if (retVal != FtpletResult.DEFAULT) {
            break;
        }
    }
    return retVal;
}
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:18,代码来源:DefaultFtpletContainer.java


示例6: testExceptionDuringDeleteStart

import org.apache.ftpserver.ftplet.FtpletResult; //导入依赖的package包/类
public void testExceptionDuringDeleteStart() throws Exception {
    MockFtplet.callback = new MockFtpletCallback() {
        @Override
        public FtpletResult onDeleteStart(FtpSession session,
                FtpRequest request) throws FtpException, IOException {

            session.write(new DefaultFtpReply(
                    FtpReply.REPLY_450_REQUESTED_FILE_ACTION_NOT_TAKEN,
                    "foo"));
            throwException();
            return mockReturnValue;
        }
    };

    TestUtil.writeDataToFile(TEST_FILE1, TESTDATA);

    client.login(ADMIN_USERNAME, ADMIN_PASSWORD);
    assertFalse(client.deleteFile(TEST_FILE1.getName()));

    assertTrue(TEST_FILE1.exists());
}
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:22,代码来源:FtpLetReturnSkipTest.java


示例7: testExceptionDuringDeleteEnd

import org.apache.ftpserver.ftplet.FtpletResult; //导入依赖的package包/类
public void testExceptionDuringDeleteEnd() throws Exception {
    MockFtplet.callback = new MockFtpletCallback() {
        @Override
        public FtpletResult onDeleteEnd(FtpSession session, FtpRequest request)
                throws FtpException, IOException {
            throwException();
            return mockReturnValue;
        }
    };

    TestUtil.writeDataToFile(TEST_FILE1, TESTDATA);

    client.login(ADMIN_USERNAME, ADMIN_PASSWORD);
    assertTrue(client.deleteFile(TEST_FILE1.getName()));

    assertFalse(TEST_FILE1.exists());
}
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:18,代码来源:FtpLetReturnSkipTest.java


示例8: testExceptionDuringMkdirStart

import org.apache.ftpserver.ftplet.FtpletResult; //导入依赖的package包/类
public void testExceptionDuringMkdirStart() throws Exception {
    MockFtplet.callback = new MockFtpletCallback() {
        @Override
        public FtpletResult onMkdirStart(FtpSession session,
                FtpRequest request) throws FtpException, IOException {

            session.write(new DefaultFtpReply(
                    FtpReply.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "foo"));
            throwException();
            return mockReturnValue;
        }
    };

    client.login(ADMIN_USERNAME, ADMIN_PASSWORD);
    assertFalse(client.makeDirectory(TEST_DIR1.getName()));

    assertFalse(TEST_DIR1.exists());
}
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:19,代码来源:FtpLetReturnSkipTest.java


示例9: testExceptionDuringRmdirStart

import org.apache.ftpserver.ftplet.FtpletResult; //导入依赖的package包/类
public void testExceptionDuringRmdirStart() throws Exception {
    MockFtplet.callback = new MockFtpletCallback() {
        @Override
        public FtpletResult onRmdirStart(FtpSession session,
                FtpRequest request) throws FtpException, IOException {
            session.write(new DefaultFtpReply(
                    FtpReply.REPLY_450_REQUESTED_FILE_ACTION_NOT_TAKEN,
                    "foo"));

            throwException();
            return mockReturnValue;
        }
    };

    TEST_DIR1.mkdirs();

    client.login(ADMIN_USERNAME, ADMIN_PASSWORD);
    assertFalse(client.removeDirectory(TEST_DIR1.getName()));

    assertTrue(TEST_DIR1.exists());
}
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:22,代码来源:FtpLetReturnSkipTest.java


示例10: testExceptionDuringRmdirEnd

import org.apache.ftpserver.ftplet.FtpletResult; //导入依赖的package包/类
public void testExceptionDuringRmdirEnd() throws Exception {
    MockFtplet.callback = new MockFtpletCallback() {
        @Override
        public FtpletResult onRmdirEnd(FtpSession session, FtpRequest request)
                throws FtpException, IOException {
            throwException();
            return mockReturnValue;
        }
    };

    TEST_DIR1.mkdirs();

    client.login(ADMIN_USERNAME, ADMIN_PASSWORD);
    assertTrue(client.removeDirectory(TEST_DIR1.getName()));

    assertFalse(TEST_DIR1.exists());
}
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:18,代码来源:FtpLetReturnSkipTest.java


示例11: testExceptionDuringSite

import org.apache.ftpserver.ftplet.FtpletResult; //导入依赖的package包/类
public void testExceptionDuringSite() throws Exception {
    MockFtplet.callback = new MockFtpletCallback() {
        @Override
        public FtpletResult onSite(FtpSession session, FtpRequest request)
                throws FtpException, IOException {
            session
            .write(new DefaultFtpReply(
                    FtpReply.REPLY_553_REQUESTED_ACTION_NOT_TAKEN_FILE_NAME_NOT_ALLOWED,
                    "foo"));
            
            throwException();
            return mockReturnValue;
        }
    };

    client.login(ADMIN_USERNAME, ADMIN_PASSWORD);

    client.site("HELP");
}
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:20,代码来源:FtpLetReturnSkipTest.java


示例12: testExceptionDuringRenameStart

import org.apache.ftpserver.ftplet.FtpletResult; //导入依赖的package包/类
public void testExceptionDuringRenameStart() throws Exception {
    MockFtplet.callback = new MockFtpletCallback() {
        @Override
        public FtpletResult onRenameStart(FtpSession session,
                FtpRequest request) throws FtpException, IOException {
            session
                    .write(new DefaultFtpReply(
                            FtpReply.REPLY_553_REQUESTED_ACTION_NOT_TAKEN_FILE_NAME_NOT_ALLOWED,
                            "foo"));

            throwException();
            return mockReturnValue;
        }
    };

    TestUtil.writeDataToFile(TEST_FILE1, TESTDATA);

    client.login(ADMIN_USERNAME, ADMIN_PASSWORD);
    assertFalse(client.rename(TEST_FILE1.getName(), TEST_FILE2.getName()));

    assertTrue(TEST_FILE1.exists());
    assertFalse(TEST_FILE2.exists());
}
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:24,代码来源:FtpLetReturnSkipTest.java


示例13: testExceptionDuringRenameEnd

import org.apache.ftpserver.ftplet.FtpletResult; //导入依赖的package包/类
public void testExceptionDuringRenameEnd() throws Exception {
    MockFtplet.callback = new MockFtpletCallback() {
        @Override
        public FtpletResult onRenameEnd(FtpSession session, FtpRequest request)
                throws FtpException, IOException {
            throwException();
            return mockReturnValue;
        }
    };

    TestUtil.writeDataToFile(TEST_FILE1, TESTDATA);

    client.login(ADMIN_USERNAME, ADMIN_PASSWORD);
    assertTrue(client.rename(TEST_FILE1.getName(), TEST_FILE2.getName()));

    assertFalse(TEST_FILE1.exists());
    assertTrue(TEST_FILE2.exists());

}
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:20,代码来源:FtpLetReturnSkipTest.java


示例14: testExceptionDuringDownloadStart

import org.apache.ftpserver.ftplet.FtpletResult; //导入依赖的package包/类
public void testExceptionDuringDownloadStart() throws Exception {
    MockFtplet.callback = new MockFtpletCallback() {
        @Override
        public FtpletResult onDownloadStart(FtpSession session,
                FtpRequest request) throws FtpException, IOException {
            session.write(new DefaultFtpReply(
                    FtpReply.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "foo"));

            throwException();
            return mockReturnValue;
        }
    };

    TestUtil.writeDataToFile(TEST_FILE1, TESTDATA);

    client.login(ADMIN_USERNAME, ADMIN_PASSWORD);
    client.retrieveFileStream(TEST_FILE1.getName());

    assertTrue(FTPReply.isNegativePermanent(client.getReplyCode()));
}
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:21,代码来源:FtpLetReturnSkipTest.java


示例15: testExceptionDuringDownloadEnd

import org.apache.ftpserver.ftplet.FtpletResult; //导入依赖的package包/类
public void testExceptionDuringDownloadEnd() throws Exception {
    MockFtplet.callback = new MockFtpletCallback() {
        @Override
        public FtpletResult onDownloadEnd(FtpSession session,
                FtpRequest request) throws FtpException, IOException {
            throwException();
            return mockReturnValue;
        }
    };

    TestUtil.writeDataToFile(TEST_FILE1, TESTDATA);

    client.login(ADMIN_USERNAME, ADMIN_PASSWORD);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    assertTrue(client.retrieveFile(TEST_FILE1.getName(), baos));

    TestUtil.assertArraysEqual(TESTDATA, baos.toByteArray());
}
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:19,代码来源:FtpLetReturnSkipTest.java


示例16: testExceptionDuringAppendStart

import org.apache.ftpserver.ftplet.FtpletResult; //导入依赖的package包/类
public void testExceptionDuringAppendStart() throws Exception {
    MockFtplet.callback = new MockFtpletCallback() {
        @Override
        public FtpletResult onAppendStart(FtpSession session,
                FtpRequest request) throws FtpException, IOException {
            session.write(new DefaultFtpReply(
                    FtpReply.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "foo"));

            throwException();
            return mockReturnValue;
        }
    };

    TestUtil.writeDataToFile(TEST_FILE1, TESTDATA);

    client.login(ADMIN_USERNAME, ADMIN_PASSWORD);
    assertFalse(client.appendFile(TEST_FILE1.getName(),
            new ByteArrayInputStream(TESTDATA)));

    TestUtil.assertFileEqual(TESTDATA, TEST_FILE1);
}
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:22,代码来源:FtpLetReturnSkipTest.java


示例17: testExceptionDuringAppendEnd

import org.apache.ftpserver.ftplet.FtpletResult; //导入依赖的package包/类
public void testExceptionDuringAppendEnd() throws Exception {
    MockFtplet.callback = new MockFtpletCallback() {
        @Override
        public FtpletResult onAppendEnd(FtpSession session, FtpRequest request)
                throws FtpException, IOException {
            throwException();
            return mockReturnValue;
        }
    };

    TestUtil.writeDataToFile(TEST_FILE1, TESTDATA);

    client.login(ADMIN_USERNAME, ADMIN_PASSWORD);
    assertTrue(client.appendFile(TEST_FILE1.getName(),
            new ByteArrayInputStream(TESTDATA)));

    TestUtil.assertFileEqual(DOUBLE_TESTDATA, TEST_FILE1);
}
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:19,代码来源:FtpLetReturnSkipTest.java


示例18: testExceptionDuringUploadStart

import org.apache.ftpserver.ftplet.FtpletResult; //导入依赖的package包/类
public void testExceptionDuringUploadStart() throws Exception {
    MockFtplet.callback = new MockFtpletCallback() {
        @Override
        public FtpletResult onUploadStart(FtpSession session,
                FtpRequest request) throws FtpException, IOException {
            session.write(new DefaultFtpReply(
                    FtpReply.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "foo"));

            throwException();
            return mockReturnValue;
        }
    };

    client.login(ADMIN_USERNAME, ADMIN_PASSWORD);
    assertFalse(client.storeFile(TEST_FILE1.getName(),
            new ByteArrayInputStream(TESTDATA)));

    assertFalse(TEST_FILE1.exists());
}
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:20,代码来源:FtpLetReturnSkipTest.java


示例19: testExceptionDuringUploadEnd

import org.apache.ftpserver.ftplet.FtpletResult; //导入依赖的package包/类
public void testExceptionDuringUploadEnd() throws Exception {
    MockFtplet.callback = new MockFtpletCallback() {
        @Override
        public FtpletResult onUploadEnd(FtpSession session, FtpRequest request)
                throws FtpException, IOException {
            throwException();
            return mockReturnValue;
        }
    };

    client.login(ADMIN_USERNAME, ADMIN_PASSWORD);
    assertTrue(client.storeFile(TEST_FILE1.getName(),
            new ByteArrayInputStream(TESTDATA)));

    TestUtil.assertFileEqual(TESTDATA, TEST_FILE1);
}
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:17,代码来源:FtpLetReturnSkipTest.java


示例20: testExceptionDuringUploadUniqueStart

import org.apache.ftpserver.ftplet.FtpletResult; //导入依赖的package包/类
public void testExceptionDuringUploadUniqueStart() throws Exception {
    MockFtplet.callback = new MockFtpletCallback() {
        @Override
        public FtpletResult onUploadUniqueStart(FtpSession session,
                FtpRequest request) throws FtpException, IOException {
            session.write(new DefaultFtpReply(
                    FtpReply.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "foo"));
            throwException();
            return mockReturnValue;
        }
    };

    client.login(ADMIN_USERNAME, ADMIN_PASSWORD);
    assertFalse(client.storeUniqueFile(TEST_FILE1.getName(),
            new ByteArrayInputStream(TESTDATA)));

    assertEquals(ROOT_DIR.listFiles().length, 0);
}
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:19,代码来源:FtpLetReturnSkipTest.java



注:本文中的org.apache.ftpserver.ftplet.FtpletResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ValueService类代码示例发布时间:2022-05-23
下一篇:
Java Component类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap