Skip to main content

Serving static content

Please note these forums are being decommissioned and use the new and improved forums at
1 reply [Last post]
Joined: 2004-03-31

I'm developing a website with many pages. Most of these pages are static content, but I am also writing a servlet to handle some user queries. At the moment, most of the website is being developed by a team independently of the servlet.

My servlet will generate HTML web pages which need to include tags which reference .jpgs in the main website. Right now I have a copy of the static website on my harddrive. However, when I test my servlet, none of the images I link to a displayed.

The HTML I generate looks like:

While this displays correctly if I save the page to a file and then load the file in a web browser, no images display when the same page is served to the same web browser by GlassFish. I suspect GlassFish is refusing to resolve anything starting with file:// for security reasons.

Anyhow, how can I test out my servlet? I'd like to be able to have links that can display images from the static website files on my hard drive.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2005-03-29

What html tag do you use?
According to the description, the url started with file://.
The file:// refers to files in the file system. Most probably, this is not what you want.
You may like to move those files under docroot or bundled it as part of the web application.