Glassfish虚拟主机仅提供静态内容。如何禁用会话?

3
我在服务器上有一个文件夹,包含所有的图片、静态文件等,是我的应用程序的存储空间。我需要将这些文件放在 http://host:8080/storage/ 上下文中提供服务。 目前,在应用程序启动时我会在应用程序根目录下挂载一个名为“storage”的符号链接。 我正在尝试在Glassfish Application Server v2.1中设置虚拟主机来仅提供静态内容,但是出现了一个大问题:如何禁用httpsession管理? 每个JS、CSS或IMG文件的请求都会检索jsessionid的会话。所有这些工作都会白费。 请提供关于如何在“storage”上下文中提供静态内容以及如何在特定主机上禁用会话管理的最佳方法的建议。
问候。 Rigoni
1个回答

3

我不知道你是否知道,但GlassFish支持备用文档根目录和本地资源路径,这非常适合提供静态内容:

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

我知道这不是对问题的直接回答,但这难道不是更好的选择吗?

资源


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接