You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jeffrey Beckstrom <jb...@gcrta.org> on 2018/06/11 18:58:05 UTC

creation of virtual directories

We are looking at migrating from Glassfish to Tomcat. In Glassfish, we created alternatedocroot_N entries to map a path in Glassfish to a windows drive.

How do we perform a similar function in Tomcat?


Jeffrey Beckstrom
Lead Database Administrator
Information Technology Department
Greater Cleveland Regional Transit Authority
1240 W. 6th Street
Cleveland, Ohio 44113



Re: [OT] creation of virtual directories

Posted by Igal Sapir <is...@apache.org>.
On 6/13/2018 9:06 AM, Christopher Schultz wrote:
> The XML declaration (<?xml?>) is always optional, but does provide
> important information if it's different from the default.
> Specifically, it tells the parser what version of XML is being used
> (default: 1.0) and what character encoding is being used (default: UTF-8
> ).
>
> I would say that it's probably best to include the XML declaration,
> especially if the documents are expected to be read/written by humans.

Yep.  Makes sense.


Igal

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


creation of virtual directories

Posted by Jeffrey Beckstrom <jb...@gcrta.org>.
We are looking at migrating from Glassfish to Tomcat. In Glassfish, we created alternatedocroot_N entries to map a path in Glassfish to a windows drive.

How do we perform a similar function in Tomcat?


Jeffrey Beckstrom
Lead Database Administrator
Information Technology Department
Greater Cleveland Regional Transit Authority
1240 W. 6th Street
Cleveland, Ohio 44113



Re: creation of virtual directories

Posted by Jeffrey Beckstrom <jb...@gcrta.org>.
We would go with the latest which appears to be 9. Google found articles for V7 and one that said it changed in 8 but did not describe the change.
>>> Mark Thomas <ma...@apache.org> 6/11/18 3:06 PM >>>
On 11/06/18 19:58, Jeffrey Beckstrom wrote:
> We are looking at migrating from Glassfish to Tomcat. In Glassfish, we
> created alternatedocroot_N entries to map a path in Glassfish to a
> windows drive.
> 
> How do we perform a similar function in Tomcat?

Tomcat version? (it changed between 7.0.x and 8.0.x)

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


----------

This email has been scanned for spam and viruses. Visit the following link to report this email as spam:
https://attseg.cloud-protect.net/index01.php?mod_id=11&mod_option=logitem&mail_id=1528744019-gV-baVzK1ou7&r_address=jbeckstrom%40gcrta.org&report=1


Re: creation of virtual directories

Posted by Mark Thomas <ma...@apache.org>.
On 11/06/2018 20:11, Jeffrey Beckstrom wrote:
> We would go with the latest which appears to be 9. Google found articles 
> for V7 and one that said it changed in 8 but did not describe the change.

You want http://tomcat.apache.org/tomcat-9.0-doc/config/resources.html

You'd add something like this:

<Resources>
   <PostResources base="W:\some\path"
             className="org.apache.catalina.webresources.DirResourceSet"
           webAppMount="/"/>
</Resources>

Which would make the content of W:\some\path visible at the root of the 
web application. Note that normally handling will apply. So, for 
example, anything named *.jsp will get treated as as JSP page.

HTH,

Mark


>>>> Mark Thomas <ma...@apache.org> 6/11/18 3:06 PM >>>
> On 11/06/18 19:58, Jeffrey Beckstrom wrote:
>  > We are looking at migrating from Glassfish to Tomcat. In Glassfish, we
>  > created alternatedocroot_N entries to map a path in Glassfish to a
>  > windows drive.
>  >
>  > How do we perform a similar function in Tomcat?
> 
> Tomcat version? (it changed between 7.0.x and 8.0.x)
> 
> Mark
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> ----------
> 
> This email has been scanned for spam and viruses. Visit the following 
> link to report this email as spam:
> https://attseg.cloud-protect.net/index01.php?mod_id=11&mod_option=logitem&mail_id=1528744019-gV-baVzK1ou7&r_address=jbeckstrom%40gcrta.org&report=1
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: creation of virtual directories

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Jeffrey,

On 6/11/18 3:11 PM, Jeffrey Beckstrom wrote:
> We would go with the latest which appears to be 9. Google found
> articles for V7 and one that said it changed in 8 but did not
> describe the change.
>>>> Mark Thomas <ma...@apache.org> 6/11/18 3:06 PM >>>
> On 11/06/18 19:58, Jeffrey Beckstrom wrote:
>> We are looking at migrating from Glassfish to Tomcat. In
>> Glassfish, we created alternatedocroot_N entries to map a path in
>> Glassfish to a windows drive.
>> 
>> How do we perform a similar function in Tomcat?
> 
> Tomcat version? (it changed between 7.0.x and 8.0.x)

