Class HttpSource

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.apache.http.impl.client.CloseableHttpClient client  
      protected boolean keepAlive  
      protected java.util.function.Consumer<org.apache.http.client.methods.HttpRequestBase> requestInterceptor  
    • Constructor Summary

      Constructors 
      Constructor Description
      HttpSource​(org.apache.http.impl.client.CloseableHttpClient client)  
      HttpSource​(org.apache.http.impl.client.CloseableHttpClient client, @NotNull java.util.function.Consumer<org.apache.http.client.methods.HttpRequestBase> requestInterceptor, boolean keepAlive)  
    • Field Detail

      • client

        protected final org.apache.http.impl.client.CloseableHttpClient client
      • requestInterceptor

        protected final java.util.function.Consumer<org.apache.http.client.methods.HttpRequestBase> requestInterceptor
      • keepAlive

        protected final boolean keepAlive
    • Constructor Detail

      • HttpSource

        public HttpSource​(org.apache.http.impl.client.CloseableHttpClient client)
      • HttpSource

        public HttpSource​(org.apache.http.impl.client.CloseableHttpClient client,
                          @NotNull
                          @NotNull java.util.function.Consumer<org.apache.http.client.methods.HttpRequestBase> requestInterceptor,
                          boolean keepAlive)
    • Method Detail

      • loadIfModified

        public LoadedResource loadIfModified​(HttpResourceId resourceId,
                                             SourceVersion version)
        Description copied from interface: Source
        Loads the contents of the resource if it was modified since the provided version.
        Specified by:
        loadIfModified in interface Source<HttpResourceId>
        Parameters:
        resourceId - the resource id which should be reloaded
        version - the last modified version prior which the resource shouldn't be loaded
        Returns:
        the loaded resource or null
      • describe

        public java.lang.String describe()
        Description copied from interface: Source
        Returns description of the service in any format.
        Specified by:
        describe in interface Source<HttpResourceId>
      • getHeader

        protected java.lang.String getHeader​(org.apache.http.client.methods.CloseableHttpResponse httpResult,
                                             java.lang.String name)
      • getLastModified

        protected java.time.Instant getLastModified​(org.apache.http.client.methods.CloseableHttpResponse httpResult)
      • intercept

        protected void intercept​(org.apache.http.client.methods.HttpRequestBase req)
      • lastModifiedValue

        protected java.lang.String lastModifiedValue​(long timestamp)