当前位置: 首页>>代码示例>>Java>>正文


Java FtpException.printStackTrace方法代码示例

本文整理汇总了Java中org.apache.ftpserver.ftplet.FtpException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java FtpException.printStackTrace方法的具体用法?Java FtpException.printStackTrace怎么用?Java FtpException.printStackTrace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.ftpserver.ftplet.FtpException的用法示例。


在下文中一共展示了FtpException.printStackTrace方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addUser

import org.apache.ftpserver.ftplet.FtpException; //导入方法依赖的package包/类
public void addUser(String name, String pass, String directory, boolean canWrite) {
    BaseUser user = new BaseUser();
    user.setName(name);
    user.setPassword(pass);

    //String root = ProjectManager.getInstance().getCurrentProject().getStoragePath() + "/" + directory;
    user.setHomeDirectory(directory);

    //check if user can write
    if (canWrite) {
        List<Authority> auths = new ArrayList<Authority>();
        Authority auth = new WritePermission();
        auths.add(auth);
        user.setAuthorities(auths);
    }

    try {
        um.save(user);
    } catch (FtpException e) {
        e.printStackTrace();
    }

}
 
开发者ID:victordiaz,项目名称:phonk,代码行数:24,代码来源:PFtpServer.java

示例2: start

import org.apache.ftpserver.ftplet.FtpException; //导入方法依赖的package包/类
public void start() {
    FtpServerFactory serverFactory = new FtpServerFactory();
    ListenerFactory factory = new ListenerFactory();
    factory.setPort(mPort);

    // replace the default listener
    serverFactory.addListener("default", factory.createListener());
    serverFactory.setUserManager(um);

    Map ftpLets = new HashMap<>();
    ftpLets.put("ftpLet", new CallbackFTP(mCallback));


    serverFactory.setFtplets(ftpLets);

    // start the server
    try {
        server = serverFactory.createServer();
        server.start();
        MLog.d(TAG, "server started");
    } catch (FtpException e) {
        e.printStackTrace();
        MLog.d(TAG, "server not started");
    }
}
 
开发者ID:victordiaz,项目名称:phonk,代码行数:26,代码来源:PFtpServer.java

示例3: startServer

import org.apache.ftpserver.ftplet.FtpException; //导入方法依赖的package包/类
/**
 * Start the FTP server.
 */
public void startServer() {
    //Set the user factory
    PropertiesUserManagerFactory userManagerFactory = new PropertiesUserManagerFactory();
    String filename = mContext.getExternalCacheDir().getAbsolutePath() + "/users.properties";
    File files = new File(filename);
    userManagerFactory.setFile(files);

    //Set the server factory
    FtpServerFactory serverFactory = new FtpServerFactory();
    serverFactory.setUserManager(userManagerFactory.createUserManager());

    //Set the port number
    ListenerFactory factory = new ListenerFactory();
    factory.setPort(PORT_NUMBER);
    try {
        serverFactory.addListener("default", factory.createListener());
        FtpServer server = serverFactory.createServer();
        mFtpServer = server;

        //Start the server
        server.start();
    } catch (FtpException e) {
        e.printStackTrace();
    }

    Log.d(TAG, "onCreate: FTP server started. IP address: " + getLocalIpAddress() + " and Port:" + PORT_NUMBER);
}
 
开发者ID:kevalpatel2106,项目名称:remote-storage-android-things,代码行数:31,代码来源:FTPManager.java

示例4: Config2

import org.apache.ftpserver.ftplet.FtpException; //导入方法依赖的package包/类
void Config2() {
//		Now, let's make it possible for a client to use FTPS (FTP over SSL) for the default listener.


        FtpServerFactory serverFactory = new FtpServerFactory();

        ListenerFactory factory = new ListenerFactory();

        // set the port of the listener
        factory.setPort(2221);

        // define SSL configuration
        SslConfigurationFactory ssl = new SslConfigurationFactory();
        ssl.setKeystoreFile(new File(ftpConfigDir + "ftpserver.jks"));
        ssl.setKeystorePassword("password");

        // set the SSL configuration for the listener
        factory.setSslConfiguration(ssl.createSslConfiguration());
        factory.setImplicitSsl(true);

        // replace the default listener
        serverFactory.addListener("default", factory.createListener());

        PropertiesUserManagerFactory userManagerFactory = new PropertiesUserManagerFactory();
        userManagerFactory.setFile(new File(ftpConfigDir + "users.properties"));

        serverFactory.setUserManager(userManagerFactory.createUserManager());

        // start the server
        FtpServer server = serverFactory.createServer();
        this.mFtpServer = server;
        try {
            server.start();
        } catch (FtpException e) {
            e.printStackTrace();
        }
    }
 
开发者ID:lucky-code,项目名称:Practice,代码行数:38,代码来源:FtpActivity.java

示例5: setFtpEnv

import org.apache.ftpserver.ftplet.FtpException; //导入方法依赖的package包/类
private void setFtpEnv() {
	serverFactory = new FtpServerFactory();
	factory = new ListenerFactory();

	// set the port of the listener
	factory.setPort(port);

	// define SSL configuration
	// SslConfigurationFactory ssl = new SslConfigurationFactory();
	// ssl.setKeystoreFile(new File("ftpserver.jks"));
	// ssl.setKeystorePassword("password");

	// set the SSL configuration for the listener
	// factory.setSslConfiguration(ssl.createSslConfiguration());
	// factory.setImplicitSsl(true);

	// replace the default listener
	serverFactory.addListener("default", factory.createListener());

	List<Authority> auths = new ArrayList<Authority>();
	Authority auth = new WritePermission();
	auths.add(auth);

	try {
		appendUser("peerless", "peerless", "ftphome", true, auths);
		appendUser("hwlee", "hwlee", "ftphome", true, auths);
	} catch (FtpException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

	/*
	 * user.setName("hwlee"); user.setPassword("hwlee");
	 * user.setHomeDirectory("ftphome"); user.setEnabled(true);
	 * user.setAuthorities(auths);
	 */

	serverFactory.setUserManager(userManagerFactory.createUserManager());
	server = serverFactory.createServer();
}
 
开发者ID:knowpd,项目名称:p2p-file-sharing-system,代码行数:41,代码来源:PeerlessFtpServerSupport.java

示例6: main

import org.apache.ftpserver.ftplet.FtpException; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
	   PeerlessFtpServerSupport ser = new PeerlessFtpServerSupport(2221);
        
		try {
			ser.startServer();
		} catch (FtpException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
        
        
}
 
开发者ID:knowpd,项目名称:p2p-file-sharing-system,代码行数:13,代码来源:PeerlessFtpServerSupport.java


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