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


Hmm. I did the following as a work-around to get the url. I created a new
java file, geturl.java, containing the following code:

import java.net.*;
import java.lang.*;

// this is a hack to get the URL of files inside the jar file,
// should try to generalize
public class geturl extends java.lang.Object
{
    public geturl(){
    }
    
    public URL geturl() {
        return this.getClass().getResource("geturl.class");
    }
}

In my scheme code, I required this class, then did:

; loading from .jar file
(let* ((the-URL ((<geturl>):geturl))
       ; path into the jar file
       (the-jar-path (path-parent the-URL))
       ; the file, assuming its in the .jar
       (the-file-path (path (string-append the-jar-path in-filename))))
  ; this proc contains my code to open the file using open-input-file
  (doreaderopen-file the-file-path))

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.

Alex

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

> On 06/07/2010 07:44 PM, alex mitchell wrote:
>>> The easiest fix wouldbe to just change module-uri for class
>>> FOO to do FOO.class.getResource("FOO.class").  I'm not sure
>>> what the downsides of that would be - I need to remind myself
>>> why I implemented the class-resource: URL scheme.
> 
> I tried changing gnu.text.ResourceStreamHandler.makeURL to:
>    return clas.getResource("/"+clas.getName()+".class");
> and variations of that idea, but it doesn't seem to work,
> and I don't know why.



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