On 20/01/2023 11:18, Dave Breeze wrote:
Many thanks Mark for the answers - appreciated.

Just to be clear I am running 9.0.71 simply by invoking startup.sh
(currently testing). I am not running embedded. I am not too sure
therefore about the "Call
org.apache.catalina.webresources.TomcatURLStreamHandlerFactory#addUserFactory(URLStreamHandlerFactory)"
Could you please explain further

You'd need to call it from your application code (probably a ServletContextListener).

Alternatively, you could write a Tomcat level LifecycleListener to add it if the JAR with the handler is in $CATALINA_BASE/lib

Hmm. It looks like we can remove this in Tomcat 10 onwards and use the ServiceLoader mechanism. (OK, may need to deprecate this in 10 and remove it in Tomcat 11).

Mark



thanks again
Dave Breeze
Linkedin:https://uk.linkedin.com/in/dabreeze

Dave Breeze
Linkedin:https://uk.linkedin.com/in/dabreeze


On Fri, 20 Jan 2023 at 11:01, Mark Thomas <ma...@apache.org> wrote:

On 20/01/2023 09:53, Dave Breeze wrote:
Tomcat 9.0.71

I need to use a custom protocol handler. I set JAVA_OPTS to:

   -Djava.protocol.handler.pkgs=com.ibm.crypto.provider

My JAVA_OPTS setting,however, is ignored. This is due to catalina.sh
containing

JAVA_OPTS="$JAVA_OPTS
-Djava.protocol.handler.pkgs=org.apache.catalina.webresources"

The result of catalina.sh is that the jvm has
2  -Djava.protocol.handler.pkgs settings - first  the custom protocol
then org.apache.catalina.webresources. The net result being that Tomcat is
started with -Djava.protocol.handler.pkgs=org.apache.catalina.webresources.


     1. What is the best way of setting java.protocol.handler.pkgs other than
     modifying catalina.sh

Call
org.apache.catalina.webresources.TomcatURLStreamHandlerFactory#addUserFactory(URLStreamHandlerFactory)

to add your custom handler.

     2. do i need to set java.protocol.handler.pkgs to just my custom handler
     or should it be set to a concatenation of
     custom + org.apache.catalina.webresources

If you do it that way, it needs to be both.

     3. if a concatenation of handlers is required what is the syntax

| delimited

Mark

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


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


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

Reply via email to