FtpGetContent.java revision 0
1879N/A * Copyright 2001 Sun Microsystems, Inc. All Rights Reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1472N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1472N/A * CA 95054 USA or visit www.sun.com if you need additional information or 1879N/A * @summary URL.getContent() loses first six bytes for ftp URLs 1879N/A * A class that simulates, on a separate, an FTP server. 1879N/A * This Inner class will handle ONE client at a time. 1879N/A * That's where 99% of the protocol handling is done. 1324N/A "NOOP",
"RETR",
"PASV",
"PORT",
"LIST",
"REIN",
0N/A "QUIT",
"STOR",
"NLST",
"RNFR",
"RNTO" };
0N/A * Parses a line to match it with one of the supported FTP commands. 0N/A * Returns the command number. 0N/A * Open the data socket with the client. This can be the 0N/A * result of a "PASV" or "PORT" command. 0N/A * Handles the protocol exchange with the client. 0N/A out.
println(
"425 Can't build data connection: Connection refused.");
0N/A pout.
println(
"drwxrwxrwx 2 jladen staff 117 Mar 30 18:18 .removable");
0N/A out.
println(
"425 Can't build data connection: Connection refused.");
0N/A out.
println(
"425 Can't build data connection: Connection refused.");
0N/A * A way to tell the server that it can stop. 0N/A * All we got to do here is create a ServerSocket and wait for connections. 0N/A * When a connection happens, we just have to create a thread that will 0N/A // Now let's check the URL handler