Re: listing directory content outside tomcat root
On 26/02/2010 08:27, Ivan Longhi wrote: hi christopher, On Thu, Feb 25, 2010 at 9:33 PM, Christopher Schultz wrote: You shouldn't declare elements within conf/server.xml in any currently-supported version of Tomcat. Instead, put everything you need in your webapp's META-INF/context.xml file. Remember that "path" and "docBase" parameters are not allowed. ok, but since /path_to_some_dir/ is outside tomcat root ( $CATALINA_HOME ), how can I tell tomcat to look for /path_to_some_dir/META-INF/context.xml file? In that case, the method is to manually deploy the context.xml as conf/Catalina/hostname/appname.xml. You may set a docBase in this situation. p - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: listing directory content outside tomcat root
hi christopher, On Thu, Feb 25, 2010 at 9:33 PM, Christopher Schultz wrote: > You shouldn't declare elements within conf/server.xml in any > currently-supported version of Tomcat. Instead, put everything you need > in your webapp's META-INF/context.xml file. Remember that "path" and > "docBase" parameters are not allowed. ok, but since /path_to_some_dir/ is outside tomcat root ( $CATALINA_HOME ), how can I tell tomcat to look for /path_to_some_dir/META-INF/context.xml file? -- ciao, ivan - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: listing directory content outside tomcat root
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ivan, On 2/25/2010 9:14 AM, Ivan Longhi wrote: > this should be the solution (and one more little question at the end of code): > > conf/web.xml > > >default > > org.apache.catalina.servlets.DefaultServlet > >listings >false > > > This should be the default, so no changes to conf/web.xml should be necessary. > conf/server.xml > > . > > unpackWARs="true" autoDeploy="true" >xmlValidation="false" xmlNamespaceAware="false"> > > > > You shouldn't declare elements within conf/server.xml in any currently-supported version of Tomcat. Instead, put everything you need in your webapp's META-INF/context.xml file. Remember that "path" and "docBase" parameters are not allowed. Also, has no effect whatsoever on your configuration. You can remove it. Given that, you don't even need a META-INF/context.xml since there's nothing to add to the default. > /path_to_some_dir/WEB-INF/web.xml > > > > > test > > org.apache.catalina.servlets.DefaultServlet > > listings > true > > 1 > > > test > / > > The above changes to WEB-INF/web.xml are all you need. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkuG3p8ACgkQ9CaO5/Lv0PDx2gCguuCNrDrO4sy2HChs99FKotYZ VlkAnAsk0dyM1Kv8ckFuHxiSxW2MH3TT =csil -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: listing directory content outside tomcat root
> From: Ivan Longhi [mailto:ivan.lon...@gmail.com] > Subject: Re: listing directory content outside tomcat root > > is org.apache.catalina.servlets.DefaultServlet > the right solution? Yes. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: listing directory content outside tomcat root
> From: Tim Funk [mailto:funk...@apache.org] > Subject: Re: listing directory content outside tomcat root > > Since the default servlet is declared in conf/web.xml - its inherited > in *every* webapp. So its config is also inherited. (Bummer) Not a bummer at all - it's a very good thing. > BUT - if you add a WEB-INF/web.xml to EVERY webapp with the default > servlet settings - then you can remove the default servlet config from > conf/web.xml and have the default servlet per webapp config. Not needed and way more work than necessary. > What I forget is - what happens if you only create > /path_to_some_dir/WEB-INF/web.xml and leave conf/web.xml > alone. Which of course would be the easiest thing to do. And it's what you should do. elements in a webapp's WEB-INF/web.xml override the ones in the global conf/web.xml, so put the following in /path_to_some_dir/WEB-INF/web.xml: localDefault org.apache.catalina.servlets.DefaultServlet debug 0 listings true 1 localDefault / - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: listing directory content outside tomcat root
ops is useless On Thu, Feb 25, 2010 at 3:14 PM, Ivan Longhi wrote: > > > -- ciao, ivan - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: listing directory content outside tomcat root
thanks!!! this should be the solution (and one more little question at the end of code): conf/web.xml default org.apache.catalina.servlets.DefaultServlet listings false conf/server.xml . .. /path_to_some_dir/WEB-INF/web.xml test org.apache.catalina.servlets.DefaultServlet listings true 1 test / is org.apache.catalina.servlets.DefaultServlet the right solution? thanks, ivan On Thu, Feb 25, 2010 at 1:19 PM, Tim Funk wrote: > Enable listings is "sort of"** a global setting. > > Since the default servlet is declared in conf/web.xml - its inherited in > *every* webapp. So its config is also inherited. (Bummer) > > BUT - if you add a WEB-INF/web.xml to EVERY webapp with the default servlet > settings - then you can remove the default servlet config from conf/web.xml > and have the default servlet per webapp config. > > That means - in docBase="/path_to_some_dir/" --> you need > /path_to_some_dir/WEB-INF/web.xml > > What I forget is - what happens if you only create > /path_to_some_dir/WEB-INF/web.xml and leave conf/web.xml alone. Which of > course would be the easiest thing to do. > > > -Tim > > On 2/25/2010 6:22 AM, Ivan Longhi wrote: >> >> hi, >> I would like to list the content of a directory outside tomcat root >> without enabling the listings parameter in default servlet. >> >> conf/web.xml >> >> >> default >> >> org.apache.catalina.servlets.DefaultServlet >> >> listings >> false >> >> >> >> >> conf/server.xml >> >> . >> >> > unpackWARs="true" autoDeploy="true" >> xmlValidation="false" xmlNamespaceAware="false"> >> >> >> >> >> >> .. >> >> >> if I try to get a file inside the dir it works ( >> http://localhost:8080/test/some_file.txt ) but if I try to list the >> content of the directory ( http://localhost:8080/test/ ) I get 404. > > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > > -- ciao, ivan - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: listing directory content outside tomcat root
Enable listings is "sort of"** a global setting. Since the default servlet is declared in conf/web.xml - its inherited in *every* webapp. So its config is also inherited. (Bummer) BUT - if you add a WEB-INF/web.xml to EVERY webapp with the default servlet settings - then you can remove the default servlet config from conf/web.xml and have the default servlet per webapp config. That means - in docBase="/path_to_some_dir/" --> you need /path_to_some_dir/WEB-INF/web.xml What I forget is - what happens if you only create /path_to_some_dir/WEB-INF/web.xml and leave conf/web.xml alone. Which of course would be the easiest thing to do. -Tim On 2/25/2010 6:22 AM, Ivan Longhi wrote: hi, I would like to list the content of a directory outside tomcat root without enabling the listings parameter in default servlet. conf/web.xml default org.apache.catalina.servlets.DefaultServlet listings false conf/server.xml . .. if I try to get a file inside the dir it works ( http://localhost:8080/test/some_file.txt ) but if I try to list the content of the directory ( http://localhost:8080/test/ ) I get 404. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org