You are looking for "resources"[1] (not to be confused with
"resources"[2] or "JNDI resources"[3]).

You want to use <PreResources> or <PostResources> inside <Resources>
inside your <Context> element in META-INF/context.xml.

In general, I'd recommend using <PostResources> for non-code files,
because you don't want a user to be able to upload a file which then
takes precedence over a file or library that comes with your application
.

Note that resources are *cached by default*, so if you have dynamic
changes to the filesystem (e.g. file-uploads, separate processed
making changes to the fs, etc.) then you'll want to disable that.

Hope that helps,
- -chris

[1] http://tomcat.apache.org/tomcat-9.0-doc/config/resources.html
[2] http://tomcat.apache.org/tomcat-9.0-doc/config/globalresources.html
[3] http://tomcat.apache.org/tomcat-9.0-doc/jndi-resources-howto.html
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlsf1jYACgkQHPApP6U8
pFg5EBAAxxEGTUpLisTCMJ2kOIVRwmaj+hkrzo7LbsH/M4JXqoBftKpaM43MyyXz
86Y5GbDGjhJVp1fdKAcI/gFdfI0HAJlbuUAZqYsp6Qd5YEPraw5SJfO5vbwVh7Z1
VffWNlGOd/YYa7OCYY1x1NRCon/dQI5wBdHKjeNeqd9TH65lpnLkygpnet7qWM4O
L1s4OtvzUHlHY0XXYoSN4yiFco/o8jnWxMAZFCF+NncC1yU18qQLh3jOpefKmlvb
i/VTkhMPaA7o9E+VdXe5dA48TlSqOVwXQJ7NNTIgIzRxF7i1TAk9Lj9NkJD3wrTd
ZAUu56w5BaIaPq0E46T5IVczbmWpIdMjRx0DYQN77z2nhxULLBmmOI9aiIpa4brE
jX3IH4H6e5LqK9croDbnlB38P4LzhJJGLFaF5tvoteRV0FulFcVaJblVzarjheR3
Sy7tRrnk+9MwwWw2xhEjB3CjKsJzh3LU/9eI/TD8o7fl7g9IJDJ8+eZCRQQSUqBR
O11XYL0/rSwKW2pxdav+TO84o1I72oxPklyCNMyZ0Ty7/XA3hO6P3LnxdUBzt9NB
mZGRsSwU2YPPNXFtSZS0gM6LBlpv3/9wK0cbAibXlraVu2P7jOQ/DPPkZX8y3Yh9
AwmIE0IpktlBG48Oy0Tq5yDDEs6srwGi7SNuN7FoQUvONz5UEls=
=oqLS
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: creation of virtual directories

Posted by Jeffrey Beckstrom <jb...@gcrta.org>.
Do I enter this information into a GUI or directly into a file. If a file, what file? This may seem basic but have never touched Tomcat before.
>>> Mark Thomas <ma...@apache.org> 6/12/18 11:39 AM >>>
On 11/06/2018 20:11, Jeffrey Beckstrom wrote:
> We would go with the latest which appears to be 9. Google found articles 
> for V7 and one that said it changed in 8 but did not describe the change.

You want http://tomcat.apache.org/tomcat-9.0-doc/config/resources.html


You'd add something like this:

<Resources>
   <PostResources base="W:\some\path"
			 className="org.apache.catalina.webresources.DirResourceSet"
		   webAppMount="/"/>
</Resources>

Which would make the content of W:\some\path visible at the root of the 
web application. Note that normally handling will apply. So, for 
example, anything named *.jsp will get treated as as JSP page.

HTH,

Mark


>>>> Mark Thomas <ma...@apache.org> 6/11/18 3:06 PM >>>
> On 11/06/18 19:58, Jeffrey Beckstrom wrote:
>  > We are looking at migrating from Glassfish to Tomcat. In Glassfish, we
>  > created alternatedocroot_N entries to map a path in Glassfish to a
>  > windows drive.
>  >
>  > How do we perform a similar function in Tomcat?
> 
> Tomcat version? (it changed between 7.0.x and 8.0.x)
> 
> Mark
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> ----------
> 
> This email has been scanned for spam and viruses. Visit the following 
> link to report this email as spam:
> https://attseg.cloud-protect.net/index01.php?mod_id=11&mod_option=logitem&mail_id=1528744019-gV-baVzK1ou7&r_address=jbeckstrom%40gcrta.org&report=1

> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


----------

This email has been scanned for spam and viruses. Visit the following link to report this email as spam:
https://attseg.cloud-protect.net/index01.php?mod_id=11&mod_option=logitem&mail_id=1528817962-Ncrr7YHBFuFg&r_address=jbeckstrom%40gcrta.org&report=1


Re: creation of virtual directories

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Jeffrey,

On 6/12/18 1:21 PM, Jeffrey Beckstrom wrote:
> Do I enter this information into a GUI or directly into a file. If
> a file, what file? This may seem basic but have never touched
> Tomcat before.
>>>> Mark Thomas <ma...@apache.org> 6/12/18 11:39 AM >>>
> On 11/06/2018 20:11, Jeffrey Beckstrom wrote:
>> We would go with the latest which appears to be 9. Google found
>> articles for V7 and one that said it changed in 8 but did not
>> describe the change.
> 
> You want
> http://tomcat.apache.org/tomcat-9.0-doc/config/resources.html
> 
> 
> You'd add something like this:
> 
> <Resources> <PostResources base="W:\some\path" 
> className="org.apache.catalina.webresources.DirResourceSet" 
> webAppMount="/"/> </Resources>
> 
> Which would make the content of W:\some\path visible at the root of
> the web application. Note that normally handling will apply. So,
> for example, anything named *.jsp will get treated as as JSP page.

You'll want to edit your web application's META-INF/context.xml file.

If no such file exists, create a new one with this in it:

<Context>
</Context>

Then nest everything else inside that XML element wrapper.

- -chris

>>>>> Mark Thomas <ma...@apache.org> 6/11/18 3:06 PM >>>
>> On 11/06/18 19:58, Jeffrey Beckstrom wrote:
>>> We are looking at migrating from Glassfish to Tomcat. In
>>> Glassfish, we created alternatedocroot_N entries to map a path
>>> in Glassfish to a windows drive.
>>> 
>>> How do we perform a similar function in Tomcat?
>> 
>> Tomcat version? (it changed between 7.0.x and 8.0.x)
>> 
>> Mark
>> 
>> ---------------------------------------------------------------------
>>
>> 
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>> 
>> 
>> ----------
>> 
>> This email has been scanned for spam and viruses. Visit the
>> following link to report this email as spam:
>> 
> https://attseg.cloud-protect.net/index01.php?mod_id=11&mod_option=logi
tem&mail_id=1528744019-gV-baVzK1ou7&r_address=jbeckstrom%40gcrta.org&rep
ort=1
>
> 
>> 
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>>
>> 
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>> 
> 
> ---------------------------------------------------------------------
>
> 
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> ----------
> 
> This email has been scanned for spam and viruses. Visit the
> following link to report this email as spam: 
> https://attseg.cloud-protect.net/index01.php?mod_id=11&mod_option=logi
tem&mail_id=1528817962-Ncrr7YHBFuFg&r_address=jbeckstrom%40gcrta.org&rep
ort=1
>
> 
> 
> 
> 
> ---------------------------------------------------------------------
>
> 
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlsgB2oACgkQHPApP6U8
pFgmYA//YZpc1vRGdk8t0GGKquEmhj/9e8ok685VUHnKS2e2W8OHRb9Akwbilss9
uNCvxe+Scmd2QQvjVqaxk0FCZFqp8QuXIEoQdvZmsan+YIV7L6uh/fTfIepT/eqU
XgfA5IDAQ1KtdDidNBH/nh7SppxsmTmigp6mvT56ik+E2+l89uW0K76zr9sDM/GI
S96IueOsEip576xlSC27f4SypXmf7c9LZPeNy1gUBElgQx4pmLWGDDzEDQ6Vjty/
se37tjRc3B/iGbddH9rUh5YJ9d5tpirbqKzBOup8tQbfeIz814M6c40jI4OUtICV
m26Ae5i+DUTHwVsH4pF0T2DEEvBbeIqA6yfruKtpcpVXBJOSCHWcvxVy73lOr0Ce
SqGGGklMpD3Xc4kV8XpdAjr5s+lJniCavpP3E2HKlh5N5gGMEV+C9efqaNyC6Jwq
YS5d7TWd8BbxNXDtffWuS3hzYNbeOotWLhZTNUlbiq/Xbe1ZB7j4okkCoVCvSLG7
mgYMMJtEX2JxqN2fTgPe4Mo4XU9CnTRhZnIYJFWUFbkjeprPRGbnQssVP6mCWZzu
um2ANMOvZGS2l8KnY8CVxO43XLscwi5KxBtvz3hZGVPyH+h6MxeaVn/K/xCqwUJk
idwNzNJXUUUl1+BW5Rosx5V4KamPvppSYPuB/0CSK9AGbZAyTSg=
=MaX7
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: creation of virtual directories

