org.rhq.enterprise.server.plugins.url
Class HttpProvider

java.lang.Object
  extended by org.rhq.enterprise.server.plugins.url.UrlProvider
      extended by org.rhq.enterprise.server.plugins.url.HttpProvider
All Implemented Interfaces:
ContentProvider, PackageSource

public class HttpProvider
extends UrlProvider

Similiar to the UrlProvider content source, but this expects the URL to use the HTTP protocol. This provides the ability to go through an HTTP proxy.

Author:
John Mazzitelli

Constructor Summary
HttpProvider()
           
 
Method Summary
protected  void configureProxy(org.apache.commons.httpclient.HttpClient client)
          If proxy information was specified, configures the client to use it.
protected  java.io.InputStream getIndexInputStream()
          Returns the stream that contains the index file content.
 java.io.InputStream getInputStream(java.lang.String location)
           
protected  java.io.InputStream getInputStreamForUrl(java.net.URL url)
          Given any URL, will return a stream to that URL using the HTTP client and GET method for the authentication as defined in this content source's configuration.
 void initialize(Configuration configuration)
           
protected  void prepareHttpClient(org.apache.commons.httpclient.HttpClient client, org.apache.commons.httpclient.HttpMethodBase method)
          Given a client and the method to be used by that client, this will prepare those objects so they can be used to get the remote content.
protected  void setIndexUrl(java.net.URL url)
           
protected  void setRootUrl(java.net.URL url)
           
 void shutdown()
           
 void testConnection()
           
 
Methods inherited from class org.rhq.enterprise.server.plugins.url.UrlProvider
createPackage, determinePackageType, findPackage, getIndexUrl, getRemotePackageInfosFromIndex, getRootUrl, getRootUrlString, getSupportedPackageTypes, initializePackageTypes, setSupportedPackageTypes, synchronizePackages, syncPackage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpProvider

public HttpProvider()
Method Detail

setRootUrl

protected void setRootUrl(java.net.URL url)
Overrides:
setRootUrl in class UrlProvider

setIndexUrl

protected void setIndexUrl(java.net.URL url)
Overrides:
setIndexUrl in class UrlProvider

initialize

public void initialize(Configuration configuration)
                throws java.lang.Exception
Specified by:
initialize in interface ContentProvider
Overrides:
initialize in class UrlProvider
Throws:
java.lang.Exception

shutdown

public void shutdown()
Specified by:
shutdown in interface ContentProvider
Overrides:
shutdown in class UrlProvider

testConnection

public void testConnection()
                    throws java.lang.Exception
Specified by:
testConnection in interface ContentProvider
Overrides:
testConnection in class UrlProvider
Throws:
java.lang.Exception

getInputStream

public java.io.InputStream getInputStream(java.lang.String location)
                                   throws java.lang.Exception
Specified by:
getInputStream in interface PackageSource
Overrides:
getInputStream in class UrlProvider
Throws:
java.lang.Exception

getIndexInputStream

protected java.io.InputStream getIndexInputStream()
                                           throws java.lang.Exception
Description copied from class: UrlProvider
Returns the stream that contains the index file content.

Overrides:
getIndexInputStream in class UrlProvider
Returns:
index file content stream
Throws:
java.lang.Exception

getInputStreamForUrl

protected java.io.InputStream getInputStreamForUrl(java.net.URL url)
                                            throws java.lang.Exception
Given any URL, will return a stream to that URL using the HTTP client and GET method for the authentication as defined in this content source's configuration.

Parameters:
url - the URL whose stream of content is returned
Returns:
stream containing the content for the given URL
Throws:
java.lang.Exception - if cannot get the streamed content

prepareHttpClient

protected void prepareHttpClient(org.apache.commons.httpclient.HttpClient client,
                                 org.apache.commons.httpclient.HttpMethodBase method)
                          throws java.lang.Exception
Given a client and the method to be used by that client, this will prepare those objects so they can be used to get the remote content.

Parameters:
client -
method -
Throws:
java.lang.Exception - if the client cannot be prepared successfully

configureProxy

protected void configureProxy(org.apache.commons.httpclient.HttpClient client)
If proxy information was specified, configures the client to use it.

Parameters:
client - client being used in the invocation


Copyright © 2008-2009 Red Hat, Inc.. All Rights Reserved.