You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Robert Boyle <ro...@yahoo.com.INVALID> on 2014/09/14 22:55:36 UTC

Setting CacheTTL on Apache Tomcat 8

Hi, 

 

Here's what I'm trying to do: 

 

I'm building a web-based cueing system for a theatre. Until I figure out how
to use WebSockets, my system will use JavaScript to refresh the webpage
every second with a "cue status file". This is an HTML file built on the fly
by VB (or Python). One second latency is no problem.  

 

The problem: 

 

Unfortunately (for this application) Tomcat caches the web page internally
for 5 seconds by default, so the maximum cumulative latency is 6 seconds
which is a bit much.  

I believe I can change this by setting the CacheTTL parameter but, when I
try to do this in BASEDIR/conf/context.xml  by adding the line 

<cacheTTL=1000>, the server won't start and spews out many lines of error
messages.

 

I am a total newcomer to Tomcat but I've spend some hours trying to find
examples of config files on the web with little success. 

Obviously I haven't understood the syntax required here so any help is
gratefully received.

 

Environment:

Tomcat 8.0.12

Windows 7 / 32bit

 

 

Robert 

 

 


Re: Setting CacheTTL on Apache Tomcat 8

Posted by Mark Eggers <it...@yahoo.com.INVALID>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 9/14/2014 3:39 PM, Konstantin Kolinko wrote:
> 2014-09-15 2:04 GMT+04:00 André Warnier <aw...@ice-sa.com>:
>> Mark Eggers wrote:
>>> 
>>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
>>> 
>>> On 9/14/2014 1:55 PM, Robert Boyle wrote:
>>>> 
>>>> Hi,
>>>> 
>>>> 
>>>> 
>>>> Here's what I'm trying to do:
>>>> 
>>>> 
>>>> 
>>>> I'm building a web-based cueing system for a theatre. Until
>>>> I figure out how to use WebSockets, my system will use
>>>> JavaScript to refresh the webpage every second with a "cue
>>>> status file". This is an HTML file built on the fly by VB (or
>>>> Python). One second latency is no problem.
>>>> 
>>>> 
>>>> 
>>>> The problem:
>>>> 
>>>> 
>>>> 
>>>> Unfortunately (for this application) Tomcat caches the web
>>>> page internally for 5 seconds by default, so the maximum
>>>> cumulative latency is 6 seconds which is a bit much.
>>>> 
>>>> I believe I can change this by setting the CacheTTL parameter
>>>> but, when I try to do this in BASEDIR/conf/context.xml  by
>>>> adding the line
>>>> 
>>>> <cacheTTL=1000>, the server won't start and spews out many
>>>> lines of error messages.
>>>> 
>>>> 
>>>> 
>>>> I am a total newcomer to Tomcat but I've spend some hours
>>>> trying to find examples of config files on the web with
>>>> little success.
>>>> 
>>>> Obviously I haven't understood the syntax required here so
>>>> any help is gratefully received.
>>>> 
>>>> 
>>>> 
>>>> Environment:
>>>> 
>>>> Tomcat 8.0.12
>>>> 
>>>> Windows 7 / 32bit
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> Robert
>>> 
>>> 
>>> Robert,
>>> 
>>> That doesn't appear to be available in Tomcat 8 (quick view of
>>> the Javadoc).
>>> 
>>> Also, I tried the following (after reading the 7.x docs) which
>>> failed as expected.
>>> 
>>> <Context cacheTTL="1000"> </Context>
>>> 
>>> In Tomcat 7 (7.0.55), you can set this with the following
>>> syntax.
>>> 
>>> <Context cacheTTL="1000"> </Context>
>>> 
>>> See the reference here:
>>> 
>>> http://tomcat.apache.org/tomcat-7.0-doc/config/context.html
>>> 
>>> 7.0.55 has WebSockets.
>>> 
>>> . . . just my two cents /mde/
>> 
>> 
>> And mine : 
>> https://tomcat.apache.org/tomcat-6.0-doc/config/context.html#Attributes
>>
>>
>> 
In 6.0, these Context - cache* attributes seem to have been there, but they
>> have disappeared in 8.0.
>> 
>> 
>> Or at least in the doc : 
>> https://tomcat.apache.org/tomcat-8.0-doc/config/context.html#Attributes
>
>> 
> 
> In Tomcat 8 it is <Context> <Resources cacheTTL="1000"/> 
> </Context>
> 
> http://tomcat.apache.org/tomcat-8.0-doc/config/resources.html 
> http://tomcat.apache.org/migration-8.html#Web_application_resources
>
> 
> 
>>>> when I try to do this in BASEDIR/conf/context.xml  by adding
>>>> the line
> 
> 1. conf/context.xml is the default Context configuration file,
> shared by all web applications. You would better create a file for
> your own web application, instead of modifying the defaults.
> 
>>>> 
>>>> <cacheTTL=1000>, the server won't start and spews out many
>>>> lines of ...
> 
> 2. The above line is not syntacticly valid to appear in an XML
> file.
> 
> http://en.wikipedia.org/wiki/XML 
> http://www.xmlnews.org/docs/xml-basics.html
> 
> 
> 
> Best regards, Konstantin Kolinko
> 

