Onetoomanysodas Posted August 15, 2008 Share Posted August 15, 2008 I am trying to have a script forward a java class to the client but the applet is failing to load. The file acts as it should when I navigate to the script with these headers: header('Content-type: class/java'); header('Content-disposition: attachment; filename="applet.class"'); header('Content-length: ' . filesize($path)); print($file); The problem is that the applet object is failing from the html document so it must be an issue with lack of proper headers. I need to convince firefox that the request being returned is an actual class file. Link to comment https://forums.phpfreaks.com/topic/119903-correct-headers/ Share on other sites More sharing options...
natbob Posted August 16, 2008 Share Posted August 16, 2008 I'm not quite sure what you mean, do the posted headers work or are they the ones you are using now? I do not know very much about java but the headers you posted would do what are in the comments header('Content-type: class/java'); //says that this page is a java class header('Content-disposition: attachment; filename="applet.class"'); //says that you want the browser to download the class to the disk header('Content-length: ' . filesize($path)); print($file); //the class is read and put on the screen? if you want to just have the browser parse it as a class then the following should be good <?php header('Content-type: class/java'); print($file); ?> or if you want the client to download it: <?php header('Content-disposition: attachment; filename="applet.class"'); ?> Once again I'm pulling from my limited Java knowledge so I may be wrong. Link to comment https://forums.phpfreaks.com/topic/119903-correct-headers/#findComment-617783 Share on other sites More sharing options...
Onetoomanysodas Posted August 17, 2008 Author Share Posted August 17, 2008 Yes thankyou but I know what my headers are doing. It's actually better to use: `Content-Type: application/octet-stream` for better compatibility with the applet object in the DOM but for some reason it's still not loading it and I was just wondering if anyone knows this issue? Link to comment https://forums.phpfreaks.com/topic/119903-correct-headers/#findComment-618342 Share on other sites More sharing options...
cooldude832 Posted August 17, 2008 Share Posted August 17, 2008 not loading at all or not loading into the object holder? Link to comment https://forums.phpfreaks.com/topic/119903-correct-headers/#findComment-618345 Share on other sites More sharing options...
Onetoomanysodas Posted August 18, 2008 Author Share Posted August 18, 2008 It's not loading into the object holder. The script does just what it should and streams the class. I am even mimicking all the other headers apache usually generates for a java file and the object is still failing to load Link to comment https://forums.phpfreaks.com/topic/119903-correct-headers/#findComment-618914 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.