tags:

views:

11

answers:

1

Hello all, I have a folder in the server, that contains all the images, static files, and more its the storage of my application, I need to serve this files on a http://host:8080/storage/** context. At this moment I mount a symlink on the root of the application on the application statup called "storage", I'm trying to setup a virtualhost in Glassfish Application Server v2.1 to serve only static content, but, a big problem appeared, how to disable the httpsession management? Each request to a JS,CSS or IMG file, the session was retrieved by the jsessionid. All this work will be vain. All sugestion about how the best way to serve the static content in the "storage" context and how to disable the session management in a specific host?

Regards. Rigoni

A: 

I don't know if you are aware of that but GlassFish does support Alternate Docroots and Local Resource Paths which is very nice to serve static content:

As another example, consider the following alternate docroot declaration in sun-web.xml:

<property name="alternatedocroot_1" value="from=/myimages/* dir=/images"/>

and this request URL:

http://localhost:8080/myimages/image1.jpg

Further assume that the above request is mapped to a web application deployed at the root context ("/"). In this case, the request's path info evaluates to:

/myimages/image1.jpg

meaning it is matched by the above alternate docroot. The local filesystem path where the requested resource will be looked up is given as the value of the alternate docroot's "dir" value:

/images

with the request's path info:

/myimages/image1.jpg

appended to it, resulting in:

/images/myimages/image1.jpg

I know this is not a direct answer to the question, but wouldn't this be a better alternative?

Resources

Pascal Thivent

related questions