List of usage examples for org.apache.commons.net.ftp FTPReply SYSTEM_STATUS
int SYSTEM_STATUS
To view the source code for org.apache.commons.net.ftp FTPReply SYSTEM_STATUS.
Click Source Link
From source file:com.sos.VirtualFileSystem.FTP.SOSVfsFtpBaseClass.java
/** * Performs some post-login operations, such trying to detect server support * for utf8.// w ww . j a v a 2 s . c o m * */ @Override public void doPostLoginOperations() { // synchronized (lock) { if (objOptions.CheckServerFeatures.value() == true) { // JIRA SOSFTP-92 sendCommand("FEAT"); if (objFTPReply.getCode() == FTPReply.SYSTEM_STATUS) { String[] lines = objFTPReply.getMessages(); for (int i = 1; i < lines.length - 1; i++) { String feat = lines[i].trim().toUpperCase(); // REST STREAM supported? if ("REST STREAM".equalsIgnoreCase(feat)) { restSupported = true; continue; } // UTF8 supported? if ("UTF8".equalsIgnoreCase(feat)) { utf8Supported = true; Client().setControlEncoding("UTF-8"); continue; } // MLSD supported? if ("MLSD".equalsIgnoreCase(feat)) { mlsdSupported = true; continue; } // MODE Z supported? if ("MODE Z".equalsIgnoreCase(feat) || feat.startsWith("MODE Z ")) { modezSupported = true; continue; } } } else { logger.info("no valid response for FEAT command received: " + objFTPReply.toString()); } // Turn UTF 8 on (if supported). if (utf8Supported) { sendCommand("OPTS UTF8 ON"); } // Data channel security. // if (security == SECURITY_FTPS || security == SECURITY_FTPES) { // Client().sendCommand("PBSZ 0"); // LogReply(); // Client().sendCommand("PROT P"); // LogReply(); // // if (objFTPReply.isSuccessCode()) { // dataChannelEncrypted = true; // } // } sendCommand("NOOP"); // to clear the reply string } }
From source file:org.apache.maven.wagon.providers.ftp.FtpWagon.java
public boolean resourceExists(String resourceName) throws TransferFailedException, AuthorizationException { Resource resource = new Resource(resourceName); try {// w ww . java 2 s . c o m ftpChangeDirectory(resource); String filename = PathUtils.filename(resource.getName()); int status = ftp.stat(filename); return ((status == FTPReply.FILE_STATUS) || (status == FTPReply.DIRECTORY_STATUS) || (status == FTPReply.FILE_STATUS_OK) // not in the RFC but used by some FTP servers || (status == FTPReply.COMMAND_OK) // not in the RFC but used by some FTP servers || (status == FTPReply.SYSTEM_STATUS)); } catch (IOException e) { throw new TransferFailedException("Error transferring file via FTP", e); } catch (ResourceDoesNotExistException e) { return false; } }