tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Loïc Lefèvre <llefe...@fivia.com>
Subject RE: Best way to...
Date Tue, 31 Jul 2001 10:37:49 GMT
Yes seems to be one response to my problems and perhaps your problems... ;)
What you have to do is to:

replace:

        <RequestInterceptor
            className="org.apache.tomcat.request.SimpleMapper1"
            debug="1" />

by

        <RequestInterceptor
            className="My Mapper"  <-- note it
            debug="1" />

then take SimpleMapper1.java (from the src .tar.gz file)
and play with it.

The point where you must work is in the "contextMap" method:

    public int contextMap( Request req )
    {
	log("contextMap( "+req.toString()+" )"); // return req.getRequestURI()

	String path = req.getRequestURI();

	if( path==null)
	    	throw new RuntimeException("ASSERT: null path in request URI");

	// Place to modify path...

	if( path.indexOf("?") >=0 )
		throw new RuntimeException("ASSERT: ? in requestURI");

	try
	{
	 	String host=req.getServerName();
	    	if(debug>0)
	    		cm.log("Host = " + host);

	    	Container container =(Container)map.getLongestPrefixMatch( host,
path );

	    	if( container == null )
			return 404;
	...

You see that the main problem is to find the good container from the path
else you got a "404 page not found error". So you can manage the path
variable to reflect what you want...

note: decompiling the class MatcherDemoApplet.class in the
jakarta-oro-2.04.tar.gz package
      could give you a way to manage it and thus enhance considerably Tomcat
servlet aliasing ;)

Loïc Lefèvre

If you can't have something...
Build it!

-----Message d'origine-----
De : Pier P. Fumagalli [mailto:pier@betaversion.org]
Envoyé : mardi 31 juillet 2001 12:15
À : tomcat-user@jakarta.apache.org
Objet : Re: Best way to...


Loïc Lefèvre at llefevre@fivia.com wrote:

> Hi,
> I would like to know what is the best way to
> change tomcat package?
>
> Encoutering many problems with mod_rewrite + tomcat serlvet aliasing,
> I want to plug some code to enhance the way url-pattern are managed
> (by using jakarta oro).
>
> Have someone already work with this?
> Any idea?

Do you want to do something like a mod_rewrite in Java for Tomcat? :)
Would be cool :) Can't you use a Servlet and a RequestDispatcher?

    Pier


Mime
View raw message