Re: Error with using Adde server in a Java Applet

Don Murray wrote:

> Hi Helen-
>
> Helen Yi wrote:
> > Hi,
> >
> > I am trying to use Java Applet from the web browser to query the remote
> > image objects from the remote ADDE  server.
> > But  I got the following error message:
> >
> > Error openning connection: java.net.MalformedURLException: unknown
> > protocol: adde
> >
> > I have added a static block to load protocol for ADDE URL at the
> > beginning of my Applet code.
>
> What does this code look like?

It Looks like he following

    // load protocol for ADDE URLs
    // See java.net.URL for explanation of URL handling
    static
    {
        try
        {
            String handlers
System.getProperty("java.protocol.handler.pkgs");
            String newProperty = null;
            if (handlers == null)
                newProperty = "edu.wisc.ssec.mcidas";
            else if (handlers.indexOf("edu.wisc.ssec.mcidas") < 0)
                newProperty = "edu.wisc.ssec.mcidas | " + handlers;
            if (newProperty != null)  // was set above
                System.setProperty("java.protocol.handler.pkgs",
newProperty);
            System.out.println(
                "Able to set System Property: java.protocol.handler.pkgs
"+handlers + newProperty);
        }
        catch (Exception e)
        {
            System.out.println(
                "Unable to set System Property:
java.protocol.handler.pkgs");
        }
    }


>
>
> > Thanks for your help.
>
> I've never been able to use ADDE from an applet because
> the SecurityManager in the browser didn't allow one
> to add in a new URLStreamHandler.  I haven't
> revisited this in a couple of years, so maybe some
> things have changed (but I doubt it ;-().  Maybe
> Tom Whittaker has more input on this.
>
> Don
> *************************************************************
> Don Murray                               UCAR Unidata Program
> dmurray@xxxxxxxxxxxxxxxx                        P.O. Box 3000
> (303) 497-8628                              Boulder, CO 80307
> http://www.unidata.ucar.edu/staff/donm
> *************************************************************


  • 2003 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: