• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Accessing images from another path in UNIX

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello people,
I have a problem that I have been trying to address and have been unsuccessful.
I have an application where the user is shown a series of JSPs and upon entering data in those there is a final content generated which is converted to PDF.
Now, during in these contents also have images, the path of which is prescribed in a DB table. So at run time, I would know which path to look up and what file to pick up and generate in this dynamic HTML.
These images are not in the same path as the regular images that we have as part of the application; meaning application specific images in ../images folder where the the JSPs are housed.
Now when these dynamic pages are shown, the image does not come up at all however when the final PDF is created, we are able to see the images perfectly.
If the path where the PDF is generated is say /folder1/folder2/pdf; then the images are fetched from /folder1/folder3/image/ - so its somehow able to recognize the image path and show it in the PDF.
What changes must I do in my dynamic pages so that the images are shown duiring the dynamic pages generation as well as in the final pdf.
I do not know if I have been very articulate in describing my problem, but pl do reply if you have had this problem in the past or know how to solve this.
Thanks in advance
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is the directory that houses the images inside your webapp?
 
Raghu Nathan
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I do not know which images folder you are asking; there is the one images folder that is within the path where we have all the JSPs and then there is this other images folder.
Regardless, both folders, are part of the Web Server and App Server.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
List the path to the two image folders.

You can only link directly to images that are
A) within your webapp and
B) not under the WEB-INF directory.

If your image directory doesn't meet this criteria, you will need to build a servlet that streams the image files to the browser.
 
Raghu Nathan
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply.

These are not in the WEB-INF folder. But they secondary images path has been given by the users.
This is a Unix box.
I was reading somewhere that if we have a virtual fodler; it might do the trick. I have never used Virtual folders and am curious to know if this would indeed solve the issue.

I need some help big time in this ...

Thanks again.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Raghu Saranathan:

I need some help big time in this ...



How can anyone help you if you keep ignoring the questions being asked?
What is the path to the images that you want to show from your JSPs?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Raghu Saranathan:
But they secondary images path has been given by the users.
This is a Unix box.


What does this mean?



Originally posted by Raghu Saranathan:
This is a Unix box.


Doesn't matter
 
Raghu Nathan
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok the path that I want to show from my JSPs are in another folder;

I will tell you the exact path if you need:

#1
Here is where we have the JSPs;
/export/home/oti/oc4j/j2ee/home/applications/teachext/teachext/

#2
The images that we show in the application for buttons and logos are withing a folder called images within the above path:
/export/home/oti/oc4j/j2ee/home/applications/teachext/teachext/images/

#3
Now, there are a second set of images which are in :
/export/home/oti/oc4j/j2ee/home/teachfiles/letterTemplates/images/

#4
The pdfs get generated in :
/export/home/oti/oc4j/j2ee/home/teachfiles/pdf/

The functionality is such that the user can view the contents of letters (that's what happens in this process) online and when they hit Submit; the html content is converted to pdf.

The pdf being in the different path is able to recognize it after the generation and the images stored in #3 show up in the PDF. Its when the JSPs access the path defined in #3 that I am having a problem.

I am sorry again for not being able to express it properly earlier.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First, thank you for fixing your name.

OK, it looks like they are outside of your webapp.
In order to link to these images with an HTML img tag from a browser, you will need to either write a servlet that streams images or create a symlink to the images directory from somewhere within your webapp's directory structure.

The streaming servlet would be my first choice.
By default, in Tomcat, symlinks are not followed.
This is for security reasons and I assume most other containers take the same approach.
They are also not portable. Someday, you may have the misfortune of having to deploy this app on something other than a Unix box.

Depending on your server and network, there may be other options as well.
 
Raghu Nathan
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply. However, I do think these run within the Web Server.
I will try to do that and let you know.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic