File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes Access a resource (for example, Image) in Appserver Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Access a resource (for example, Image) in Appserver" Watch "Access a resource (for example, Image) in Appserver" New topic

Access a resource (for example, Image) in Appserver

venkat paruchuri

Joined: Aug 15, 2001
Posts: 28
I am new to using Sun ONE application server. My requirement is to capture a remote image file through EJB and save it on the hard disk rather than saving to databse and should be used by webserver (Tomcat in Sun ONE) to display the preview of created image to the user. In order to fulfill my requirement, which location the image file should be created on the box (where Appserver was installed) and how to refer to this image file from webserver using http protocol to display the preview? I would really appreciate if somebody could help me ASAP.

Thanks in advance.
Stas Sokolov
Ranch Hand

Joined: Apr 13, 2004
Posts: 117

As far as I know EJB container does not allow to access local file system. But
web container (were all your servlets are run) has direct access to the file system. So I advice you use the following pattern.
- Create some directory in the application server workstation.
- Create reference to this directory in the application deployment descriptor
- Use reference to get actual directory from the servlet that actually load and store image.
It probably make deployment a little bit more complex. But I resolved the similar problem (image preview) using this pattern.

Good luck for yourself.
It is sorta covered in the JavaRanch Style Guide.
subject: Access a resource (for example, Image) in Appserver
Similar Threads
Need urgent help
How to keep the image still after capturing through camera in android
which web server
download file using h:commandLink or h:graphicImage
problem with displaying the image from local disk in jsp page