You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Marcus Crafter <cr...@fztig938.bank.dresdner.net> on 2001/05/22 15:35:50 UTC

[TC321] welcome-file-list behaviour

Hi All,

	Hope all is well!

	I've noticed in the TC321 source base that the 'welcome file' specified
	in the web.xml actually checks to see if this file exists before using
	it.

	See StaticInterceptor.java, lines 270, and 297

	270:
            File f = new File(dir, fileName);
            if (f.exists()) {
                return fileName;
            }

	297:
            if ((new File(retPath)).exists())
            {
                int pathPos = retPath.lastIndexOf (fbasen);
                return retPath.substring (pathPos);
            }

	(perhaps I'm looking at the wrong methods though ?)

	This potentially causes headaches for Cocoon 2 users, as in Cocoon 2
	it's possible to specify a URL which does not actually relate to a
	real file.

	eg: in a Cocoon 2 sitemap

	<!-- start page -->
	<map:match pattern="start.xml">
	  <map:generate type="serverpages" src="client/frontend/start.xml"/>
	  <map:transform src="stylesheets/html/start.xsl"/>
	  <map:serialize/>
	</map:match>

	(There are more complex examples, where the data may not even be
	located on the same system as tomcat itself)

	Having TC321 check for the existance of the file causes headaches
	because if a Cocoon 2 user does something like the above, they can't
	use that URL as the welcome file.

	Note, for "pure" Cocoon 2 applications this is however, not a problem
	as Cocoon 2 can handle the start page itself with an internal redirect.

	<!-- start page -->
	<map:match pattern="">
	  <map:redirect-to uri="start.xml"/>
	</map:match>

	However for hybrid environments where not all requests go through
	Cocoon 2 the above statement mightn't work - it depends on the
	particular servlet-mapping settings.

	Must Tomcat make this check for existance of the file ? Would it be
	ok if a suitable warning message is logged, but the welcome
	filename is still used ?

	Cheers,

	Marcus

-- 
        .....
     ,,$$$$$$$$$,      Marcus Crafter
    ;$'      '$$$$:    Computer Systems Engineer
    $:         $$$$:   Open Software Associates GmbH
     $       o_)$$$:   82-84 Mainzer Landstrasse
     ;$,    _/\ &&:'   60327 Frankfurt Germany
       '     /( &&&
           \_&&&&'     Email : Marcus.Crafter@osa.de
          &&&&.        Business Hours : +49 69 9757 200
    &&&&&&&:           After Hours    : +49 69 49086750