2

我正在尝试(没有成功)将 JRuby Rack - Rails 应用程序的响应传递给过滤器,以便对其进行处理。基本上我想使用 Orbeon XForm 引擎来增强来自我的 Rails 应用程序的 XHTML 输出。如果我在 JRuby Rack 上使用一个简单的 Java servlet,一切都会顺利进行。

这是 web.xml 文件:

<!DOCTYPE web-app PUBLIC
  "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
  "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>

  <context-param>
    <param-name>public.root</param-name>
    <param-value>/</param-value>
  </context-param>

  <context-param>
    <param-name>rails.env</param-name>
    <param-value>production</param-value>
  </context-param>

  <context-param>
    <param-name>jruby.min.runtimes</param-name>
    <param-value>2</param-value>
  </context-param>

  <context-param>
    <param-name>jruby.max.runtimes</param-name>
    <param-value>4</param-value>
  </context-param>


  <filter>
    <filter-name>orbeon-xforms-filter</filter-name>
    <filter-class>org.orbeon.oxf.servlet.OrbeonXFormsFilter</filter-class>
    <init-param>
      <param-name>oxf.xforms.renderer.context</param-name>
      <param-value>/orbeon</param-value>
    </init-param>
  </filter>

  <!-- This is necessary so that XForms engine resources can be served appropriately -->
  <filter-mapping>
    <filter-name>orbeon-xforms-filter</filter-name>
    <url-pattern>/orbeon/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
  </filter-mapping>

  <!-- Any web resource under /xforms-jsp is processed by the XForms engine -->
  <filter-mapping>
    <filter-name>orbeon-xforms-filter</filter-name>
    <url-pattern>/page/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
  </filter-mapping>

  <filter>
    <filter-name>RackFilter</filter-name>
    <filter-class>org.jruby.rack.RackFilter</filter-class>
  </filter>

  <filter-mapping>
    <filter-name>RackFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>


  <listener>
    <listener-class>org.jruby.rack.rails.RailsServletContextListener</listener-class>
  </listener>


</web-app>

在此先感
谢桑德罗。

4

1 回答 1

0

我对 Orbeon XForms 不熟悉,所以我对您的问题不是很肯定。但是根据上面的 web.xml,Orbeon 过滤器仅适用于URL,/orbeon/*/page/*Rack 过滤器适用于所有内容。

如果 servlet 方法有效,为什么不坚持呢?

于 2011-09-02T23:22:42.950 回答