Package jcifs.context

Class SingletonContext

    • Method Detail

      • init

        public static final void init​(Properties props)
                               throws CIFSException
        Initialize singleton context using custom properties This method can only be called once.
        Parameters:
        props -
        Throws:
        CIFSException
      • getInstance

        public static final SingletonContext getInstance()
        Get singleton context The singleton context will use system properties for configuration as well as values specified in a file specified through this jcifs.properties system property.
        Returns:
        a global context, initialized on first call
      • registerSmbURLHandler

        public static void registerSmbURLHandler()
        This static method registers the SMB URL protocol handler which is required to use SMB URLs with the java.net.URL class. If this method is not called before attempting to create an SMB URL with the URL class the following exception will occur:
         Exception MalformedURLException: unknown protocol: smb
             at java.net.URL.<init>(URL.java:480)
             at java.net.URL.<init>(URL.java:376)
             at java.net.URL.<init>(URL.java:330)
             at jcifs.smb.SmbFile.<init>(SmbFile.java:355)
             ...