URL rewrite in Wildfly?

2019-06-03 11:01发布

I built up an app using RichFaces, PrimeFaces, and Java in the back. The outcome (mysite.war) I let run within Wildfly 8.

Now my pages are like this:

  1. www.mysite.com/index.jsf
  2. www.mysite.com/report.jsf?no=1
  3. www.mysite.com/report.jsf?no=2
  4. www.mysite.com/report.jsf?no=3
  5. www.mysite.com/report.jsf?no=4
  6. www.mysite.com/legal.jsf

I would like to change that to more readable URLs. Especially the reports! Taking the example order, I am looking forward to having something like this:

  1. www.mysite.com
  2. www.mysite.com/report/turkey
  3. www.mysite.com/report/germany
  4. www.mysite.com/report/england
  5. www.mysite.com/report/spain
  6. www.mysite.com/legal

I believe I will have to concentrate on the equivalent of mod_rewrite in Wildfly 8? Does anybody know a step-by-step how to for that? Or maybe a short explanation?

1条回答
Deceive 欺骗
2楼-- · 2019-06-03 11:52

You may also want to look at Rewrite, which will be the core of PrettyFaces 4. It's more dynamic and can intercept URLs if you require login.

http://www.ocpsoft.org/java/migrating-from-prettyfaces-to-rewrite-simplicity-meets-power/

http://www.mastertheboss.com/javaee/servlet-30/rewrite-a-java-ee-url-rewriting-solution

查看更多
登录 后发表回答