File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes Accessing a static resource Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Accessing a static resource" Watch "Accessing a static resource" New topic

Accessing a static resource

Stephane Eybert
Ranch Hand

Joined: Mar 15, 2010
Posts: 34

I have a static resource, a pdf file, sitting in:

stephane@stephane-ThinkPad-X60:apache-tomcat> ll webapps/annotate-web/pdfs/
total 124
-rw-rw-r-- 1 stephane stephane 125962 2012-03-06 13:28 demo.pdf

I'm trying to access it from the browser with:


But I get a 404 message.

Here is the servlet config for info:

Kind Regards,

Stephane Eybert
Ranch Hand

Joined: Mar 15, 2010
Posts: 34
Looks like this is not inspiring people :-)
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17421

Stephane Eybert wrote:Looks like this is not inspiring people :-)

The downside of free is that you don't get instant answers. Be patient. We do try and make sure all questions are answered, unless the person asking them is so obviously clueless that it wouldn't be worth trying to answer, the person asking is blatantly violating what few ironclad rules we have (mostly obviously bogus names) or nobody else knows the answer either.

I didn't see anything obviously wrong with what you did. Assuming that the Spring stuff isn't doing something obscure with your URL, about the only other reason I can see for a 404 would be if the file cannot be found. That usually is either because Tomcat doesn't have access rights to the file, or the filename requested in the URL isn't capitalized correctly.

An IDE is no substitute for an Intelligent Developer.
Stephane Eybert
Ranch Hand

Joined: Mar 15, 2010
Posts: 34
Thanks Tim, no hurry with this issue, it's not a show stopper anyway, I shall try to test around it and see if I can find something in there.
I agree. Here's the link:
subject: Accessing a static resource
It's not a secret anymore!