INT-2477 allow control encoding to be set

INT-2477 added tests

Polishing - Spring Standard tabs Vs. spaces, formatting
This commit is contained in:
Shane Witbeck
2012-03-23 22:42:58 -04:00
committed by Gary Russell
parent 6975da83da
commit 175bc8554c
2 changed files with 41 additions and 1 deletions

View File

@@ -54,13 +54,15 @@ public abstract class AbstractFtpSessionFactory<T extends FTPClient> implements
protected String password;
protected int port = FTP.DEFAULT_PORT;
protected int bufferSize = 2048; //see https://issues.apache.org/jira/browse/NET-207
protected int clientMode = FTPClient.ACTIVE_LOCAL_DATA_CONNECTION_MODE;
protected int fileType = FTP.BINARY_FILE_TYPE;
protected String controlEncoding = FTP.DEFAULT_CONTROL_ENCODING;
/**
* File types defined by {@link org.apache.commons.net.ftp.FTP} constants:
@@ -76,6 +78,11 @@ public abstract class AbstractFtpSessionFactory<T extends FTPClient> implements
this.fileType = fileType;
}
public void setControlEncoding(String controlEncoding) {
Assert.hasText(controlEncoding);
this.controlEncoding = controlEncoding;
}
public void setConfig(FTPClientConfig config) {
Assert.notNull(config);
this.config = config;
@@ -161,6 +168,7 @@ public abstract class AbstractFtpSessionFactory<T extends FTPClient> implements
this.updateClientMode(client);
client.setFileType(fileType);
client.setBufferSize(bufferSize);
client.setControlEncoding(controlEncoding);
return client;
}