[jboss-dev-forums] [Design of JBoss/Tomcat Integration] - Re: Custom protocol handler class

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


Thanks for the reply, but did not work, here is outline of my class to handle custom protocols and I set the system property as -Djava.protocol.handler.pkgs=com.acme.protocol.handler.CustomProtocolUHandler

Can you please suggest what could be wrong?

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=4113918#4113918

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



More information about the jboss-dev-forums mailing list