• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Placing a pdf under WEB-INF/classes and accessing it through relative url

 
Rajagopalan Balasubramanian
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try ../resources/..(foldername) and see if that works
 
Mohana Rao Sv
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try request.getContextPath();
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Ranch has a FAQ entry about this: RelativeLinks. It is well worth reading.
 
Rajagopalan Balasubramanian
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the file is anywhere under WEB-INF it is not accessible by any URL.
 
Rajagopalan Balasubramanian
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear,

Thank you so much!

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic