Class SpringProtocolURLStreamHandler

  • All Implemented Interfaces:
    org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.InitializingBean, org.springframework.context.EnvironmentAware, org.springframework.context.ResourceLoaderAware

    public class SpringProtocolURLStreamHandler
    extends io.microsphere.net.ExtendableProtocolURLStreamHandler
    implements org.springframework.beans.factory.InitializingBean, org.springframework.context.ResourceLoaderAware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.context.EnvironmentAware
    The Spring URLStreamHandler component supports supports the "spring" sub-protocols, like "spring:{sub-protocol}:{ext-1}: ... :{ext-n}://...", {sub-protocol} is required, each between {ext-1} to {ext-n} is the optional extension part. for instance, "spring:resource:classpath://abc.properties",
    • {sub-protocol} : "resource"
    • {ext-1} : "classpath"
    Since:
    1.0.0
    Author:
    Mercy
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String PROTOCOL  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void afterPropertiesSet()  
      org.springframework.core.io.ResourceLoader getResourceLoader()  
      protected void initSubProtocolURLConnectionFactories​(java.util.List<io.microsphere.net.SubProtocolURLConnectionFactory> factories)  
      java.net.URLConnection openConnection​(java.net.URL url, java.net.Proxy proxy)  
      void setBeanFactory​(org.springframework.beans.factory.BeanFactory beanFactory)  
      void setEnvironment​(org.springframework.core.env.Environment environment)  
      void setResourceLoader​(org.springframework.core.io.ResourceLoader resourceLoader)  
      • Methods inherited from class io.microsphere.net.ExtendableProtocolURLStreamHandler

        customizeSubProtocolURLConnectionFactories, equals, getHandlePackages, getHandlePackagesPropertyValue, getProtocol, hashCode, hostsEqual, init, openConnection, openFallbackConnection, parseURL, reformSpec, resolveAuthority, resolvePath, resolveSubProtocols, toExternalForm, toString
      • Methods inherited from class java.net.URLStreamHandler

        getDefaultPort, getHostAddress, sameFile, setURL, setURL
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • SpringProtocolURLStreamHandler

        public SpringProtocolURLStreamHandler()
    • Method Detail

      • afterPropertiesSet

        public void afterPropertiesSet()
                                throws java.lang.Exception
        Specified by:
        afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
        Throws:
        java.lang.Exception
      • initSubProtocolURLConnectionFactories

        protected void initSubProtocolURLConnectionFactories​(java.util.List<io.microsphere.net.SubProtocolURLConnectionFactory> factories)
        Overrides:
        initSubProtocolURLConnectionFactories in class io.microsphere.net.ExtendableProtocolURLStreamHandler
      • openConnection

        public java.net.URLConnection openConnection​(java.net.URL url,
                                                     java.net.Proxy proxy)
                                              throws java.io.IOException
        Overrides:
        openConnection in class io.microsphere.net.ExtendableProtocolURLStreamHandler
        Throws:
        java.io.IOException
      • getResourceLoader

        public org.springframework.core.io.ResourceLoader getResourceLoader()
      • setResourceLoader

        public void setResourceLoader​(org.springframework.core.io.ResourceLoader resourceLoader)
        Specified by:
        setResourceLoader in interface org.springframework.context.ResourceLoaderAware
      • setBeanFactory

        public void setBeanFactory​(org.springframework.beans.factory.BeanFactory beanFactory)
                            throws org.springframework.beans.BeansException
        Specified by:
        setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware
        Throws:
        org.springframework.beans.BeansException
      • setEnvironment

        public void setEnvironment​(org.springframework.core.env.Environment environment)
        Specified by:
        setEnvironment in interface org.springframework.context.EnvironmentAware