Apache

Moderators: None (Apply to moderate this forum)
Number of threads: 150
Number of posts: 335

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
servlets generating for .html .xml requests Posted by Josh Code on 11 Jul 2007 at 9:52 PM
Is there a way to map addresses from html, xml, css and other path extensions to servlets? I want to find a way to have a server hide the dynamic sources of its html, xml, and other content.

I started implementing a server to do this but developing it is a lot of work. I set up a path mapping scheme which simply maps from for example page1.html to page1.jsp. If Tomcat can do this, it would be a huge help.
Report
Re: servlets generating for .html .xml requests Posted by zibadian on 11 Jul 2007 at 10:17 PM
: Is there a way to map addresses from html, xml, css and other path
: extensions to servlets? I want to find a way to have a server hide
: the dynamic sources of its html, xml, and other content.
:
: I started implementing a server to do this but developing it is a
: lot of work. I set up a path mapping scheme which simply maps from
: for example page1.html to page1.jsp. If Tomcat can do this, it
: would be a huge help.

Use AddHandler to link the servlet handler to the various extensions. For example (using isapi):
    AddHandler isapi-handler .htm

This will cause the apache to see all .htm files as isapi libraries.
If you want a specific servlet for each content, then you can configure it like this:
     Action ehtml-handler "/cgi-bin/htmlbuilder.dll"
     AddHandler ehtml-handler .htm  

     Action exml-handler "/cgi-bin/xmlbuilder.dll"
     AddHandler exml-handler .xml

     Action ejpg-handler "/cgi-bin/jpgbuilder.dll"
     AddHandler ejpg-handler .jpg

This is again based on isapi libraries, because I'm using this myself. I think tomcat can handle similar settings.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.