Re: xhtml and Internet Explorer
Marius Scurtescu wrote: Thanks for all the replies. I did solve the mystery. IE is indeed a POS. It looks like it completely ignores the Content-Type headers and it just scans the beginning of the file. You know what's great about that? It's not a bug, it's a feature. http://msdn.microsoft.com/library/default.asp?url=/workshop/networking/moniker/overview/appendix_a.asp Internet Explorer BY DESIGN ignores the content-type and decides for itself what to do with the file. Their reasoning? "this type of behavior is necessary to identify a .gif file being sent as text/html" *shakes head* Good luck with the newline issue; sorry I don't have any advice to offer :) Bean The JSPs I was struggling with are using lots of JSP directives (tag lib and page), includes and tiles. The result was that there were many empty lines after the DOCTYPE declaration and the tag. IE seems to be scanning for the tag (don't ask why) and if it does not find it soon enough then it gives up and treats the file as raw XML. Pretty smart. I attached a test file which on my system is treated as raw XML. If I delete on single empty line before the tag then it is treated as XHTML. Now this is sort of a show stopper for me, unless I find a way to reduce the empty lines a the top of a file. Is there a way in Tomcat to prevent the creation of an empty line for each JSP directive? I cannot move the tag on top since it is generated in a layout file and imported through tiles. A few more observation regarding IE. It seems that one it guessed the type of a page it is caching that info in memory. Deleting temporary files and forcing a check on every visit does not help. You have to close the browser in order to flush this cache. Loading pages from the file system has a completely different logic, it is based on the file extension (there is no scanning for tag). Thanks again, Marius Carlos Pereira wrote: That's because IE ignores the Content-Type header and just looks at the first few bytes of the file to decide how to display it. What a POS. Anyway... (Christopher Schultz) IE works like this: in the first call to a web page, it checks the Content-Type and displays the web page accordingly. Next time you request the same page, it ignores the Content-Type. I know that this issue came up before on this list, but the solution suggested previously (adding a page directive with the content type) does not work. (Marius Scurtescu) So, do the following: 1. You have to make sure IE is foing to display the most recent page. You can do this by either adding a pragma/no-cache header, or go to (in IE): tools/internet options/temporary internet files/settings and, under "check for newer versions of stored pages", select the "every visit to the page" option. When you are developing, this last thing should ALWAYS be done. Otherwise, you might be getting IE cached versions of the web page and asking yourself why the changes aren't working. 2. Force IE to read the Content-Type again. Simply shut down the browser, and request your xhtml page to see if it works. Hope that helps. Carlos Pereira - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Can I configure Tomcat to send "HTTP/1.1 200 OK" rather than "HTT P/1.1 200"?
> I have a really picky browser that is expecting the "OK" after "200" when > receiving HTTP response as: out of curiosity, which browser is this? Might save me some bug-tracking headaches later. Jason Hua Hou wrote: I have a really picky browser that is expecting the "OK" after "200" when receiving HTTP response as: HTTP/1.1 200 OK Without the "OK", the browser can NOT render the HTTP response correctly. I have two questions: (1) Is there a way to configure Tomcat to send "OK" after the "200" code when sending response header to browser? (2) According the HTTP 1.1 spec, is the "OK" required after the "200" code? Thank you very much for your great help! Hua - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Writing temporary file & downloading it? [SOLVED]
I had to do it a little differently (this is for a .zip file so I had to use the OutputStream) but you definitely got me on the right track. Thanks for all the help! Jason Shapira, Yoav wrote: Howdy, The directory it returns is C:\tomcat\work\Standalone\localhost\gss and I can write test.txt there fine. If I try to make a hyper link to http://localhost:8080/gss/test.txt, though, Tomcat returns 404. Do I have to do something special to tell Tomcat to serve the file? You can only http hyperlink to resources under your webapp root. Your temp file is not under your webapp root. So you need a servlet that will read your temp file, and write it out to the response. Something like: BufferedReader bin = new BufferedReader(new FileReader(myFile)); PrintWriter out = response.getWriter(); String line = null; while((line = bin.readLine()) != null) { out.println(line); out.flush(); } Alternative approaches exist. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Writing temporary file & downloading it?
The dir works for writing output to, thanks! But I'm having problems linking to the file. The directory it returns is C:\tomcat\work\Standalone\localhost\gss and I can write test.txt there fine. If I try to make a hyper link to http://localhost:8080/gss/test.txt, though, Tomcat returns 404. Do I have to do something special to tell Tomcat to serve the file? Jason Shapira, Yoav wrote: Howdy, A servlet container is required to supply your application with a directory where you can run temporary files. This directory is available via File tempDir = (File) getServletContext().getAttribute("javax.servlet.context.tempdir"); You'd know the above if you'd read the servlet specification, but I'm getting tired of that mantra ;) Then you can say: File myTempFile = File.createTempFile("prefix.", ".suffix", tempDir); // Use a FileWriter or whatever to write your file // Stream or link this temp file's contents back to the browser // Stream via FileReader, // or directly link file File.toURI().toURL(), or whatever method you want You can then delete the file if you want. Yoav Shapira Millennium ChemInformatics -Original Message- From: Jason Viers [mailto:[EMAIL PROTECTED] Sent: Thursday, October 16, 2003 9:13 PM To: Tomcat Users List Subject: Re: Writing temporary file & downloading it? Running Tomcat 4.1.27, I'm currently deploying via the "install" task in the Ant script supplied with Tomcat, so all my files reside outside of the Tomcat directory. Otherwise, everything's pretty normal (Tomcat resides in C:\tomcat). Just for curiosity's sake, could I find out what methods there are (instead of only what someone thinks is best?). 6 months down the road my situation might change (this is still in development & real deployment might be different) and it'd be nice to know what my options are. Suggestions for which method is best are of course still welcome. Thanks Jason Justin Ruthenbeck wrote: Yes, it is possible. Give us an idea of your deployment setup (are you deploying as a .war file? Using default root paths? Anything special?) and we can suggest the best way to go about doing it. justin At 04:16 PM 10/16/2003, you wrote: Is it possible, in a servlet, to write to a temporary file in a location that I would then be able to link to so the users can download? I couldn't find any information indicating either way. Thanks Jason - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Justin Ruthenbeck Software Engineer, NextEngine Inc. justinr - AT - nextengine DOT com Confidential See http://www.nextengine.com/confidentiality.php - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Setting all bean's properties in servlet
Is there a way in a servlet to set all the properties you can in a bean with the parameters passed to the servlet, similar to the way you do in a .jsp with ? It seems like it should be easy enough, but Goggling only found someone asking the same question here in 2000 with no responses. I know that I could have my form submit to a .jsp that uses and then forward to the servlet, but it seems as though there should be a more elegant way to do it. Thanks Jason - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Writing temporary file & downloading it?
Running Tomcat 4.1.27, I'm currently deploying via the "install" task in the Ant script supplied with Tomcat, so all my files reside outside of the Tomcat directory. Otherwise, everything's pretty normal (Tomcat resides in C:\tomcat). Just for curiosity's sake, could I find out what methods there are (instead of only what someone thinks is best?). 6 months down the road my situation might change (this is still in development & real deployment might be different) and it'd be nice to know what my options are. Suggestions for which method is best are of course still welcome. Thanks Jason Justin Ruthenbeck wrote: Yes, it is possible. Give us an idea of your deployment setup (are you deploying as a .war file? Using default root paths? Anything special?) and we can suggest the best way to go about doing it. justin At 04:16 PM 10/16/2003, you wrote: Is it possible, in a servlet, to write to a temporary file in a location that I would then be able to link to so the users can download? I couldn't find any information indicating either way. Thanks Jason - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Justin Ruthenbeck Software Engineer, NextEngine Inc. justinr - AT - nextengine DOT com Confidential See http://www.nextengine.com/confidentiality.php - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Writing temporary file & downloading it?
Is it possible, in a servlet, to write to a temporary file in a location that I would then be able to link to so the users can download? I couldn't find any information indicating either way. Thanks Jason - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]