You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2011/03/06 23:02:28 UTC
svn commit: r1078595 -
/tomcat/trunk/java/org/apache/naming/resources/DirContextURLStreamHandler.java
Author: markt
Date: Sun Mar 6 22:02:28 2011
New Revision: 1078595
URL: http://svn.apache.org/viewvc?rev=1078595&view=rev
Log:
Clean-up, mainly unused code
Modified:
tomcat/trunk/java/org/apache/naming/resources/DirContextURLStreamHandler.java
Modified: tomcat/trunk/java/org/apache/naming/resources/DirContextURLStreamHandler.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/resources/DirContextURLStreamHandler.java?rev=1078595&r1=1078594&r2=1078595&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/resources/DirContextURLStreamHandler.java (original)
+++ tomcat/trunk/java/org/apache/naming/resources/DirContextURLStreamHandler.java Sun Mar 6 22:02:28 2011
@@ -31,8 +31,7 @@ import javax.naming.directory.DirContext
* @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
* @version $Revision$
*/
-public class DirContextURLStreamHandler
- extends URLStreamHandler {
+public class DirContextURLStreamHandler extends URLStreamHandler {
// ----------------------------------------------------------- Constructors
@@ -134,21 +133,6 @@ public class DirContextURLStreamHandler
/**
- * Set the java.protocol.handler.pkgs system property.
- */
- public static void setProtocolHandler() {
- String value = System.getProperty(Constants.PROTOCOL_HANDLER_VARIABLE);
- if (value == null) {
- value = Constants.Package;
- System.setProperty(Constants.PROTOCOL_HANDLER_VARIABLE, value);
- } else if (value.indexOf(Constants.Package) == -1) {
- value += "|" + Constants.Package;
- System.setProperty(Constants.PROTOCOL_HANDLER_VARIABLE, value);
- }
- }
-
-
- /**
* Returns true if the thread or the context class loader of the current
* thread is bound.
*/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r1078595 - /tomcat/trunk/java/org/apache/naming/resources/DirContextURLStreamHandler.java
Posted by Mark Thomas <ma...@apache.org>.
On 08/03/2011 01:56, Konstantin Kolinko wrote:
> 2011/3/7 <ma...@apache.org>:
>> Author: markt
>> Date: Sun Mar 6 22:02:28 2011
>> New Revision: 1078595
>>
>> URL: http://svn.apache.org/viewvc?rev=1078595&view=rev
>> Log:
>> Clean-up, mainly unused code
>>
>> Modified:
>> tomcat/trunk/java/org/apache/naming/resources/DirContextURLStreamHandler.java
>>
>
> Apparently it was the alternative method to configure protocol handler
> for the jndi: URLs, instead of using a custom URLStreamHandlerFactory
> implementation, as documented in JavaDoc for constructors of
> java.net.URL. [1]
Ah. I went looking for that but didn't find it.
This raises a question about how to handle custom protocols for both
Tomcat's jndi protocol and and application protocols. Prior to the
recent changes:
- Tomcat registered a custom URLStreamHandlerFactory
- Web applications had to use java.protocol.handler.pkgs
- When embedded and already using a custom URLStreamHandlerFactory,
Tomcat's jndi handler had to be manually registered by the embedding
code either by calling DirContextURLStreamHandler#setProtocolHandler()
or by manually setting java.protocol.handler.pkgs
With all of the recent changes:
- Tomcat registers a custom URLStreamHandlerFactory
- Web applications can register with Tomcat's URLStreamHandlerFactory or
use java.protocol.handler.pkgs
- When embedded and already using a custom URLStreamHandlerFactory, the
embedding Tomcat's URLStreamHandlerFactory has to used by the
application's URLStreamHandlerFactory.
This looks like a step backwards for the embedded case. I'll restore
Tomcat 7's support for registration via java.protocol.handler.pkgs
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r1078595 - /tomcat/trunk/java/org/apache/naming/resources/DirContextURLStreamHandler.java
Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/3/7 <ma...@apache.org>:
> Author: markt
> Date: Sun Mar 6 22:02:28 2011
> New Revision: 1078595
>
> URL: http://svn.apache.org/viewvc?rev=1078595&view=rev
> Log:
> Clean-up, mainly unused code
>
> Modified:
> tomcat/trunk/java/org/apache/naming/resources/DirContextURLStreamHandler.java
>
Apparently it was the alternative method to configure protocol handler
for the jndi: URLs, instead of using a custom URLStreamHandlerFactory
implementation, as documented in JavaDoc for constructors of
java.net.URL. [1]
It worked together with the following class (already removed from
Tomcat 7, but present in 6.0):
org.apache.naming.resources.jndi.Handler
(removed in http://svn.apache.org/viewvc?rev=1078798&view=rev )
The current method that Tomcat uses is to call static method
URL.setURLStreamHandlerFactory( ) which is done in
WebappLoader.startInternal().
I think that I do not mind removing this feature from Tomcat 7, but I
wonder whether it were useful in some embedded scenarios, where
container app has its own system-wide URLStreamHandlerFactory.
Removal of the below code is not crucial for such a use case (as the
app can update the system property by itself), but removal of the
Handler class is crucial.
[1] http://download.oracle.com/javase/1.4.2/docs/api/java/net/URL.html#URL%28java.lang.String,%20java.lang.String,%20int,%20java.lang.String%29
[2] http://download.oracle.com/javase/6/docs/api/java/net/URL.html#URL%28java.lang.String,%20java.lang.String,%20int,%20java.lang.String%29
Best regards,
Konstantin Kolinko
> Modified: tomcat/trunk/java/org/apache/naming/resources/DirContextURLStreamHandler.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/resources/DirContextURLStreamHandler.java?rev=1078595&r1=1078594&r2=1078595&view=diff
> ==============================================================================
> --- tomcat/trunk/java/org/apache/naming/resources/DirContextURLStreamHandler.java (original)
> +++ tomcat/trunk/java/org/apache/naming/resources/DirContextURLStreamHandler.java Sun Mar 6 22:02:28 2011
> @@ -31,8 +31,7 @@ import javax.naming.directory.DirContext
> * @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
> * @version $Revision$
> */
> -public class DirContextURLStreamHandler
> - extends URLStreamHandler {
> +public class DirContextURLStreamHandler extends URLStreamHandler {
>
>
> // ----------------------------------------------------------- Constructors
> @@ -134,21 +133,6 @@ public class DirContextURLStreamHandler
>
>
> /**
> - * Set the java.protocol.handler.pkgs system property.
> - */
> - public static void setProtocolHandler() {
> - String value = System.getProperty(Constants.PROTOCOL_HANDLER_VARIABLE);
> - if (value == null) {
> - value = Constants.Package;
> - System.setProperty(Constants.PROTOCOL_HANDLER_VARIABLE, value);
> - } else if (value.indexOf(Constants.Package) == -1) {
> - value += "|" + Constants.Package;
> - System.setProperty(Constants.PROTOCOL_HANDLER_VARIABLE, value);
> - }
> - }
> -
> -
> - /**
> * Returns true if the thread or the context class loader of the current
> * thread is bound.
> */
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org