Konstantin,

Thanks for that. I forgot to look in the Resources section.

. . . makes sense, now that I think about it
/mde/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (MingW32)

iQEcBAEBAgAGBQJUFhnIAAoJEEFGbsYNeTwttuUH/A5GZi1qMz4qLbs4FDDIQeRE
21hWRP6GgjfwcEnT2rPeChx6M5r94Y+axzwFNQ2Ts18wR9aJPTU3YbbPRQQWn2LV
28wk//Nz9pdzhhTucvIW95IjLKUJvJu8bBpo7SqQOighLNQo2U1beLbLj3m97395
v8i9a/bVtmE217Gv0eNRwm4k1gxIfLfhR29694G9S3SWD2SgdKyfeKcP4BC4hYom
P4L1JAVstl4y3EMRlXiPzNx9sVyUtyNFVKxDeF1nzSoxo2PKr3sRWNlUreXbCFzC
wsRwJAH7v8wA/VlNonbNmwpGYzweBVDQau36A1QMQwq8sj0mUAJpHhuEiLRkSQ8=
=ym0K
-----END PGP SIGNATURE-----

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


Re: Setting CacheTTL on Apache Tomcat 8

Posted by Konstantin Kolinko <kn...@gmail.com>.
2014-09-15 2:04 GMT+04:00 André Warnier <aw...@ice-sa.com>:
> Mark Eggers wrote:
>>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> On 9/14/2014 1:55 PM, Robert Boyle wrote:
>>>
>>> Hi,
>>>
>>>
>>>
>>> Here's what I'm trying to do:
>>>
>>>
>>>
>>> I'm building a web-based cueing system for a theatre. Until I
>>> figure out how to use WebSockets, my system will use JavaScript to
>>> refresh the webpage every second with a "cue status file". This is
>>> an HTML file built on the fly by VB (or Python). One second latency
>>> is no problem.
>>>
>>>
>>>
>>> The problem:
>>>
>>>
>>>
>>> Unfortunately (for this application) Tomcat caches the web page
>>> internally for 5 seconds by default, so the maximum cumulative
>>> latency is 6 seconds which is a bit much.
>>>
>>> I believe I can change this by setting the CacheTTL parameter but,
>>> when I try to do this in BASEDIR/conf/context.xml  by adding the
>>> line
>>>
>>> <cacheTTL=1000>, the server won't start and spews out many lines of
>>> error messages.
>>>
>>>
>>>
>>> I am a total newcomer to Tomcat but I've spend some hours trying to
>>> find examples of config files on the web with little success.
>>>
>>> Obviously I haven't understood the syntax required here so any help
>>> is gratefully received.
>>>
>>>
>>>
>>> Environment:
>>>
>>> Tomcat 8.0.12
>>>
>>> Windows 7 / 32bit
>>>
>>>
>>>
>>>
>>>
>>> Robert
>>
>>
>> Robert,
>>
>> That doesn't appear to be available in Tomcat 8 (quick view of the
>> Javadoc).
>>
>> Also, I tried the following (after reading the 7.x docs) which failed
>> as expected.
>>
>> <Context cacheTTL="1000">
>> </Context>
>>
>> In Tomcat 7 (7.0.55), you can set this with the following syntax.
>>
>> <Context cacheTTL="1000">
>> </Context>
>>
>> See the reference here:
>>
>> http://tomcat.apache.org/tomcat-7.0-doc/config/context.html
>>
>> 7.0.55 has WebSockets.
>>
>> . . . just my two cents
>> /mde/
>
>
> And mine :
> https://tomcat.apache.org/tomcat-6.0-doc/config/context.html#Attributes
>
> In 6.0, these Context - cache* attributes seem to have been there, but they
> have disappeared in 8.0.
>
>
> Or at least in the doc :
> https://tomcat.apache.org/tomcat-8.0-doc/config/context.html#Attributes