Posted by "Igal @ Lucee.org" <ig...@lucee.org>.
On 6/12/2018 10:48 AM, Christopher Schultz wrote:
> <snip/>
>> You want
>> http://tomcat.apache.org/tomcat-9.0-doc/config/resources.html
>>
>>
>> You'd add something like this:
>>
>> <Resources> <PostResources base="W:\some\path"
>> className="org.apache.catalina.webresources.DirResourceSet"
>> webAppMount="/"/> </Resources>
>>
>> Which would make the content of W:\some\path visible at the root of
>> the web application. Note that normally handling will apply. So,
>> for example, anything named *.jsp will get treated as as JSP page.
> You'll want to edit your web application's META-INF/context.xml file.
>
> If no such file exists, create a new one with this in it:
>
> <Context>
> </Context>
>
> Then nest everything else inside that XML element wrapper.
I thought that the XML declaration is required but testing shows that it 
is not, and that the above example works (further investigation revealed 
that in XML 1.1 the declaration is required but we're using XML 1.0 here).

Good to know.


Igal

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT] creation of virtual directories

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Igal,

On 6/12/18 2:09 PM, Igal @ Lucee.org wrote:
> On 6/12/2018 10:48 AM, Christopher Schultz wrote:
>> <snip/>
>>> You want 
>>> http://tomcat.apache.org/tomcat-9.0-doc/config/resources.html
>>> 
>>> 
>>> You'd add something like this:
>>> 
>>> <Resources> <PostResources base="W:\some\path" 
>>> className="org.apache.catalina.webresources.DirResourceSet" 
>>> webAppMount="/"/> </Resources>
>>> 
>>> Which would make the content of W:\some\path visible at the
>>> root of the web application. Note that normally handling will
>>> apply. So, for example, anything named *.jsp will get treated
>>> as as JSP page.
>> You'll want to edit your web application's META-INF/context.xml
>> file.
>> 
>> If no such file exists, create a new one with this in it:
>> 
>> <Context> </Context>
>> 
>> Then nest everything else inside that XML element wrapper.
> I thought that the XML declaration is required but testing shows
> that it is not, and that the above example works (further
> investigation revealed that in XML 1.1 the declaration is required
> but we're using XML 1.0 here).
> 
> Good to know.

The XML declaration (<?xml?>) is always optional, but does provide
important information if it's different from the default.
Specifically, it tells the parser what version of XML is being used
(default: 1.0) and what character encoding is being used (default: UTF-8
).

I would say that it's probably best to include the XML declaration,
especially if the documents are expected to be read/written by humans.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlshQQ0ACgkQHPApP6U8
pFgjjxAAhivdr5C9PgtP6V5Ahmw97t/Up/rwmDw0Q7SWNmg4TDXn9bcUmWIWxUcO
W0v696vrh5gUrbiuP4VqBOoadPjGC6y56u6gmVsJHtkyZxvlV7gc/V6bxqJCmrgX
p54zOMH5U398wTigEfDC5PnO5WqdlE4YKzKno6pYa4qJDAxX+lkXpNVjtDxOhXO7
W9vdlVYBahd7ZDOcV8xDPpK9EMciDOQ7QWRm0nxGHN1QkTcnTNUkFDiW863s3cV3
W0GcSbZbQREv2cJgU7KJwjBwXMyzRf2bjDTiWwWZhUqJ8FZb1FJGPrU0E9WMc9Qj
p3KpIt/JoxfbHNLOf7b0q8z2QbfXEbyHQ4NBtOl5tsoYrLP7PhaL9RpD8Jq2JQzA
sc1//ssvV+d02VmVGdqgiJBvJxE5H7uIybyZ1AgTazUvl6D4cgDC9kKu7CmziTeA
OQO/OSJjYjH6gyImjCeiX86eC8+cF3w+ulmDtAaJMC2uZAW9g5AxO6ejxkoakcrs
DaDJ1W/8eny4OF3AAUoCxFZXzPzC4b5MM+IYQJF1Zh0mhZFmUJBTmxdZhYzaHpP7
q1CO5d+4gu3+UxzzWsju0M7ch/yd5XlWF+7zOTzGfiQY+bslGmMUXco03+3Olz/L
Fb6oV8B67SpAWfJNJVrRCpvEK/tQAPBvh3YxlehMes7YtrpKq7g=
=aOv1
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org