使用 Glassfish 的 UrlRewriteFilter [英] UrlRewriteFilter with Glassfish

查看:16
本文介绍了使用 Glassfish 的 UrlRewriteFilter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 Glassfish v3 服务器中集成 URL 重写?

How can I integrate URL rewriting in my Glassfish v3 server?

我想知道这一点的原因是我正在使用 Quercus 将 PHP 应用程序部署到我的 Glassfish 服务器中.

The reason why I want to know this is that I am deploying a PHP application into my Glassfish server using Quercus.

但是 Quercus 依赖于 Apache 服务器中的 mod_rewrite 来提供 URL 重写,而这在 Glassfish 中是不可用的.

But Quercus relies on mod_rewrite in the Apache Server to provide URL rewriting and this is not available in Glassfish.

推荐答案

好吧,你有两个选择:

  • 在您的 GlassFish 实例前面使用 Apache 并使用 mod_rewrite
  • 或使用 Tuckey 的 网址重写过滤器

我猜前者不是一个选项(或者你不会发布这个问题).关于后者,您可以调整 使用 Url 重写过滤器使用干净的 url 在 Glassfish 上使用 Drupal.基本上,您必须:

I guess the former is not an option (or you wouldn't post this question). Regarding the later, you could adapt the solution given in Drupal on Glassfish with clean urls using Url Rewrite Filter. Basically, you'll have to:

  • 获取 Quercus 的战争并解压
  • 下载过滤器并将其解压到 Quercus 中(这会将过滤器罐放入WEB-INF/libWEB-INF 下的 urlrewrite.xml)
  • web.xml 中声明过滤器(参见说明)
  • 将您的重写规则移植"到 urlrewrite.xml 文件
  • 重新打包并部署战争(或将其部署为分解的存档)
  • Get Quercus's war and unpack it
  • Download the filter and unpack it inside Quercus (this will put the filter jar inside WEB-INF/lib and the urlrewrite.xml under WEB-INF)
  • Declare the filter in the web.xml (see the instruction)
  • "Port" your rewrite rules to the urlrewrite.xml file
  • repackage and deploy the war (or deploy it as an exploded archive)

这篇关于使用 Glassfish 的 UrlRewriteFilter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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