Edmund Urbani wrote:

Philip Cote wrote:

I'm trying to write to binary data from a MySQL database into a jpeg file so I can show it on a jsp page but I'm not having much luck. My bean can create files outside the servlet / jsp context using the usual java.io classes. As I understand it, java.io classes aren't allowed for EJBs. Does this apply to plain java beans as well? If so, what are the alternatives for doing what I'm trying to do?

your java classes can do anything the VM process is permitted to do, unless you have restricted using a security manager and the catalina.policy file (i think eg. debian tomcat packages do that by default). i'm not sure just jow exactly you are trying to serve those images to the client and why you want to write them (temporarily) to the file system.

I'm using Windows XP. I checked the tomcat configuration box. I'm starting Tomcat with the default settings with Tomcat security off. I believe my JVM is also set to default mode though I'm not really sure how to verify this.

i would probably want to send them back directly from memory after reading them from the DB as a blob (much like Larry Meadors just suggested while i was writing this ...).

I'm really not sure you mean by "send them back directly drom memory". Does this have to do with setting the res.setContentType() to "image/jpeg" rather than "text/html". Because if that's the case, then I'm definitely in alien territory. I did try that and it caused firefox to want to download a 0 byte long file. The bright side is Larry is right. Writing the servlet was a breeze as was getting the binary data out of the database. It was easy to have my servlet forward over to the jsp page where the image would actually be displayed. I'm even getting my bean on that page to pull database records. My only sticking point is how I'm supposed to write that binary data to the jpeg file . Is this more an issue of my understanding of the java.io libraries? I thought I understood them but maybe I'm missing the boat on this one.

Edmund

---------------------------------------------------------------------
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]

Reply via email to