0 Replies Latest reply on Dec 18, 2007 2:58 PM by eg_jboss

    Deploy custom protocol handling class

    eg_jboss

      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 );
      }

      }


      }