Author Topic: Loading texture problem while using certificate  (Read 2416 times)

Offline Tornado7

  • byte
  • *
  • Posts: 45
    • View Profile
Loading texture problem while using certificate
« on: June 04, 2004, 05:20:48 pm »
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:
Code: [Select]

    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:
Code: [Select]
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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Loading texture problem while using certificate
« Reply #1 on: June 04, 2004, 07:07:59 pm »
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...

Offline Tornado7

  • byte
  • *
  • Posts: 45
    • View Profile
Loading texture problem while using certificate
« Reply #2 on: June 04, 2004, 08:27:07 pm »
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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Loading texture problem while using certificate
« Reply #3 on: June 04, 2004, 11:22:43 pm »
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.