Re: Does Tomcat JDBC Connection Pool reset autocommit on closed connections?

2021-03-11 Thread Mark Thomas

On 12/03/2021 03:57, My Subs wrote:

Hello,

I'm using Tomcat 10.0.0.  Suppose I call setAutoCommit(false) on a connection 
obtained from a Tomcat JDBC Connection Pool.  Then I do some stuff with the 
connection, call commit() or rollback() and finally call close() on it without 
ever calling setAutocommit(true).

What will the autocommit state of that connection be, the next time the pool 
gives it to my code?  Will it be in the same state I left it, that is, with 
autocommit set to false, or will it be reverted back to the default state 
(autocommit set to true)?


The simplest way to be sure is to run a test with a pool size of 1.

A quick look at the code (I might have missed something) suggests that 
if defaultAutoCommit is configured then it will be reset to that default 
value. Otherwise it will be unchanged from when the connection was 
returned to the pool.


Mark

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



Re: Unable to read the orginal url when host header is specified.

2021-03-11 Thread Mark Thomas

On 12/03/2021 01:50, Anurag Sharma wrote:


My code is running on local host and i am hitting one of my urls as below

  curl -k -vv --http1.1 "https://localhost:8443/versa/login; -H 'Host: 
google.com'

Now i m a trying to read the url in my code using following

StringBuffer url = httpServletRequest.getRequestURL();

The value is always as follows whether the  protocal HTTP/1.1 or HTTP/2
https://google.com/versa/login

how to read the original url here?


Tomcat version?

Mark

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



Does Tomcat JDBC Connection Pool reset autocommit on closed connections?

2021-03-11 Thread My Subs
Hello,

I'm using Tomcat 10.0.0.  Suppose I call setAutoCommit(false) on a connection 
obtained from a Tomcat JDBC Connection Pool.  Then I do some stuff with the 
connection, call commit() or rollback() and finally call close() on it without 
ever calling setAutocommit(true). 

What will the autocommit state of that connection be, the next time the pool 
gives it to my code?  Will it be in the same state I left it, that is, with 
autocommit set to false, or will it be reverted back to the default state 
(autocommit set to true)?

Thank you!

Alex

Sent using Zoho Mail




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



Unable to read the orginal url when host header is specified.

2021-03-11 Thread Anurag Sharma

My code is running on local host and i am hitting one of my urls as below

 curl -k -vv --http1.1 "https://localhost:8443/versa/login; -H 'Host: 
google.com'

Now i m a trying to read the url in my code using following

StringBuffer url = httpServletRequest.getRequestURL();

The value is always as follows whether the  protocal HTTP/1.1 or HTTP/2
https://google.com/versa/login

how to read the original url here?



---

Thanks and Regards,

Anurag Sharma.


Re: WELCOME to users@tomcat.apache.org

2021-03-11 Thread Anurag Sharma
Hi

My code is running on local host and i am hitting one of my urls as below

 curl -k -vv --http1.1 "https://localhost:8443/versa/login; -H 'Host: 
google.com'

Now i m a trying to read the url in my code using following

StringBuffer url = httpServletRequest.getRequestURL();

The value is always as follows whether the  protocal HTTP/1.1 or HTTP/2
https://google.com/versa/login

how to read the original url here?


---

Thanks and Regards,

Anurag Sharma.


From: users-h...@tomcat.apache.org 
Sent: 11 March 2021 17:40
To: Anurag Sharma 
Subject: WELCOME to users@tomcat.apache.org

Hi! This is the ezmlm program. I'm managing the
users@tomcat.apache.org mailing list.

I'm working for my owner, who can be reached
at users-ow...@tomcat.apache.org.

Acknowledgment: I have added the address

   anur...@versa-networks.com

to the users mailing list.

Welcome to users@tomcat.apache.org!

Please save this message so that you know the address you are
subscribed under, in case you later want to unsubscribe or change your
subscription address.


--- Administrative commands for the users list ---

I can handle administrative requests automatically. Please
do not send them to the list address! Instead, send
your message to the correct command address:

To subscribe to the list, send a message to:
   

To remove your address from the list, send a message to:
   