In Tomcat 8 it is
<Context>
  <Resources cacheTTL="1000"/>
</Context>

http://tomcat.apache.org/tomcat-8.0-doc/config/resources.html
http://tomcat.apache.org/migration-8.html#Web_application_resources


>>> when I try to do this in BASEDIR/conf/context.xml  by adding the
>>> line

1. conf/context.xml is the default Context configuration file, shared
by all web applications. You would better create a file for your own
web application, instead of modifying the defaults.

>>>
>>> <cacheTTL=1000>, the server won't start and spews out many lines of ...

2. The above line is not syntacticly valid to appear in an XML file.

http://en.wikipedia.org/wiki/XML
http://www.xmlnews.org/docs/xml-basics.html



Best regards,
Konstantin Kolinko

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


Re: Setting CacheTTL on Apache Tomcat 8

Posted by André Warnier <aw...@ice-sa.com>.
Mark Eggers wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 9/14/2014 1:55 PM, Robert Boyle wrote:
>> Hi,
>>
>>
>>
>> Here's what I'm trying to do:
>>
>>
>>
>> I'm building a web-based cueing system for a theatre. Until I
>> figure out how to use WebSockets, my system will use JavaScript to
>> refresh the webpage every second with a "cue status file". This is
>> an HTML file built on the fly by VB (or Python). One second latency
>> is no problem.
>>
>>
>>
>> The problem:
>>
>>
>>
>> Unfortunately (for this application) Tomcat caches the web page
>> internally for 5 seconds by default, so the maximum cumulative
>> latency is 6 seconds which is a bit much.
>>
>> I believe I can change this by setting the CacheTTL parameter but,
>> when I try to do this in BASEDIR/conf/context.xml  by adding the
>> line
>>
>> <cacheTTL=1000>, the server won't start and spews out many lines of
>> error messages.
>>
>>
>>
>> I am a total newcomer to Tomcat but I've spend some hours trying to
>> find examples of config files on the web with little success.
>>
>> Obviously I haven't understood the syntax required here so any help
>> is gratefully received.
>>
>>
>>
>> Environment:
>>
>> Tomcat 8.0.12
>>
>> Windows 7 / 32bit
>>
>>
>>
>>
>>
>> Robert
> 
> Robert,
> 
> That doesn't appear to be available in Tomcat 8 (quick view of the
> Javadoc).
> 
> Also, I tried the following (after reading the 7.x docs) which failed
> as expected.
> 
> <Context cacheTTL="1000">
> </Context>
> 
> In Tomcat 7 (7.0.55), you can set this with the following syntax.
> 
> <Context cacheTTL="1000">
> </Context>
> 
> See the reference here:
> 
> http://tomcat.apache.org/tomcat-7.0-doc/config/context.html
> 
> 7.0.55 has WebSockets.
> 
> . . . just my two cents
> /mde/

And mine : https://tomcat.apache.org/tomcat-6.0-doc/config/context.html#Attributes

In 6.0, these Context - cache* attributes seem to have been there, but they have 
disappeared in 8.0.


Or at least in the doc : 
https://tomcat.apache.org/tomcat-8.0-doc/config/context.html#Attributes


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


Re: Setting CacheTTL on Apache Tomcat 8

Posted by Mark Eggers <it...@yahoo.com.INVALID>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 9/14/2014 1:55 PM, Robert Boyle wrote:
> Hi,
> 
> 
> 
> Here's what I'm trying to do:
> 
> 
> 
> I'm building a web-based cueing system for a theatre. Until I
> figure out how to use WebSockets, my system will use JavaScript to
> refresh the webpage every second with a "cue status file". This is
> an HTML file built on the fly by VB (or Python). One second latency
> is no problem.
> 
> 
> 
> The problem:
> 
> 
> 
> Unfortunately (for this application) Tomcat caches the web page
> internally for 5 seconds by default, so the maximum cumulative
> latency is 6 seconds which is a bit much.
> 
> I believe I can change this by setting the CacheTTL parameter but,
> when I try to do this in BASEDIR/conf/context.xml  by adding the
> line
> 
> <cacheTTL=1000>, the server won't start and spews out many lines of
> error messages.
> 
> 
> 
> I am a total newcomer to Tomcat but I've spend some hours trying to
> find examples of config files on the web with little success.
> 
> Obviously I haven't understood the syntax required here so any help
> is gratefully received.
> 
> 
> 
> Environment:
> 
> Tomcat 8.0.12
> 
> Windows 7 / 32bit
> 
> 
> 
> 
> 
> Robert

Robert,

