tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Warren Crossing <Warr...@nocode.com.au>
Subject RE: How to set extension mapping
Date Wed, 04 Apr 2001 06:43:55 GMT
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:lomesh@elitecore.com]
Sent: Wednesday, 4 April 2001 4:23 PM
To: tomcat-user@jakarta.apache.org
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.

Mime
View raw message