[jboss-user] [Installation, Configuration & DEPLOYMENT] - Deploy custom protocol handling class

eg_jboss do-not-reply at jboss.com
Tue Dec 18 14:58:54 EST 2007


Can there be more than one instance of a class implementing URLStreamHandlerFactory per Jboss JVM. Is there any way i can invoke/register this class at startup time. In weblogic I use -Dweblogic.net.http.URLStreamHandlerFactory=com.acme.protocol.handler.CustomProtocolUHandler

How do I make it work with Jboss
Thanks again.


package com.acme.protocol.handler;
import java.net.*;
//import java.util.*;
import sun.misc.*;

import com.rsa.ssl.*;
import java.io.File;

public class CustomProtocolHandler implements URLStreamHandlerFactory
{
	public URLStreamHandler createURLStreamHandler(String protocol)
	{
		protocol = protocol.toLowerCase();
		//We are also returning our handler for handling of dummy protocols like javascript: or about:blank
		if(protocol.startsWith("myhttp"))
		{

			return m_protocolHandler;
		}
		else
		{
			return null;
		}
	}

	public static void main(String[] args )
	{
		System.out.println("main Method called");
		try
		{
		CustomProtocolHandler customProtocolURLStreamHandler = new CustomProtocolHandler();
		java.net.URL.setURLStreamHandlerFactory(customProtocolURLStreamHandler);
		}
		catch(Exception e)
		{
			System.err.println("Exception while setting the URLStreamHandlerFactory object"+e );
		}

	}


}

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4113942#4113942

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4113942



More information about the jboss-user mailing list