public class HTTPMetadataResolver extends AbstractReloadingMetadataResolver
AbstractInitializableComponent.initialize()
, if any properties of this
provider are changed.AbstractBatchMetadataResolver.BatchEntityBackingStore
AbstractMetadataResolver.EntityBackingStore
Constructor and Description |
---|
HTTPMetadataResolver(org.apache.http.client.HttpClient client,
String metadataURL)
Constructor.
|
HTTPMetadataResolver(Timer backgroundTaskTimer,
org.apache.http.client.HttpClient client,
String metadataURL)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected org.apache.http.client.protocol.HttpClientContext |
buildHttpClientContext()
Build the
HttpClientContext instance which will be used to invoke the HttpClient request. |
protected org.apache.http.client.methods.HttpGet |
buildHttpGet()
Builds the
HttpGet instance used to fetch the metadata. |
protected void |
checkTLSCredentialTrusted(org.apache.http.client.protocol.HttpClientContext context)
Check that trust engine evaluation of the server TLS credential was actually performed.
|
protected void |
doDestroy()
Performs component specific destruction logic.
|
protected byte[] |
fetchMetadata()
Gets the metadata document from the remote server.
|
protected byte[] |
getMetadataBytesFromResponse(org.apache.http.HttpResponse response)
Extracts the raw metadata bytes from the response taking in to account possible deflate and GZip compression.
|
protected String |
getMetadataIdentifier()
Gets an identifier which may be used to distinguish this metadata in logging statements.
|
String |
getMetadataURI()
Gets the URL to fetch the metadata.
|
protected void |
processConditionalRetrievalHeaders(org.apache.http.HttpResponse response)
Records the ETag and Last-Modified headers, from the response, if they are present.
|
void |
setBasicCredentials(org.apache.http.auth.UsernamePasswordCredentials credentials)
Sets the username and password used to access the metadata URL.
|
void |
setBasicCredentialsWithScope(org.apache.http.auth.UsernamePasswordCredentials credentials,
org.apache.http.auth.AuthScope scope)
Sets the username and password used to access the metadata URL.
|
void |
setTLSTrustEngine(TrustEngine<? super X509Credential> engine)
Sets the optional trust engine used in evaluating server TLS credentials.
|
computeNextRefreshDelay, getExpirationTime, getLastRefresh, getLastUpdate, getMaxRefreshDelay, getMinRefreshDelay, getNextRefresh, getRefreshDelayFactor, initMetadataResolver, inputstreamToByteArray, postProcessMetadata, processCachedMetadata, processNewMetadata, processNonExpiredMetadata, processPreExpiredMetadata, refresh, setCacheSourceMetadata, setMaxRefreshDelay, setMinRefreshDelay, setRefreshDelayFactor, unmarshallMetadata
createNewBackingStore, getBackingStore, getCachedFilteredMetadata, getCachedOriginalMetadata, isCacheSourceMetadata, iterator, preProcessNewMetadata, resolve
doInitialize, filterMetadata, getMetadataFilter, getParserPool, getUnmarshallerFactory, indexEntityDescriptor, isFailFastInitialization, isRequireValidMetadata, isValid, lookupEntityID, lookupIndexedEntityID, preProcessEntitiesDescriptor, preProcessEntityDescriptor, releaseMetadataDOM, removeByEntityID, resolveSingle, setBackingStore, setFailFastInitialization, setMetadataFilter, setParserPool, setRequireValidMetadata, unmarshallMetadata
setId
getId
destroy, initialize, isDestroyed, isInitialized
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMetadataFilter, isRequireValidMetadata, setMetadataFilter, setRequireValidMetadata
resolve, resolveSingle
getId
forEach, spliterator
public HTTPMetadataResolver(org.apache.http.client.HttpClient client, String metadataURL) throws ResolverException
client
- HTTP client used to pull in remote metadatametadataURL
- URL to the remove remote metadataResolverException
- thrown if the HTTP client is null or the metadata URL provided is invalidpublic HTTPMetadataResolver(Timer backgroundTaskTimer, org.apache.http.client.HttpClient client, String metadataURL) throws ResolverException
backgroundTaskTimer
- timer used to schedule background metadata refresh tasksclient
- HTTP client used to pull in remote metadatametadataURL
- URL to the remove remote metadataResolverException
- thrown if the HTTP client is null or the metadata URL provided is invalidpublic String getMetadataURI()
public void setTLSTrustEngine(@Nullable TrustEngine<? super X509Credential> engine)
Must be used in conjunction with an HttpClient instance which is configured with a
TrustEngineTLSSocketFactory
. If this socket
factory is not configured, then this will result in no TLS trust evaluation being performed
and a ResolverException
will ultimately be thrown.
engine
- the trust engine instance to usepublic void setBasicCredentials(@Nullable org.apache.http.auth.UsernamePasswordCredentials credentials)
AuthScope
will be generated based off the metadata URI's hostname and port.credentials
- the username and password credentialspublic void setBasicCredentialsWithScope(@Nullable org.apache.http.auth.UsernamePasswordCredentials credentials, @Nullable org.apache.http.auth.AuthScope scope)
If the authScope
is null, an AuthScope
will be generated based off the metadata URI's
hostname and port.
credentials
- the username and password credentialsscope
- the HTTP client auth scope with which to scope the credentials, may be nullprotected void doDestroy()
doDestroy
in class AbstractReloadingMetadataResolver
protected String getMetadataIdentifier()
getMetadataIdentifier
in class AbstractReloadingMetadataResolver
protected byte[] fetchMetadata() throws ResolverException
fetchMetadata
in class AbstractReloadingMetadataResolver
ResolverException
- thrown if there is a problem retrieving the metadata from the remote serverprotected void checkTLSCredentialTrusted(org.apache.http.client.protocol.HttpClientContext context) throws SSLPeerUnverifiedException
context
- the current HTTP context instance in useSSLPeerUnverifiedException
- thrown if the TLS credential was not actually evaluated by the trust engineprotected org.apache.http.client.methods.HttpGet buildHttpGet()
HttpGet
instance used to fetch the metadata. The returned method advertises support for GZIP
and deflate compression, enables conditional GETs if the cached metadata came with either an ETag or
Last-Modified information, and sets up basic authentication if such is configured.protected org.apache.http.client.protocol.HttpClientContext buildHttpClientContext()
HttpClientContext
instance which will be used to invoke the HttpClient
request.HttpClientContext
protected void processConditionalRetrievalHeaders(org.apache.http.HttpResponse response)
response
- GetMethod containing a valid HTTP responseprotected byte[] getMetadataBytesFromResponse(org.apache.http.HttpResponse response) throws ResolverException
response
- GetMethod containing a valid HTTP responseResolverException
- thrown if there is a problem getting the raw metadata bytes from the responseCopyright © 2016 JBoss by Red Hat. All rights reserved.