i think you need to set the mime type..
<mime-mapping>
<extension>xyz</extension>
<mime-type>text/html</mime-type>
</mime-mapping>
and you can also set it in the servlet response.setContentType ( "text/html"
) ;
you may also be able to add the following to TOMCAT_HOME/conf/web.xml to map
xyz to jsp ( and not write servlet )
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>
-----Original Message-----
From: Lomesh Contractor [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 4 April 2001 8:50 PM
To: [EMAIL PROTECTED]
Subject: RE: How to set extension mapping
Hi Warren,
ThanX a Lot for your help...it has solved my problem...
But i cant understand the behaviour of tomcat. When i changed the
global
web.xml (i.e. the web.xml reside in conf directory of tomcat) for my purpose
it didnt reflected but when i did same changes in my local web.xml ( i.e.
for my application context) its reflected..
When i made changes in the global web.xml file and when i made
request for
my specified extension ".xyz", its asking me to download that file, and the
whole file is downloaded.
Any Clue ???....!!!!
Regards,
Lomesh...
-----Original Message-----
From: Warren Crossing [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 04, 2001 12:14 PM
To: '[EMAIL PROTECTED]'
Subject: RE: How to set extension mapping
ok.. quickly..
add a servlet myRedirectServlet
<servlet>
<servlet-name>myRedirectServlet</servlet-name>
<servlet-class>com.nowhere.myRedirectServlet</servlet-class>
</servlet>
<servlet-mapping>
<url-pattern>*.xyz</url-pattern>
<servlet-name>myRedirectServlet</servlet-name>
</servlet-mapping>
the in the servlet ( pseudo code )
void service(ServletRequest req, ServletResponse res) {
String jsp = this.turnXyzPath2JspPath ( req.getContextPath(),
req.getServletPath() ) ;
getServletContext().getRequestDispatcher( jsp ).forward( req,res ) ;
}
turnXyzPath2JspPath ( ....
//remember to prepend the /
unless you want to write a request interceptor
-----Original Message-----
From: Lomesh Contractor [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 4 April 2001 4:23 PM
To: [EMAIL PROTECTED]
Subject: How to set extension mapping
Hi All,
Here is my question.
I want to map files with ".xyz" extension to be treated as a ".jsp"
file.
i.e. if any request comes with .xyz extension ( e.g.
http://myserver/mydomain/mydirectory/myfile.xyz )
and if myfile.xyz contains jsp code. So, for the above request the
myfile.xyz shud be compiled into servlet and then it shud send response
as
per the code written..
To achieve this type of extension mappping what steps i have to take
in
configuration of tomcat server.
Hoping for quick reply
Lomesh.