ftpstore.java

来自「这是linux下ssl vpn的实现程序」· Java 代码 · 共 36 行

JAVA
36
字号
package com.sslexplorer.vfs.store.ftp;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.sslexplorer.security.SessionInfo;
import com.sslexplorer.vfs.NetworkPlace;
import com.sslexplorer.vfs.store.cifs.CIFSMount;
import com.sslexplorer.vfs.utils.URI;
import com.sslexplorer.vfs.utils.URI.MalformedURIException;
import com.sslexplorer.vfs.webdav.AbstractNetworkPlaceMount;
import com.sslexplorer.vfs.webdav.AbstractNetworkPlaceStore;

public class FTPStore extends AbstractNetworkPlaceStore {
    final static Log log = LogFactory.getLog(FTPStore.class);
    
    public FTPStore() {
        super("ftp", "UTF-8");
    }

    public String validateUserEnteredPath(String path) throws IllegalArgumentException {
		try {
			URI uri = new URI(path);
			if (uri.getScheme().equals("ftp") && !uri.getSchemeSpecificPart().startsWith("\\")){
				return uri.getScheme();
			}
		} 
		catch (MalformedURIException e) {
		}
        throw new IllegalArgumentException();
	}

    protected AbstractNetworkPlaceMount createMount(NetworkPlace networkPlace, SessionInfo session) throws Exception {
        return new CIFSMount(networkPlace, this);
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?