Class AbstractDynamicHTTPMetadataResolver

    • Field Detail

      • DEFAULT_CONTENT_TYPES

        public static final String[] DEFAULT_CONTENT_TYPES
        Default list of supported content MIME types.
      • MDC_ATTRIB_CURRENT_REQUEST_URI

        public static final String MDC_ATTRIB_CURRENT_REQUEST_URI
        MDC attribute representing the current request URI. Will be available during the execution of the configured ResponseHandler.
      • log

        @Nonnull
        private final org.slf4j.Logger log
        Class logger.
      • httpClient

        @Nonnull
        private org.apache.http.client.HttpClient httpClient
        HTTP Client used to pull the metadata.
      • supportedContentTypes

        @NonnullAfterInit
        private List<String> supportedContentTypes
        List of supported MIME types for use in Accept request header and validation of response Content-Type header.
      • supportedContentTypesValue

        @NonnullAfterInit
        private String supportedContentTypesValue
        Generated Accept request header value.
      • responseHandler

        @Nonnull
        private org.apache.http.client.ResponseHandler<XMLObject> responseHandler
        HttpClient ResponseHandler instance to use.
      • httpClientSecurityParameters

        @Nullable
        private HttpClientSecurityParameters httpClientSecurityParameters
        Optional HttpClient security parameters.
    • Constructor Detail

      • AbstractDynamicHTTPMetadataResolver

        public AbstractDynamicHTTPMetadataResolver​(@Nonnull
                                                   org.apache.http.client.HttpClient client)
        Constructor.
        Parameters:
        client - the instance of HttpClient used to fetch remote metadata
      • AbstractDynamicHTTPMetadataResolver

        public AbstractDynamicHTTPMetadataResolver​(@Nullable
                                                   Timer backgroundTaskTimer,
                                                   @Nonnull
                                                   org.apache.http.client.HttpClient client)
        Constructor.
        Parameters:
        backgroundTaskTimer - the Timer instance used to run resolver background managment tasks
        client - the instance of HttpClient used to fetch remote metadata
    • Method Detail

      • getHttpClientSecurityParameters

        @Nullable
        protected HttpClientSecurityParameters getHttpClientSecurityParameters()
        Get the instance of HttpClientSecurityParameters which provides various parameters to influence the security behavior of the HttpClient instance.
        Returns:
        the parameters instance, or null
      • setHttpClientSecurityParameters

        public void setHttpClientSecurityParameters​(@Nullable
                                                    HttpClientSecurityParameters params)
        Set an instance of HttpClientSecurityParameters which provides various parameters to influence the security behavior of the HttpClient instance.

        For all TLS-related parameters, must be used in conjunction with an HttpClient instance which is configured with either:

        For convenience methods for building a TLSSocketFactory, see HttpClientSupport.

        If the appropriate TLS socket factory is not configured and a trust engine is specified, then this will result in no TLS trust evaluation being performed and a ResolverException will ultimately be thrown.

        Parameters:
        params - the security parameters
      • getSupportedContentTypes

        @NonnullAfterInit
        @NotLive
        @Unmodifiable
        public List<String> getSupportedContentTypes()
        Get the list of supported MIME types for use in Accept request header and validation of response Content-Type header.
        Returns:
        the supported content types
      • setSupportedContentTypes

        public void setSupportedContentTypes​(@Nullable
                                             List<String> types)
        Set the list of supported MIME types for use in Accept request header and validation of response Content-Type header. Values will be effectively lower-cased at runtime.
        Parameters:
        types - the new supported content types to set
      • fetchFromOriginSource

        @Nullable
        protected XMLObject fetchFromOriginSource​(@Nonnull
                                                  CriteriaSet criteria)
                                           throws IOException
        Fetch the metadata from the origin source.
        Specified by:
        fetchFromOriginSource in class AbstractDynamicMetadataResolver
        Parameters:
        criteria - the input criteria set
        Returns:
        the resolved metadata root XMLObject, or null if metadata could not be fetched
        Throws:
        IOException - if there is a fatal error fetching metadata from the origin source
      • buildHttpRequest

        @Nullable
        protected org.apache.http.client.methods.HttpUriRequest buildHttpRequest​(@Nonnull
                                                                                 CriteriaSet criteria)
        Build an appropriate instance of HttpUriRequest based on the input criteria set.
        Parameters:
        criteria - the input criteria set
        Returns:
        the newly constructed request, or null if it can not be built from the supplied criteria
      • buildRequestURL

        @Nullable
        protected abstract String buildRequestURL​(@Nonnull
                                                  CriteriaSet criteria)
        Build the request URL based on the input criteria set.
        Parameters:
        criteria - the input criteria set
        Returns:
        the request URL, or null if it can not be built based on the supplied criteria
      • buildHttpClientContext

        protected org.apache.http.client.protocol.HttpClientContext buildHttpClientContext​(@Nonnull
                                                                                           org.apache.http.client.methods.HttpUriRequest request)
        Build the HttpClientContext instance which will be used to invoke the HttpClient request.
        Parameters:
        request - the current HTTP request
        Returns:
        a new instance of HttpClientContext