Send mail to the following for info and FAQ for this list:
   
   

Similar addresses exist for the digest list:
   
   

To get messages 123 through 145 (a maximum of 100 per request), mail:
   

To get an index with subject and author for messages 123-456 , mail:
   

They are always returned as sets of 100, max 2000 per request,
so you'll actually get 100-499.

To receive all messages with the same subject as message 12345,
send a short message to:
   

The messages should contain one line or word of text to avoid being
treated as sp@m, but I will ignore their content.
Only the ADDRESS you send to is important.

You can start a subscription for an alternate address,
for example "john@host.domain", just add a hyphen and your
address (with '=' instead of '@') after the command word:


To stop subscription for this address, mail:


In both cases, I'll send a confirmation message to that address. When
you receive it, simply reply to it to complete your subscription.

If despite following these instructions, you do not get the
desired results, please contact my owner at
users-ow...@tomcat.apache.org. Please be patient, my owner is a
lot slower than I am ;-)

--- Enclosed is a copy of the request I received.

Return-Path: 
Received: (qmail 80583 invoked by uid 99); 12 Mar 2021 01:40:36 -
Received: from spamproc1-he-de.apache.org (HELO spamproc1-he-de.apache.org) 
(116.203.196.100)
by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Mar 2021 01:40:36 +
Received: from localhost (localhost [127.0.0.1])
by spamproc1-he-de.apache.org (ASF Mail Server at 
spamproc1-he-de.apache.org) with ESMTP id 6241A1FF39B
for 
;
 Fri, 12 Mar 2021 01:40:35 + (UTC)
X-Virus-Scanned: Debian amavisd-new at spamproc1-he-de.apache.org
X-Spam-Flag: NO
X-Spam-Score: 0.199
X-Spam-Level:
X-Spam-Status: No, score=0.199 tagged_above=-999 required=6.31
tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.2,
RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001]
autolearn=disabled
Authentication-Results: spamproc1-he-de.apache.org (amavisd-new);
dkim=pass (1024-bit key) header.d=versanetworks.onmicrosoft.com
Received: from mx1-ec2-va.apache.org ([116.203.227.195])
by localhost (spamproc1-he-de.apache.org [116.203.196.100]) 
(amavisd-new, port 10024)
with ESMTP id XeJgKn7lPAGk
for 
;
Fri, 12 Mar 2021 01:40:33 + (UTC)
Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=40.107.243.134; 
helo=nam12-dm6-obe.outbound.protection.outlook.com; 
envelope-from=anur...@versa-networks.com; receiver=
Received: from NAM12-DM6-obe.outbound.protection.outlook.com 
(mail-dm6nam12on2134.outbound.protection.outlook.com [40.107.243.134])
by mx1-ec2-va.apache.org (ASF Mail Server at mx1-ec2-va.apache.org) 
with ESMTPS id 70BEFBD09A
for 
;
 Fri, 12 Mar 2021 01:40:33 + (UTC)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 
b=d5WMtT+wHRhm6Vaux09IZJSxhuyixarP00zCWVw9arvAkg/mvX5iCVcdbcrxIjVhubbwzZGxfGWMABd04CBGjiEhwUqWfUP+qtL6R5bLMXImq8WXUKy8BlER1hHredOilgSisxQQl41TtxOwWYTsJ/NRT7zTW6V55np3avAcvxHnvbeAFpiAVArtRlUwMGqsx+Omdp754wvO0XUqoXqnsb0VTv7bDVCRYCEFWuxd6KFTUGYA68WqsQDesc8gQLspWNRwlKSj5u/SvKEPH9l+yqGY39+mF5Hd4yzg9v7jkRtTZpDah6x7UdKMgh1cVyQpkF7BWq2REs7J3ECxQKN5uQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
 s=arcselector9901;
 
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 

Re: Embedded Tomcat 9.0.43 : WINDOW_UPDATE not sent when receiving http2 requests over unknown url

2021-03-11 Thread Doug Whitfield


> It exists in all 8.5.x, 9.0.x and 10.0.x versions. It has been there
> since the beginning of HTTP/2 support.

Based on our testing the issue was introduced in 9.0.19 and 8.5.55 (we haven’t 
done any testing on the 10.x branch), which is slightly after the beginning of 
HTTP/2 support. I don’t know if that is helpful information, but I provide it 
in case that it is. Apologies for the second email. We were still discussing 
this internally a bit.

Thanks again for your work on this!


This e-mail may contain information that is privileged or confidential. If you 
are not the intended recipient, please delete the e-mail and any attachments 
and notify us immediately.



Re: Embedded Tomcat 9.0.43 : WINDOW_UPDATE not sent when receiving http2 requests over unknown url

2021-03-11 Thread Doug Whitfield

>I am working on a fix which I expect to be in the releases due out in ~1
> month's time.

Thanks Mark! Is there any chance of a patch being available before then that we 
might be able to backport locally?


This e-mail may contain information that is privileged or confidential. If you 
are not the intended recipient, please delete the e-mail and any attachments 
and notify us immediately.



Re: Embedded Tomcat 9.0.43 : WINDOW_UPDATE not sent when receiving http2 requests over unknown url

2021-03-11 Thread Mark Thomas

On 11/03/2021 19:09, Doug Whitfield wrote:




Just FYI:
I was able to reproduce this issue on 8.5.64 and 9.0.44. I’m going to start 
doing some testing in earlier versions of 8.5 to see if the issue exist there 
as well as far as regressions.


It exists in all 8.5.x, 9.0.x and 10.0.x versions. It has been there 
since the beginning of HTTP/2 support.


I am working on a fix which I expect to be in the releases due out in ~1 
month's time.


Mark

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



Re: module muddle

2021-03-11 Thread Mark Thomas

On 11/03/2021 19:08, Rob Sargent wrote:
I've started getting this error, though I've been running fine since 
days of "localhost" issue help.


    class org.apache.tomcat.dbcp.dbcp2.BasicDataSource cannot be cast to
    class org.apache.tomcat.jdbc.pool.DataSource
    (org.apache.tomcat.dbcp.dbcp2.BasicDataSource is in unnamed module
    of loader 'app'; org.apache.tomcat.jdbc.pool.DataSource is in
    unnamed module of loader
    org.apache.catalina.loader.ParallelWebappClassLoader @33c9efd6)

I'm most confused by the "'app'" loader.   Who's is that?  I doesn't 
look like a TC thing.  I have a package called "app" which includes the 
main() of my embedded server.


Apologies as I'm not fully up on the modules notion and was blissfully 
getting by without dealing with that.  Until now.  You can find me over 
in the Java Organization section of hell.


Which database connection pool do you want to use?

Tomcat's package renamed copy of Apache Commons DBCP
or
Tomcat's own JDBC Pool?

(there isn't much to choose between them these days).

How is the DataSource defined?

Do you know what code is triggering the failing cast?

The app loader is one of the class loaders in the standard Java class 
loader hierarchy. I forget the exact details. Google should be able to 
tell you that.


Mark

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



[ANN] Apache Tomcat 8.5.64 available

2021-03-11 Thread Mark Thomas

The Apache Tomcat team announces the immediate availability of Apache
Tomcat 8.5.64.

Apache Tomcat 8 is an open source software implementation of the Java
Servlet, JavaServer Pages, Java Unified Expression Language, Java
WebSocket and Java Authentication Service Provider Interface for
Containers technologies.

Apache Tomcat 8.5.x replaces 8.0.x and includes new features pulled
forward from the 9.0.x branch. The notable changes since 8.5.63 include:

- Improvements to Async and non-blocking IO error handling

- Improvements to handling of OpenSSL errors

- Align the behaviour when null is passed to the ServletResponse
  methods setCharacterEncoding(), setContentType() and setLocale()
  with the recent clarification from the Jakarta Servlet project of
  the expected behaviour in these cases.

Please refer to the change log for the complete list of changes:
http://tomcat.apache.org/tomcat-8.5-doc/changelog.html


Downloads:
http://tomcat.apache.org/download-80.cgi

Migration guides from Apache Tomcat 7.x and 8.0.x:
http://tomcat.apache.org/migration.html

Enjoy!

- The Apache Tomcat team


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



Re: Embedded Tomcat 9.0.43 : WINDOW_UPDATE not sent when receiving http2 requests over unknown url

2021-03-11 Thread Doug Whitfield
-Original Message-
From: Mark Thomas 
Sent: Wednesday, March 10, 2021 6:28 PM
To: users@tomcat.apache.org
Subject: Re: Embedded Tomcat 9.0.43 : WINDOW_UPDATE not sent when receiving 
http2 requests over unknown url

On 10/03/2021 05:26, Arshiya Shariff wrote:
> Hi All,
> We are using embedded tomcat version 9.0.43 in our application to transport 
> http/2 packets between 2 systems (h2c connection). All parameters used are 
> the tomcat defaults.
>
> We are facing the below issue :
>
>1.  Tomcat is not sending WINDOW_UPDATE when a request(payload > 65K) is 
> landed on an Unknown URL(which is not deployed as a servlet and not having  a 
> servlet mapping). The same is working when request landed on an known 
> URL(which is deployed as a servlet and has an servlet mapping).
>2.  Tomcat is listening on 1080 port, client is sending packet size of > 
> 65KB, but here tomcat receives only 65KB  and not receiving full DATA, later 
> tomcat sends RST_STREAM, further no WINDOW_UPDATE, after that client is not 
> able to send DATA frames as there is no WINDOW_UPDATE from tomcat.
>
>
> Kindly let us know whether it is a bug or not.

>> Certainly looks like a bug. I'll investigate now...

Just FYI:
I was able to reproduce this issue on 8.5.64 and 9.0.44. I’m going to start 
doing some testing in earlier versions of 8.5 to see if the issue exist there 
as well as far as regressions.



This e-mail may contain information that is privileged or confidential. If you 
are not the intended recipient, please delete the e-mail and any attachments 
and notify us immediately.



module muddle

2021-03-11 Thread Rob Sargent
I've started getting this error, though I've been running fine since 
days of "localhost" issue help.


   class org.apache.tomcat.dbcp.dbcp2.BasicDataSource cannot be cast to
   class org.apache.tomcat.jdbc.pool.DataSource
   (org.apache.tomcat.dbcp.dbcp2.BasicDataSource is in unnamed module
   of loader 'app'; org.apache.tomcat.jdbc.pool.DataSource is in
   unnamed module of loader
   org.apache.catalina.loader.ParallelWebappClassLoader @33c9efd6)

I'm most confused by the "'app'" loader.   Who's is that?  I doesn't 
look like a TC thing.  I have a package called "app" which includes the 
main() of my embedded server.


Apologies as I'm not fully up on the modules notion and was blissfully 
getting by without dealing with that.  Until now.  You can find me over 
in the Java Organization section of hell.


rjs


Re: [OT] Linux EC2 Java Gremlin

2021-03-11 Thread Christopher Schultz

Jerry,

On 3/11/21 12:39, Jerry Malcolm wrote:
Not directly a tomcat question... but since TC runs on java, maybe 
someone here has some suggestions.  I am running a development/sandbox 
server on AWS EC2, Linux 2.  Only I and one other person have access to 
it.  Yesterday I was browsing through some pages on my site when all of 
a sudden I started getting errors that all of my java classes were 
compiled with a later version than the JVM.  I recognized the error from 
past experiences.  My apps are built with Java 11, and TC is apparently 
now running on Java 8.  I logged into the console, and yes, my EC2 had 
somehow changed to default to Java8.  I changed it back, and everything 
is fine.  Except for the 'what happened?' part of it. We were doing an 
AMI snapshot around that time which may have rebooted the EC2.  But 
neither of us were doing anything in the area of changing the default 
jvm.  We are launching live in a couple of days.  So obviously 
unexplained magic like this is a bit unnerving.


I know it's just speculation.  But I'm just curious if anybody has 
experienced anything similar to this.  Any ideas why linux might decide 
to automatically fall back to an older version of java?


I think AWS's CLI tools require Java 8, so it's possible you'll end up 
with side-by-side installations of JVMs. The difference between success 
and failure ends up being the value of $JAVA_HOME.


How are you launching Tomcat? If you ensure that the launch scripts for 
Tomcat are always properly setting JAVA_HOME or are using a static path 
for the JVM you shouldn't run into this problem.


-chris

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



[ANN] Apache Tomcat 9.0.44 available

2021-03-11 Thread Mark Thomas

The Apache Tomcat team announces the immediate availability of Apache
Tomcat 9.0.44.

Apache Tomcat 9 is an open source software implementation of the Java
Servlet, JavaServer Pages, Java Unified Expression Language, Java
WebSocket and JASPIC technologies.

Apache Tomcat 9.0.44 is a bugfix and feature release. The notable
changes compared to 9.0.43 include:

- Improvements to Async and non-blocking IO error handling

- Improvements to handling of OpenSSL errors

- Align the behaviour when null is passed to the ServletResponse
  methods setCharacterEncoding(), setContentType() and setLocale()
  with the recent clarification from the Jakarta Servlet project of
  the expected behaviour in these cases.

Please refer to the change log for the complete list of changes:
http://tomcat.apache.org/tomcat-9.0-doc/changelog.html


Downloads:
http://tomcat.apache.org/download-90.cgi

Migration guides from Apache Tomcat 7.x and 8.x:
http://tomcat.apache.org/migration.html

Enjoy!

- The Apache Tomcat team


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



[ANN] Apache Tomcat 10.0.4 available

2021-03-11 Thread Mark Thomas

The Apache Tomcat team announces the immediate availability of Apache
Tomcat 10.0.4.

This release is targeted at Jakarta EE 9.

Applications that run on Tomcat 9 and earlier will not run on Tomcat 10 
without changes. Java EE applications designed for Tomcat 9 and earlier 
may be placed in the $CATALINA_BASE/webapps-javaee directory and Tomcat 
will automatically convert them to Jakarta EE and copy them to the 
webapps directory. This conversion is performed using the Apache Tomcat 
migration tool for Jakarta EE tool which is also available as a separate 
download for off-line use.


Apache Tomcat 10 is an open source software implementation of the
Jakarta Servlet, Jakarta Server Pages, Jakarta Expression Language,
Jakarta WebSocket, Jakarta Authentication and Jakarta Annotations
specifications.

The notable changes compared to 10.0.2 include:

- Integration of the Apache Tomcat Migration Tool for Jakarta EE via
  the webapps-javaee directory

- Improvements to Async and non-blocking IO error handling

- Add support for Unix Domain Sockets to the APR/Native connector

Please refer to the change log for the complete list of changes:
http://tomcat.apache.org/tomcat-10.0-doc/changelog.html

Downloads:
http://tomcat.apache.org/download-10.cgi

Migration guides from Apache Tomcat 7.0.x, 8.5.x and 9.0.x:
http://tomcat.apache.org/migration.html

Enjoy!

- The Apache Tomcat team

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



[OT] Linux EC2 Java Gremlin

2021-03-11 Thread Jerry Malcolm
Not directly a tomcat question... but since TC runs on java, maybe 
someone here has some suggestions.  I am running a development/sandbox 
server on AWS EC2, Linux 2.  Only I and one other person have access to 
it.  Yesterday I was browsing through some pages on my site when all of 
a sudden I started getting errors that all of my java classes were 
compiled with a later version than the JVM.  I recognized the error from 
past experiences.  My apps are built with Java 11, and TC is apparently 
now running on Java 8.  I logged into the console, and yes, my EC2 had 
somehow changed to default to Java8.  I changed it back, and everything 
is fine.  Except for the 'what happened?' part of it. We were doing an 
AMI snapshot around that time which may have rebooted the EC2.  But 
neither of us were doing anything in the area of changing the default 
jvm.  We are launching live in a couple of days.  So obviously 
unexplained magic like this is a bit unnerving.


I know it's just speculation.  But I'm just curious if anybody has 
experienced anything similar to this.  Any ideas why linux might decide 
to automatically fall back to an older version of java?


Thx


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



Re: Possible to refer to the contextPath in a Resource database url ?

2021-03-11 Thread Rony G. Flatscher (Apache)
On 11.03.2021 12:14, Mark Thomas wrote:
> On 10/03/2021 19:44, Rony G. Flatscher (Apache) wrote:
>> For a little nutshell example I would like to use SQLite as the JDBC driver 
>> includes the native code
>> for all the major operating systems already (this way a user does not really 
>> need to install SQLite
>> just place its JDBC driver in the lib directory).
>>
>> The SQLite database (with sample data) should reside in the webapp itself, 
>> maybe in a subdirectory
>> named "data". Is it possible to define a "Resource" of type 
>> "javax.sql.DataSource" and use some
>> variable that would resolve the contextPath and that can be used in the 
>> "url" attribute? (The
>> Resource definition should be contained placed in the webapps' 
>> "META-INF/context.xml" Content
>> element.)
>>
>> There are samples that show how to use "${catalina.home}" as part of such a 
>> path. Is there a
>> variable that represents the contextPath of the webapp such that one can use 
>> that in the "url"
>> attribute?
>
> Not currently, no. It would be a little tricky to implement given how ${...} 
> replacement currently
> works.

O.K., thank you very much!

---rony


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



Re: Is there a way to know/infer that a JSP got freshly compiled from a taglib library ?

2021-03-11 Thread Rony G. Flatscher (Apache)
On 11.03.2021 11:53, Mark Thomas wrote:
> On 10/03/2021 15:14, Rony G. Flatscher (Apache) wrote:
>> Is there a way to know/infer that a JSP got freshly compiled from e.g. a 
>> taglib library?
>>
>> For caching purposes it would be necessary to learn whether a JSP got 
>> recompiled as the cache should
>> be purged in that case.
>>
>> Is there a way to find out whether a JSP run is the very first after 
>> (re-)compilation?
>>
>> Or can one rely that if a JSP gets recompiled that a new PageContext gets 
>> created for it (or if
>> reused does not contain any custom attributes placed there earlier at the 
>> PAGE_SCOPE)?
>
> Page scope gets reset at the end of a request so that won't work.
>
> It might not be perfect (containers are allowed to unload unused 
> servlets/JSPs) but in you are
> using Tomcat and haven't configured maxLoadedJsps or jspIdleTimeout then you 
> should be able to use
> the jspInit() method. (See JSP spec for details).

Thank you very much!

---rony


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



Re: Possible to refer to the contextPath in a Resource database url ?

2021-03-11 Thread Mark Thomas

On 10/03/2021 19:44, Rony G. Flatscher (Apache) wrote:

For a little nutshell example I would like to use SQLite as the JDBC driver 
includes the native code
for all the major operating systems already (this way a user does not really 
need to install SQLite
just place its JDBC driver in the lib directory).

The SQLite database (with sample data) should reside in the webapp itself, 
maybe in a subdirectory
named "data". Is it possible to define a "Resource" of type 
"javax.sql.DataSource" and use some
variable that would resolve the contextPath and that can be used in the "url" 
attribute? (The
Resource definition should be contained placed in the webapps' 
"META-INF/context.xml" Content element.)

There are samples that show how to use "${catalina.home}" as part of such a 
path. Is there a
variable that represents the contextPath of the webapp such that one can use that in the 
"url"
attribute?


Not currently, no. It would be a little tricky to implement given how 
${...} replacement currently works.


Mark

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



Re: Is there a way to know/infer that a JSP got freshly compiled from a taglib library ?

2021-03-11 Thread Mark Thomas

On 10/03/2021 15:14, Rony G. Flatscher (Apache) wrote:

Is there a way to know/infer that a JSP got freshly compiled from e.g. a taglib 
library?

For caching purposes it would be necessary to learn whether a JSP got 
recompiled as the cache should
be purged in that case.

Is there a way to find out whether a JSP run is the very first after 
(re-)compilation?

Or can one rely that if a JSP gets recompiled that a new PageContext gets 
created for it (or if
reused does not contain any custom attributes placed there earlier at the 
PAGE_SCOPE)?


Page scope gets reset at the end of a request so that won't work.

It might not be perfect (containers are allowed to unload unused 
servlets/JSPs) but in you are using Tomcat and haven't configured 
maxLoadedJsps or jspIdleTimeout then you should be able to use the 
jspInit() method. (See JSP spec for details).


Mark

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