| Author |
Placing a pdf under WEB-INF/classes and accessing it through relative url
|
Rajagopalan Balasubramanian
Greenhorn
Joined: Jan 30, 2007
Posts: 9
|
|
Hi All,
In my project, currently all static resources are in a webserver. The Pdfs therefore, are accessible directly without any authentication. As a measure of security, we have been asked to move the PDFs to Appserver so that unrestricted and unauthorised download can be avoided.
As with all big portals, this project also uses Content management tools to manage static files. And the deployments from the Content Management tool has been configured only to
WEB-INF/classes/resources/..(foldername).
All static files in this above folder are mostly html, which are used by the application, through the tiles-def (portlets) I am not aware, how to access a PDF if placed in the above folder. I am required to create a relative path to the PDF which I can call from various JSPs (these relative paths to PDFs should also managed through content management tool) and I need to create a path which can access the files under WEB-INF/classes/resources/..(foldername).
Can someone please guide me to accomplish this task.
Thanks a lot,
Rajagopalan
|
 |
Rudy Gireyev
Ranch Hand
Joined: May 03, 2011
Posts: 39
|
|
|
Try ../resources/..(foldername) and see if that works
|
 |
Mohana Rao Sv
Ranch Hand
Joined: Aug 01, 2007
Posts: 485
|
|
|
try request.getContextPath();
|
ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16483
|
|
|
The Ranch has a FAQ entry about this: RelativeLinks. It is well worth reading.
|
 |
Rajagopalan Balasubramanian
Greenhorn
Joined: Jan 30, 2007
Posts: 9
|
|
Rudy,
Thanks. I tried and it did not work.
Mohana Rao,
I cannot try request.getContextPath in this case, as there are some 4 PDFs that needs to be listed one below the other in a JSP. And these have to be called through ICMS content ID (for frequent updating without the need to change in JSPs). The content ID does not support the method.
I shall try this suggestion, and If I am able to get the PDF then, will try and convince the business not to use content IDs for this case (as a last resort) and handle through the code. Thanks!
Paul,
Thanks a lot. I shall read the link.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56191
|
|
|
If the file is anywhere under WEB-INF it is not accessible by any URL.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Rajagopalan Balasubramanian
Greenhorn
Joined: Jan 30, 2007
Posts: 9
|
|
Bear,
Thank you so much!
|
 |
 |
|
|
subject: Placing a pdf under WEB-INF/classes and accessing it through relative url
|
|
|