• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSF application on Apacher web server and Tomcat

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a JSF based web application using facelets (XHTML). It works perfect on Tomcat. For demo purpose i deployed it on hosting server that uses apache web server integrated with tomcat. As i acces any xhtml page in IE it opens the Save dialog box to save the file reather than display it. In FireFox it display the file but no XHTML tag is parsed. So i guess currently apache server is trying to serve xhtml itself rather than fwding to tomcat and XHTML extension is not recognized.

I need two things to configure:

1- Configure apache to foward .xhtml requests to tomcat
2- Configure tomcat to server .xhtml files

For first if added follwoing lines to .htaccess file ( i don't have access to httpd.conf in shared hosting)
AddType application/xhtml+xml .xhtml
AddHandler jserv-servlet .xhtml

but it does work. Could you please share you experience what configurations i need to make it work at both Apache server and application web.xml etc

Thanks
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm afraid you're making the common mistake of confusing URLs with resource paths. Normally you wouldn't have an ".xhtml" extension on the URLs (I use ".jsf") and therefore there is no need to configure Apache to understand ".xhtml".

In any event, referencing the ".xhtml" resource directly doesn't work. You have to submit a JSF URL or the request won't be routed through the FacesServlet and the JSF processes won't be invoked - all it will do is return the xhtml source.

Also, it looks like you're not properly configured in the apache-to-Tomcat connector, since if you were, Apache wouldn't care about the extension on the URL - it would route all matching URLs to Tomcat.
 
anyz mick
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply Tim.
Here is my FacesServlet mapping to serve xhtml in web.xml file:


and default suffix:


I do call xhtml files diretly e.g. http://myserver/myApp/login.xhtml.
I have links directly pointing to xhtml files. You are correct that FacesServlet is not capturing the xhtml URLs and source is returned back. But how can i fix it?
 
anyz mick
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using JSF 1.2 with rich faces. I followed similar thread at https://coderanch.com/t/500479/JSF/java/JSF-Facelets but even URL like http://myserver/myapp/login.jsf not works. My FacesServlet is defined to catch *.xhtml. And its working perfect on Tomcat. Not getting it up on my hosting that has Apache server at front and integrated with Tocmat.

 
Why is the word "abbreviation" so long? And this ad is so short?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic