Resin 欢迎文件不加载 servlet!
Resin (3.0.27) 是否可以将欢迎文件映射到 Servlet?
我在 Caucho 文档中找不到任何说明不支持此功能的内容。 我们将非常感谢您的帮助。
<servlet-mapping>
<servlet-name>td</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.htm</welcome-file>
</welcome-file-list>
编辑:如果从我的帖子中看不出来,则上述内容不起作用。 :)
编辑:如果我将index.htm 放入文件系统中,servlet 映射就会起作用。 就好像 Resin 如果找不到物理文件就会终止请求。
Is is possible for Resin (3.0.27) to map a welcome-file to a Servlet?
I can't find anything in the Caucho documentation that says this is not supported. Your help would be greatly appreciated.
<servlet-mapping>
<servlet-name>td</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.htm</welcome-file>
</welcome-file-list>
Edit: If it isn't obvious from my post, the above isn't working. :)
Edit: If I place the index.htm in the file system, the servlet-mapping works. It's as if Resin terminates the request if it can't find the physical file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于 caucho_module 加载其配置的方式,它很可能会忽略欢迎文件。 欢迎文件映射是由 servlet 容器(例如,您的情况下的 Resin)完成的。 但 caucho_module 似乎正在寻找一个存在的显式映射,以帮助它决定哪些内容会进入 Resin,哪些内容不会进入 Resin,以及 Apache 将尝试为自己服务的内容。
也许这是 caucho_module 中的一个错误,它没有考虑欢迎文件处理?
如果这是真的,那么解决这个问题的一种笨拙方法是使用 Apache 的 mod_rewrite 来映射您希望映射到“欢迎文件”的 URL。 事实上,尝试这一点很可能证明这一点。 例如,类似这样的内容:
您可能想尝试以最终斜杠结尾或不以最终斜杠结尾的 URL 版本...我对 mod_rewrite 不太熟悉,不知道这是否会产生影响。 无论如何,这将告诉 Apache 告诉客户端重定向(重新加载页面到)以欢迎页面结尾的 URL。 如果这种事情解决了问题,那么在我看来,这是 cacho_module 中的一个错误。
另一件可以尝试的测试是直接访问 Resin(通常在端口 8888 上)以绕过 Apache HTTP,看看直接访问 Resin 的欢迎页面是否得到正确处理。
Due to the way that caucho_module loads its configuration, it very well may ignore welcome files. The welcome file mapping is done by the servlet container (e.g., Resin in your case). But caucho_module seems to be looking for an explicit mapping to exist to help it decide what goes and what doesn't go to Resin, vs what Apache will try to serve itself.
Perhaps this is a bug in caucho_module that it doesn't account for welcome file handling?
If this is true, then one kludgey way you could work around this would be to use Apache's mod_rewrite for the URLs that you wish to be mapped to a "welcome file." Indeed, trying this may well prove the case. For example, something like:
You may want to try versions of the URL that do and do not end in a final slash ... I'm not familiar enough with mod_rewrite to know if that will make a difference. Anyway, this will tell Apache to tell the client to redirect (reload the page to) a URL that ends in your welcome page. If this kind of thing fixes the problem, then IMO this is a bug in cacho_module.
Another thing to try as a test is to go directly to Resin -- often on port 8888 -- to bypass Apache HTTP to see if going directly to Resin the welcome page is correctly handled.