如何在 ADF Essentials 中使用 Tuckey URL Rewrite? [英] How can i Use Tuckey URL Rewrite with ADF Essentials?

查看:43
本文介绍了如何在 ADF Essentials 中使用 Tuckey URL Rewrite?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 ADF 11.1.2.4 (JSF2.0 -GF 3.1.2) 上开发期望为漂亮的 url 实现 urlrewrite.添加到 web.xml:

Developed on ADF 11.1.2.4 (JSF2.0 -GF 3.1.2) Expecting to implement urlrewrite for pretty urls. Added into web.xml:

    <filter>
    <filter-name>UrlRewriteFilter</filter-name>
    <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
    <init-param>
      <param-name>logLevel</param-name>
      <param-value>WARN</param-value>
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>UrlRewriteFilter</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
  </filter-mapping>

创建的urlrewrite.xml如

created urlrewrite.xml such as

<rule>
    <from casesensitive="false">myTest</from>
    <use-context>true</use-context>
    <to>/faces/admin/admin.jspx</to>
</rule>

admin.jspx 包含 TF.当我部署项目并请求主机名时:9999/mytest 重定向正确的页面(主机名:9999/faces/admin/admin.jspx)并且页面呈现没有问题.但我的实际目标是让供应看不到真正的网址.但是我可以在浏览器上看到真实的 url,例如:(...jspx?_adf.ctrl-state=4avl71cil_1) 那么,我错过了什么?顺便一提;当我输入屏蔽的 url 时,它会重定向我的真实页面,因此效果很好.但似乎是浏览器地址栏上的真实网址.如果我只使用 'faces' 上下文之外的 html 页面,那么 urlrewrite 会按预期工作.谢谢,brgds

admin.jspx contains TF. When i deploy project and request hostname:9999/mytest redirects right page(hostname:9999/faces/admin/admin.jspx) and page renders without problem. But my actual goal was that making supply to see never real url. But i can see the real url on browser such as:(...jspx?_adf.ctrl-state=4avl71cil_1) So, what am i missing? By the way; When i type the masked url, it redirects my real page, so it works good. But seems to be the real url on browser address bar. If i only use html pages out of 'faces' context, then urlrewrite works as fully expected. Thx, brgds

推荐答案

因为你有 Tucky URL Rewriting 过滤器,ADF 附带了它的 JSF View Handler,在 ADF 12.1.x 之前你将无法转发 URL,除非你正在使用 Apache Server Rewrites 或 Oracle HTTP Server,因为 ADF 内部过滤器将查找 _adf.ctrl-state,如果找不到,它会将其附加到 URL 中,该 URL 将显示页面的实际 URL.

As you have Tucky URL Rewriting filter, ADF comes with its JSF View Handler, and before ADF 12.1.x you won't be able to forward URLs unless you are using Apache Server Rewrites or Oracle HTTP Server, as the ADF internal filter will look for _adf.ctrl-state and if it's not found it'll append it to the URL which will show the actual URL of the page.

您可以尝试通过扩展 ServletRequest 来破解那些 _adf.ctrl-state,当被问及 _adf.ctrl-state 以提供会话中保存的最后一个值时,但我向您保证这对应用程序非常有害.

You can try to hack those _adf.ctrl-state by extending ServletRequest and when asked about _adf.ctrl-state to provide the last value saved in session, but I assure you it'll be very harmful for the application.

这篇关于如何在 ADF Essentials 中使用 Tuckey URL Rewrite?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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