Re: listing directory content outside tomcat root

2010-02-26 Thread Ivan Longhi
hi christopher,

On Thu, Feb 25, 2010 at 9:33 PM, Christopher Schultz
ch...@christopherschultz.net wrote:
 You shouldn't declare Context 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

2010-02-26 Thread Pid

On 26/02/2010 08:27, Ivan Longhi wrote:

hi christopher,

On Thu, Feb 25, 2010 at 9:33 PM, Christopher Schultz
ch...@christopherschultz.net  wrote:

You shouldn't declareContext  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

2010-02-25 Thread Tim Funk

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

 servlet
 servlet-namedefault/servlet-name
 
servlet-classorg.apache.catalina.servlets.DefaultServlet/servlet-class
 init-param
 param-namelistings/param-name
 param-valuefalse/param-value
 /init-param
 /servlet


conf/server.xml

.

   Host name=localhost  appBase=webapps
 unpackWARs=true autoDeploy=true
 xmlValidation=false xmlNamespaceAware=false

 Context path=/test docBase=/path_to_some_dir/
 Parameter name=listings value=true /
 /Context

..


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



Re: listing directory content outside tomcat root

2010-02-25 Thread Ivan Longhi
thanks!!!

this should be the solution (and one more little question at the end of code):

conf/web.xml

   servlet
   servlet-namedefault/servlet-name
   
servlet-classorg.apache.catalina.servlets.DefaultServlet/servlet-class
   init-param
   param-namelistings/param-name
   param-valuefalse/param-value !-- FALSE to avoid
inheritance to all webapps --
   /init-param
   /servlet


conf/server.xml

.

 Host name=localhost  appBase=webapps
   unpackWARs=true autoDeploy=true
   xmlValidation=false xmlNamespaceAware=false

   Context path=/test docBase=/path_to_some_dir/
   Parameter name=listings value=true /
   /Context

..


/path_to_some_dir/WEB-INF/web.xml


web-app ...
servlet
servlet-nametest/servlet-name

servlet-classorg.apache.catalina.servlets.DefaultServlet/servlet-class
init-param
param-namelistings/param-name
param-valuetrue/param-value
/init-param
load-on-startup1/load-on-startup
/servlet
servlet-mapping
servlet-nametest/servlet-name
url-pattern//url-pattern
/servlet-mapping
/web-app



is servlet-classorg.apache.catalina.servlets.DefaultServlet/servlet-class
the right solution?

thanks,
ivan

On Thu, Feb 25, 2010 at 1:19 PM, Tim Funk funk...@apache.org 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
 
     servlet
         servlet-namedefault/servlet-name

 servlet-classorg.apache.catalina.servlets.DefaultServlet/servlet-class
         init-param
             param-namelistings/param-name
             param-valuefalse/param-value
         /init-param
     /servlet
 

 conf/server.xml
 
 .

       Host name=localhost  appBase=webapps
             unpackWARs=true autoDeploy=true
             xmlValidation=false xmlNamespaceAware=false

         Context path=/test docBase=/path_to_some_dir/
             Parameter name=listings value=true /
         /Context

 ..
 

 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

2010-02-25 Thread Ivan Longhi
ops
Parameter name=listings value=true / is useless

On Thu, Feb 25, 2010 at 3:14 PM, Ivan Longhi ivan.lon...@gmail.com wrote:
       Context path=/test docBase=/path_to_some_dir/
           Parameter name=listings value=true /
       /Context

-- 
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

2010-02-25 Thread Caldarale, Charles R
 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.  url-pattern 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:

servlet
servlet-namelocalDefault/servlet-name

servlet-classorg.apache.catalina.servlets.DefaultServlet/servlet-class
init-param
param-namedebug/param-name
param-value0/param-value
/init-param
init-param
param-namelistings/param-name
param-valuetrue/param-value
/init-param
load-on-startup1/load-on-startup
/servlet
servlet-mapping
servlet-namelocalDefault/servlet-name
url-pattern//url-pattern
/servlet-mapping

 - 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

2010-02-25 Thread Caldarale, Charles R
 From: Ivan Longhi [mailto:ivan.lon...@gmail.com]
 Subject: Re: listing directory content outside tomcat root
 
 is servlet-classorg.apache.catalina.servlets.DefaultServlet
 /servlet-class 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

2010-02-25 Thread Christopher Schultz
-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
 
servlet
servlet-namedefault/servlet-name

 servlet-classorg.apache.catalina.servlets.DefaultServlet/servlet-class
init-param
param-namelistings/param-name
param-valuefalse/param-value !-- FALSE to avoid
 inheritance to all webapps --
/init-param
/servlet
 

This should be the default, so no changes to conf/web.xml should be
necessary.

 conf/server.xml
 
 .
 
  Host name=localhost  appBase=webapps
unpackWARs=true autoDeploy=true
xmlValidation=false xmlNamespaceAware=false
 
Context path=/test docBase=/path_to_some_dir/
Parameter name=listings value=true /
/Context

You shouldn't declare Context 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, Parameter name=listings value=true / 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
 
 
 web-app ...
 servlet
 servlet-nametest/servlet-name
 
 servlet-classorg.apache.catalina.servlets.DefaultServlet/servlet-class
 init-param
 param-namelistings/param-name
 param-valuetrue/param-value
 /init-param
 load-on-startup1/load-on-startup
 /servlet
 servlet-mapping
 servlet-nametest/servlet-name
 url-pattern//url-pattern
 /servlet-mapping
 /web-app


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