This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Security exception when using resource-url in an applet


Yeah, that's strange. In what way did it fail?

I just grabbed the latest kawa from svn, and changed
ResourceStreamHandler.makeURL to:

  public static URL makeURL (Class clas)
    throws java.net.MalformedURLException
  {
    String cname = clas.getName();
    return clas.getResource("applettest.class");
  }

and it worked fine, ie. (module-uri) had no exceptions, and returned the
path to applettest.class, and (resource-url filename) returns the path to a
file in the .jar file. This is when calling both of these from
applettest.scm.

I tested by compiling with --applet, putting the resulting class files into
a .jar file, then running via a .html file and appletviewer. This is the
.html file:

<html>
<head><title>Applettest</title></head>
<body>
<applet code="applettest.class" archive="applettest.jar, kawa.jar" width=400
height=300>
Sorry, Java is needed.
</applet>
</body>
</html>


On 6/9/10 3:51 PM, "Per Bothner" <per@bothner.com> wrote:

> On 06/08/2010 02:20 AM, alex mitchell wrote:
>> I had tried creating a more generalized version, working in scheme rather
>> than java, but kept getting errors saying that getResource was not a method.
> 
> In colon notation if CLASS is a Class then CLASS:M refers to the static
> member of CLASS, rather than an instance method of java.lang.Class.
> So in this case you need to use the invoke syntax:
>    (invoke CLASS 'getResource "foo")
> 
> What's weird is that this works:
>   (invoke ((this):getClass) 'getResource "applettest.class")
> when written directly in the applet, but modifying
> ResourceStreamHandler.makeURL to:
>    return clas.getResource("applettest.class")
> fails.
> 
> I'm rather puzzled by what could be causing this.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]