But the problems continued. Many things in Java web applications are based on the application "context path". Just to remember, we want our web application http://jboss:8080/appA/ (/appA being the context root) to be mapped to the user-friendly url http://domainA.net2tel.com.br/
Web pages generated by JSF contain actions and resources URLs like image source in img tags. But those links include the context path (in our case. /appA). The same applies to URLs generated by RichFaces. Unfortunately, as the application runs on a completely different URL, those generated links are incorrect and result in broken pages (missing images, css or scripts).
Fortunately, an Apache module permits to filter the output html and modify it on the fly: mod_proxy_html.
The following directive rewrites "/appA/" in the the links to "/"
ProxyHTMLURLMap /appA/ /
Of course, mod_proxy_html module should be installed for this to work. For module version older than 3.1, filtering is turned on using the following directive.
SetOutputFilter proxy-html(ProxyHTMLEnable On is used for more recent versions)
Another solution, using a custom ViewHandler, is described in the next serie's post: "JBoss & Apache: JSF, RichFaces and ViewHandler"

0 comments:
Post a Comment