On Fri, Dec 8, 2017 at 3:36 PM, Mark Thomas <ma...@apache.org> wrote:
> On 08/12/17 18:49, Chris Cheshire wrote:
>> I have a directory resource set defined in my context.xml to handle images :
>>
>> <Resources>
>>   <PreResources className="org.apache.catalina.webresources.DirResourceSet"
>>                 base="${catalina.base}/cdn/p/images"
>>                 webAppMount="/images" />
>> </Resources>
>>
>> The /p in there actually represents the context path - a given sandbox
>> might have the same webapp deployed at different context paths
>> representing different development branches. Is it possible to use a
>> replacement parameter similar to catalina.base to replace the context
>> path the webapp is deployed at?
>
> Yes. You can use ant style property replacement in any XML file that is
> processed by the digester (server.xml, context.xml, web.xml)
>
> See the opening section of
>
> http://tomcat.apache.org/tomcat-9.0-doc/config/index.html
>
> for details.
>
> Mark
>

I logged the System properties and there is nothing in there for the
context path.

In catalina logs I see

08-Dec-2017 22:02:05.532 INFO [ajp-nio-8019-exec-1]
org.apache.catalina.core.ApplicationContext.log HTMLManager: restart:
Reloading web application '/p'
08-Dec-2017 22:02:05.533 INFO [ajp-nio-8019-exec-1]
org.apache.catalina.core.StandardContext.reload Reloading Context with
name [/p] has started
08-Dec-2017 22:02:14.596 INFO [ajp-nio-8019-exec-1]
org.apache.catalina.core.StandardContext.reload Reloading Context with
name [/p] is completed

It seems catalina knows the value of the context path for the webapp
when context.xml is being digested. Should I post an RFE on BZ to have
it added to the system properties, or am I incorrect in this
assumption?



>
>>
>> I tried following the source through for DirResourceSet but couldn't
>> see where even catalina.base is getting replaced.
>>
>> (I know ant is a solution and I eventually need it for other things
>> too, but I have never used it and it's not a learning rabbit-hole I
>> can go down right now)
>>

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

Reply via email to