That doesn't appear to be available in Tomcat 8 (quick view of the
Javadoc).

Also, I tried the following (after reading the 7.x docs) which failed
as expected.

<Context cacheTTL="1000">
</Context>

In Tomcat 7 (7.0.55), you can set this with the following syntax.

<Context cacheTTL="1000">
</Context>

See the reference here:

http://tomcat.apache.org/tomcat-7.0-doc/config/context.html

7.0.55 has WebSockets.

. . . just my two cents
/mde/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (MingW32)

iQEcBAEBAgAGBQJUFg9AAAoJEEFGbsYNeTwt2iAIAIgm4SVWJt2iGonyH3IkY+P0
gza1nSmxlamMYt9ZBFeuBMRrBOP7rt1zXaIUzSif8gHfX5slrZG4ghrPgtklDpib
BuAms/7MY5cTWIOaHECZxNfbseOY+I94CZnjpqgdAnwuzKGIPUg7KCgFO9Pnk27/
CTRMpSaR1/flebVnWy5gpg4oG/OIFGKALdze5FNsBItQoyuLS+82ylOQYi3YxTLl
A0xlDBD+UXbPYIRm5pZ04S+55xEnG2gg3cb298Njx0bzoruKgcIn/UmEiz0iL1+3
RQC3tqsgN5PtYDZdMGE6DzJGlWpvWSr9rLmRgsUGYLbHv8n3l5X2XhDrzqzX9+Q=
=iis6
-----END PGP SIGNATURE-----

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


Re: Setting CacheTTL on Apache Tomcat 8

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

Robert,

On 9/14/14 4:55 PM, Robert Boyle wrote:
> Here's what I'm trying to do:
> 
> I'm building a web-based cueing system for a theatre. Until I
> figure out how to use WebSockets, my system will use JavaScript to
> refresh the webpage every second with a "cue status file". This is
> an HTML file built on the fly by VB (or Python). One second latency
> is no problem.
> 
> The problem:
> 
> Unfortunately (for this application) Tomcat caches the web page
> internally for 5 seconds by default, so the maximum cumulative
> latency is 6 seconds which is a bit much.
> 
> I believe I can change this by setting the CacheTTL parameter but,
> when I try to do this in BASEDIR/conf/context.xml  by adding the
> line
> 
> <cacheTTL=1000>, the server won't start and spews out many lines of
> error messages.
> 
> I am a total newcomer to Tomcat but I've spend some hours trying to
> find examples of config files on the web with little success.
> 
> Obviously I haven't understood the syntax required here so any help
> is gratefully received.

Simple solution: make the HTML file a dynamic resource that Tomcat
knows how to generate. That way, there is never any problem with cache
TTL, etc.

Why did you decide to update the HTML file with VB/Python and then
serve it through Tomcat?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJUFukSAAoJEBzwKT+lPKRYo7gQAI8CohVwGcEDLjgr1RN3ZT5H
l/rSSyniUuX0LSQyODaLSYAt7hmr+Kf6Y/pS03pOfn+Tw8KU4gcG8ZkOCxUS8cV/
pqwT844MXpeKF5oql4ManmDgOV7jZ6ivDyHOhDtaLM+iwCv9WGroYFpKTn5cuL6W
dKHRAC2o4GHV1CTqwoMBVv/kAASwXd5MWyMOMrXQnUFABxSp9nbkSvalXm6xWfZN
up31rR6MLILeQFelEQ6QucxyXBXyJbjr+iALM8cOEO8L1/dT/VxlYVdcGvCn5wSd
yr0gI9TzdZ5OsykO99ohBTLI6wKaS+83QbHbX8ybQAIc1z2sokSx0WTTTZhmHWof
xUTd0+6p37ueCu1G1RYaCcA7fhOt3rebUccHyGI0jdjuaOKmoxTgQ/67dqbXbpIr
fkeouwV1RLU5e0SISDXD6saBqBeZVH3vsN9RiSEOO8glmFmWHLTXLSYFkFDkBMbv
kq4vsHGwL5yxGzBa56BYWBl/BLzPtRV6ZqaO3IrhJUVh/i7zRQj9LvXeZHLiA2GF
H4amxQie778+2MQ/DwU2yYfxToHNYYYJNp2SETuDwk3mc/LK2vh+wr/C3c3WasOe
0P0F8c2fv138ecctDoKVXe54qYmhZ7zs0VSUgs3mIBxERkevA0kfN+JuWCf8U/6E
IOfAI3YC7hQZ6zru6i1u
=Qf+W
-----END PGP SIGNATURE-----

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