Glassfish vhost只提供静态内容。禁用会话如何? [英] Glassfish vhost to serve only static contents. Disable session how to?

查看:103
本文介绍了Glassfish vhost只提供静态内容。禁用会话如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在服务器上有一个文件夹,里面包含了所有的图像,静态文件,还有我的应用程序的存储,我需要在 http:// host:8080 / storage / **上下文。
此刻,我在名为storage的应用程序statup上安装了一个符号链接,
我试图在GlassFish应用服务器v2.1中设置一个虚拟主机,只为静态内容提供服务,但是,出现了一个大问题,如何禁用httpsession管理?
对JS,CSS或IMG文件的每个请求,会话都由jsessionid检索。所有这些工作都是徒劳的。
关于如何在存储上下文中提供静态内容的最佳方式以及如何禁用特定主机中的会话管理的所有解释?

问候。
Rigoni

解决方案

我不知道您是否知道这一点,但GlassFish支持替代文章和本地资源路径,它非常适合静态内容:


作为另一个例子,考虑在 sun-web.xml 的
>:

 < property name =alternatedocroot_1value =from = / myimages / * dir = / images/> ; 

和此请求网址:

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

进一步假设上述请求
被映射到部署在根上下文(/)处的web应用程序
。在
这种情况​​下,请求的路径信息
评估为:

  /myimages/image1.jpg 

表示它与上述
替代文件根目录相匹配。将查询请求的
资源的本地
文件系统路径为
替代docroot的
dir值的值:

  / images 

路径信息:

  /myimages/image1.jpg 

,结果如下:

  / images / myimages / image1。 jpg 


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



资源




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

解决方案

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

这篇关于Glassfish vhost只提供静态内容。禁用会话如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