Have you ever done any work connecting with an FTP URL? I'm trying to do
something with URLClassLoader to load code from an FTP site using
username-password semantics, and Sun's implementation appears (as far as I
can tell) to have a bug in it.

According to the RFC on URLs, specifying a user/password to an FTP url
should look like this:

ftp://username:[EMAIL PROTECTED]/directory/directory/file

Unfortunately, Sun's implementation appears to find the colon between
"username" and "password", and thinks the rest of the string is a port,
which it obviously isn't.

I wrote the following test class:

import java.net.URL;
import java.net.URLClassLoader;

public class FTPURLClient
{
    /**
     * Attempt to instantiate an instance of the class
     * com.javageeks.util.Hello, found only on the javageeks.com
     * FTP server in the "examples" directory.
     */
    public static void main(String[] args)
        throws Exception
    {
        URL[] urlArray =
        {
            new URL("ftp", "reader:[EMAIL PROTECTED]",
                    "/examples/")   // using 'reader' account
        };

        System.out.println(urlArray[0].toString());

        URLClassLoader ucl = new URLClassLoader(urlArray);
        Object obj =
            ucl.loadClass("com.javageeks.util.Hello").newInstance();

        // Hello should print "Hello from JavaGeeks.com!" to the
        // System.out stream
    }
}

And (presuming I know how to set up my FTP server to respond with classes) I
still get failures. Any ideas/thoughts?

Ted Neward
Patterns/C++/Java/CORBA/EJB/COM-DCOM spoken here
http://www.javageeks.com/~tneward
 "I don't even speak for myself; my wife won't let me." --Me

-----Original Message-----
From: Kevin Jones <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Tuesday, June 29, 1999 12:22 AM
Subject: Re: URL


>The URL class parses the url it is passed and tries to create a protocol
>handler object for the given protocol (https in this case). The JVM ships
>with protocol handlers for http, ftp, file, gopher, jar, mailto, netdoc,
>systemresource and verbatim (don't know what the last three are) as part of
>the sun.net.www.protocol package. By default there is no https handler (by
>default) - however you can write your own protocol handlers and add them to
>this list - I've written a 'time' handler to show how this works if you are
>interested,
>
>Kevin
>
>-----Original Message-----
>From: A mailing list for discussion about Sun Microsystem's Java Servlet
>API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
>Xizhen Wang
>Sent: 28 June 1999 08:43
>To: [EMAIL PROTECTED]
>Subject: URL
>
>
>Hi! All,
>
>If I use
>URL url = new URL("https://127.0.0.1");
>does it mean the the program will use HTTPS?
>
>If not, is there a way to make the URLConnection a HTTPS connection? (or
>at least encrypted in other ways)
>
>Thanks!
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to