Loading texture problem while using certificate

Started by Tornado7, June 04, 2004, 05:20:48 PM

Previous topic - Next topic

Tornado7

Hi Egon,

I've to improve my applet defining a config file where someone can decide what world or another object to load without handling java's code... I've created a config file and I've added this code to my applet:

   String line;
   String worldValue;
   String tempFile;
   char checkStart;
   File f = null;
   BufferedReader br = null;
   
   
   public void init() {

 
      tempFile="ThreeDSim.cfg";
      f = new File(tempFile);
     
      try{
     
          br = new BufferedReader(new FileReader(f));
         
      }catch(FileNotFoundException fnfe){
        System.out.println("File not found...");        
        fnfe.printStackTrace();
       
       }
       
      try {
         while ((line = br.readLine()) != null) {

         if (line.length()>0) {
           checkStart = line.charAt(0);
   
                 if (checkStart != '*') {
                 
             if (line.startsWith("world")) {
               worldValue=line.substring(6);
                   }
                   
               }
     
           }

   }
 
      } catch (IOException e) {
  e.printStackTrace();
        }

.
.
.


Obviously, when I open my html page the applet doesn't load because I'm trying to access a file in an applet context. So, I've defined a certificate to let the applet to access the file.... using the certificate I can now access the file and reading informations without problems.... But, the problem now is that no texture is visible in my applet (as you know, I'm loading texture one by one in this way:texMan.addTexture("car1.jpg",new Texture(getDocumentBase(),"textures/car1.jpg"));). If is remove the certificate, textures become visible.... but I can't access the file.... There's an explanation for this behaviour?

Bye and thanks

EgonOlsen

Strange...do you get an error message? Maybe signing the applet affects the document base?? I'm just guessing here, but it could be helpfull to know where getDocumentBase() points to in both situations.
Is your applet in a jar file? If so, maybe putting the textures into that jar and loading them from there using an InputStream will work...

Tornado7

No, looking in Java console no error appears, texture are correctly loaded and added to the texture manager.... And no, the applet isn't placed in a jar file, is a "stand-alone" class file. I'm not pretty sure to understand what do you mean when you say: "where getDocumentBase() points to in both situations."

Bye

EgonOlsen

Well, getDocumentBase() returns an URL, which can simply be printed out. I doubt that this will reveal anything new, but i would like to know if getDocumentBase() really returns the same URL with and without the certificate. If it does and you say that the textures are loaded correctly, just not displayed, i suggest to double check your code. Maybe you are doing something when loading the file that causes this behaviour.