[
https://jira.jboss.org/jira/browse/JBESB-3312?page=com.atlassian.jira.plu...
]
jarkko Lietolahti commented on JBESB-3312:
------------------------------------------
Index: rosetta/src/org/jboss/internal/soa/esb/util/FtpImpl.java
===================================================================
--- rosetta/src/org/jboss/internal/soa/esb/util/FtpImpl.java (revision 13)
+++ rosetta/src/org/jboss/internal/soa/esb/util/FtpImpl.java (working copy)
@@ -80,6 +80,8 @@
private String m_sRemoteDir, m_sLocalDir;
private int renameRetry;
+
+ private String m_ControlChannelEncoding;
/**
* Checks validity and completeness of parameters, and keeps the info
@@ -185,6 +187,9 @@
}
else
_timeout = 0;
+
+ this.m_ControlChannelEncoding = m_oEpr.getControlChannelEncoding();
+
}
public FtpImpl (List<KeyValuePair> p_oAttribs, boolean p_bConnect)
@@ -283,6 +288,9 @@
.toString(false));
m_oParms.setAttribute(RemoteFileSystem.PARMS_PASSIVE, Boolean
.toString(m_bPassive));
+
+
m_oParms.setAttribute(RemoteFileSystem.PARMS_CONTROL_CHANNEL_ENCODING,
this.m_ControlChannelEncoding);
+
}
catch (Exception e)
{
@@ -406,6 +414,10 @@
checkParms();
m_oConn = instantiateClient() ;
+ if( m_ControlChannelEncoding != null ) {
+ m_oConn.setControlEncoding(this.m_ControlChannelEncoding);
+ }
+
if (bConnect)
{
try
Index: rosetta/src/org/jboss/soa/esb/util/RemoteFileSystem.java
===================================================================
--- rosetta/src/org/jboss/soa/esb/util/RemoteFileSystem.java (revision 13)
+++ rosetta/src/org/jboss/soa/esb/util/RemoteFileSystem.java (working copy)
@@ -61,6 +61,8 @@
public static final int DEFAULT_RENAME_RETRY_NUMBER = 10; // default retries
public static final int DEFAULT_RENAME_RETRY_TIMEOUT = 1000; // 1 second
+
+ public static final String PARMS_CONTROL_CHANNEL_ENCODING =
"ftpControlChannelEncoding";
public String getRemoteDir ();
Index: rosetta/src/org/jboss/soa/esb/addressing/eprs/FTPEpr.java
===================================================================
--- rosetta/src/org/jboss/soa/esb/addressing/eprs/FTPEpr.java (revision 13)
+++ rosetta/src/org/jboss/soa/esb/addressing/eprs/FTPEpr.java (working copy)
@@ -21,7 +21,6 @@
* @author mark.little(a)jboss.com
*/
-
/**
* This class represents the endpoint reference for services.
*/
@@ -42,253 +41,238 @@
* that as much as possible.
*
* @author marklittle
- *
+ *
*/
-public class FTPEpr extends FileEpr
-{
+public class FTPEpr extends FileEpr {
public static final String USERNAME_TAG = "username";
public static final String PASSWORD_TAG = "password";
public static final String PASSIVE_TAG = "passive";
-
- public FTPEpr (EPR epr)
- {
+ public static final String CONTROL_CHANNEL_ENCODING_TAG =
"controlChannelEncoding";
+
+ public FTPEpr(EPR epr) {
super(epr);
-
- if (epr instanceof FTPEpr)
- {
- FTPEpr instance = (FTPEpr) epr;
-
- passwordSet = instance.passwordSet;
- userSet = instance.userSet;
- passiveSet = instance.passiveSet;
+
+ if (epr instanceof FTPEpr) {
+ FTPEpr instance = (FTPEpr) epr;
+
+ passwordSet = instance.passwordSet;
+ userSet = instance.userSet;
+ passiveSet = instance.passiveSet;
}
}
-
- public FTPEpr (EPR epr, Element header)
- {
+
+ public FTPEpr(EPR epr, Element header) {
super(epr, header);
-
+
NodeList nl = header.getChildNodes();
- for (int i = 0; i < nl.getLength(); i++)
- {
- try
- {
+ for (int i = 0; i < nl.getLength(); i++) {
+ try {
String prefix = nl.item(i).getPrefix();
String tag = nl.item(i).getLocalName();
-
- if ((prefix != null) && (prefix.equals(XMLUtil.JBOSSESB_PREFIX)))
- {
- if (tag != null)
- {
+
+ if ((prefix != null) && (prefix.equals(XMLUtil.JBOSSESB_PREFIX))) {
+ if (tag != null) {
if (tag.equals(USERNAME_TAG))
- setUserName(nl.item(i).getTextContent());
- else
- {
+ setUserName(nl.item(i).getTextContent());
+ else {
if (tag.equals(PASSWORD_TAG))
- setPassword(nl.item(i).getTextContent());
- else
- {
- if (tag.equals(PASSIVE_TAG))
- {
- String content = nl.item(i).getTextContent();
-
- if ("true".equalsIgnoreCase(content))
- setPassive(true);
- else
- {
- if ("false".equalsIgnoreCase(content))
- setPassive(false);
- }
+ setPassword(nl.item(i).getTextContent());
+ else {
+ if (tag.equals(PASSIVE_TAG)) {
+ String content = nl.item(i).getTextContent();
+
+ if ("true".equalsIgnoreCase(content))
+ setPassive(true);
+ else {
+ if ("false".equalsIgnoreCase(content))
+ setPassive(false);
+ }
}
}
}
}
}
- }
- catch (Exception ex)
- {
+ } catch (Exception ex) {
ex.printStackTrace();
}
}
}
-
+
/**
* Construct the FTP EPR with the specified URL.
+ *
* @param url
* @throws URISyntaxException
* @deprecated
*/
- public FTPEpr (URL url) throws URISyntaxException
- {
+ public FTPEpr(URL url) throws URISyntaxException {
this(url.toURI());
}
- /**
- * Construct the FTP EPR with the specified URI.
- * @param uri
- * @throws URISyntaxException
- */
- public FTPEpr (URI uri)
- {
- super(uri);
- }
+ /**
+ * Construct the FTP EPR with the specified URI.
+ *
+ * @param uri
+ * @throws URISyntaxException
+ */
+ public FTPEpr(URI uri) {
+ super(uri);
+ }
- public FTPEpr (String url) throws URISyntaxException
- {
+ public FTPEpr(String url) throws URISyntaxException {
super(new URI(url));
}
/**
* Set the URL for this endpoint.
*
- * @param url the address.
+ * @param url
+ * the address.
* @deprecated
*/
-
- public final void setURL (URL url)
- {
+
+ public final void setURL(URL url) {
super.setAddr(new PortReference(url.toString()));
}
-
+
/**
* Get the URL address.
*
* @return the address.
* @deprecated
*/
-
- public final URL getURL ()
- {
- try
- {
- return new URL(super.getAddr().getAddress());
- }
- catch (Exception ex)
- {
- _logger.warn("Unexpected parsing exception!", ex);
-
- return null;
- }
+
+ public final URL getURL() {
+ try {
+ return new URL(super.getAddr().getAddress());
+ } catch (Exception ex) {
+ _logger.warn("Unexpected parsing exception!", ex);
+
+ return null;
+ }
}
/**
* Set the username for this FTP EPR. In case it cannot be put in the URL.
*
- * @param username the user's name.
- * @throws URISyntaxException thrown if this EPR is malformed.
+ * @param username
+ * the user's name.
+ * @throws URISyntaxException
+ * thrown if this EPR is malformed.
*/
-
- public final void setUserName (String username) throws URISyntaxException
- {
+
+ public final void setUserName(String username) throws URISyntaxException {
if (username == null)
throw new IllegalArgumentException();
-
+
if (userSet)
throw new IllegalStateException("Username already set.");
-
+
getAddr().addExtension(USERNAME_TAG, username);
userSet = true;
}
-
+
/**
* @return the user's name associated with this EPR.
*/
-
- public final String getUserName ()
- {
+
+ public final String getUserName() {
return getAddr().getExtensionValue(USERNAME_TAG);
}
-
+
/**
* Set the password for this FTP EPR.
*
- * @param password the user's name.
- * @throws URISyntaxException thrown if this EPR is malformed.
+ * @param password
+ * the user's name.
+ * @throws URISyntaxException
+ * thrown if this EPR is malformed.
*/
-
- public final void setPassword (String password) throws URISyntaxException
- {
+
+ public final void setPassword(String password) throws URISyntaxException {
if (password == null)
throw new IllegalArgumentException();
-
+
if (passwordSet)
throw new IllegalStateException("Cannot change password");
-
+
getAddr().addExtension(PASSWORD_TAG, password);
passwordSet = true;
}
-
+
/**
* @return the password associated with this EPR.
*/
-
- public final String getPassword ()
- {
+
+ public final String getPassword() {
return getAddr().getExtensionValue(PASSWORD_TAG);
}
-
+
/**
* Passive FTP?
*
- * @param passive the value.
- * @throws URISyntaxException thrown if this EPR is malformed.
+ * @param passive
+ * the value.
+ * @throws URISyntaxException
+ * thrown if this EPR is malformed.
*/
-
- public final void setPassive (boolean passive) throws URISyntaxException
- {
+
+ public final void setPassive(boolean passive) throws URISyntaxException {
if (passiveSet)
throw new IllegalStateException("Cannot change passive");
-
+
if (passive)
getAddr().addExtension(PASSIVE_TAG, "true");
else
getAddr().addExtension(PASSIVE_TAG, "false");
-
+
passiveSet = true;
}
-
+
/**
* @return the passive value associated with this EPR.
*/
-
- public final boolean getPassive ()
- {
+
+ public final boolean getPassive() {
return "true".equals(getAddr().getExtensionValue(PASSIVE_TAG));
}
-
- public String toString ()
- {
- return "FTPEpr [ "+super.getAddr().extendedToString()+" ]";
+
+ public String toString() {
+ return "FTPEpr [ " + super.getAddr().extendedToString() + " ]";
}
- public EPR copy ()
- {
- return new FTPEpr(this);
+ public EPR copy() {
+ return new FTPEpr(this);
}
-
- public static URI type ()
- {
- return _type;
+
+ public static URI type() {
+ return _type;
}
private boolean passwordSet = false;
private boolean userSet = false;
private boolean passiveSet = false;
-
+ private String ctrlChannelEncoding;
+
private static URI _type;
-
- static
- {
- try
- {
- _type = new URI("urn:jboss/esb/epr/type/ftp");
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
-
- throw new ExceptionInInitializerError(ex.toString());
+
+ static {
+ try {
+ _type = new URI("urn:jboss/esb/epr/type/ftp");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+
+ throw new ExceptionInInitializerError(ex.toString());
}
}
+
+ public void setControlChannelEncoding(String ctrlChannelEncoding) {
+ this.ctrlChannelEncoding = ctrlChannelEncoding;
+
+ }
+
+ public String getControlChannelEncoding() {
+ return this.ctrlChannelEncoding;
+ }
}
\ No newline at end of file
Index: rosetta/src/org/jboss/soa/esb/listeners/ListenerUtil.java
===================================================================
--- rosetta/src/org/jboss/soa/esb/listeners/ListenerUtil.java (revision 13)
+++ rosetta/src/org/jboss/soa/esb/listeners/ListenerUtil.java (working copy)
@@ -323,6 +323,11 @@
FTPEpr ftp = (FTPEpr) epr;
ftp.setPassive(Boolean.valueOf(getAttrAndWarn(tree,
FTPEpr.PASSIVE_TAG, "false")));
+
+ // ADDED BY JLI 10.5.2010 to support setting ftp's control channel encoding
+ String ctrlChannelEncoding= getAttrAndWarn(tree, FTPEpr.CONTROL_CHANNEL_ENCODING_TAG,
"UTF-8");
+ ftp.setControlChannelEncoding( ctrlChannelEncoding );
+
}
return epr;
}
Configure FTP's control channel encoding
----------------------------------------
Key: JBESB-3312
URL:
https://jira.jboss.org/jira/browse/JBESB-3312
Project: JBoss ESB
Issue Type: Feature Request
Security Level: Public(Everyone can see)
Affects Versions: 4.8
Reporter: jarkko Lietolahti
Currently there's no way to configure the encoding of FTP's control channel.
There're cases where this is required for correct action. Like sending files which
have non-ascii characters in filenames.
The required functionality is there in Apache Commons NET, but there's no way to
relay proper configuration to it.
http://commons.apache.org/net/api/org/apache/commons/net/ftp/FTP.html#set...
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira