Community
Participate
Working Groups
Hello All, I am working with Eclipse eclipse-FTP-WebDAV-3.1 plug-in. I wish to know the target FTP server OS (Windows / Unix / Linux) based on this information my utility should auto-format subsequent commands and arguments. FTP protocol specifies command “SYST” for this purpose, which typically responds (for e.g. if FTP server is on Unix) as: > UNIX Type: L8 I could not find similar functionality in Eclipse FTP plug-in to use. While debugging with FTP plug-in source for this problem, observed that plug-in has no support (method) to query this information from the FTP server. Now, to deal with this short-coming of FTP plug-in, a method could be added to org.eclipse.ftp.IClient.java class, like: public abstract String getSystemDetails(IProgressMonitor monitor) throws FtpException; And in the FTP client implementation, this method should return the response for command “SYST”. A sample implementation for this method in org.eclipse.ftp.internal.FTPClient.java class could be: //------------------------- Get system details --------------// /** * Lists the FTP server's platform details. * @param monitor the progress monitor, or null * @return String with return code 215 and system details like Windows / Unix or null if error. */ public String getSystemDetails(IProgressMonitor monitor) throws FtpException { monitor = FtpPlugin.monitorFor(monitor); monitor.beginTask(null, 100); monitor.subTask("system details..."); //$NON-NLS-1$ String retResponse = null; try { sendCommand("SYST", null); //$NON-NLS-1$ monitor.worked(50); switch (readResponseSkip100()) { case 215: // SYST response ok retResponse = responseText; break; default: defaultResponseHandler(); } monitor.worked(50); } finally { monitor.done(); } return retResponse; } //------------------------- Get system details --------------// And slight modification to existing method org.eclipse.ftp.internal.FTPClient.handleDataTransferCompletion() should be (case 215 => response code for “SYST” command): private boolean handleDataTransferCompletion() throws FtpException { boolean success = false; if (expectDataTransferCompletion) { // set the flag to false so the call to readResponseSkip100() will not recurse infinitely expectDataTransferCompletion = false; switch (readResponseSkip100()) { case 226: // closing data connection (file transfer or abort) case 250: // requested file action okay, completed case 215: // Response of SYST, okey success = true; break; default: defaultResponseHandler(); } } return success; } Hope to see this enhancement in future release / versions of FTP and WebDAV plugin. Best Regards, Ashish Billore
We would be happy to add this functionality to the client but would appreciate it if you gave us the change in patch format. To create a patch, you will need to load the ftp plugin from the repository. The instructions to do so are found here: http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-vcm-home/plugins/target/target-project-sets/readme.html After youload the plugin, you can modify it and then choose Team>Create Patch from the context menu. Same the patch to a file and attach it to this bug report. Please reopen the bug as well.
Created attachment 44925 [details] "SYST_patch.txt" containing the modifications suggested for this Bug. Attaching "SYST_patch.txt" containing the modifications suggested for this Bug.
Attached "SYST_patch.txt" containing the modifications suggested for this Bug.
Patch released. Thanks.
I've added the following copyright to the modified files. Let me know if it should be something different: Ashish Billore (ashish.billore@gxs.com) - Bug 147839 [FTP] eclipse FTP WebDAV plugin does not provide FTP server details (OS type)