com.nimbusds.openid.connect.sdk.util
Class DefaultResourceRetriever

java.lang.Object
  extended by com.nimbusds.openid.connect.sdk.util.DefaultResourceRetriever
All Implemented Interfaces:
ResourceRetriever

@ThreadSafe
public class DefaultResourceRetriever
extends Object
implements ResourceRetriever

The default retriever of resources specified by URL. Provides setting of HTTP connect and read timeouts. Caching header directives are not honoured. This class is thread-safe.

Author:
Vladimir Dzhuvinov

Constructor Summary
DefaultResourceRetriever()
          Creates a new resource retriever.
DefaultResourceRetriever(int connectTimeout, int readTimeout)
          Creates a new resource retriever.
 
Method Summary
 int getConnectTimeout()
          Gets the HTTP connect timeout.
 int getReadTimeout()
          Gets the HTTP read timeout.
 Resource retrieveResource(URL url)
          Retrieves the resource from the specified HTTP(S) URL.
 void setConnectTimeout(int connectTimeout)
          Sets the HTTP connect timeout.
 void setReadTimeout(int readTimeout)
          Sets the HTTP read timeout.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultResourceRetriever

public DefaultResourceRetriever()
Creates a new resource retriever. The HTTP connect and read timeouts are set to zero (infinite).


DefaultResourceRetriever

public DefaultResourceRetriever(int connectTimeout,
                                int readTimeout)
Creates a new resource retriever.

Parameters:
connectTimeout - The HTTP connects timeout, in milliseconds, zero for infinite. Must not be negative.
readTimeout - The HTTP read timeout, in milliseconds, zero for infinite. Must not be negative.
Method Detail

getConnectTimeout

public int getConnectTimeout()
Gets the HTTP connect timeout.

Returns:
The HTTP connect timeout, in milliseconds, zero for infinite.

setConnectTimeout

public void setConnectTimeout(int connectTimeout)
Sets the HTTP connect timeout.

Parameters:
connectTimeout - The HTTP connect timeout, in milliseconds, zero for infinite. Must not be negative.

getReadTimeout

public int getReadTimeout()
Gets the HTTP read timeout.

Returns:
The HTTP read timeout, in milliseconds, zero for infinite.

setReadTimeout

public void setReadTimeout(int readTimeout)
Sets the HTTP read timeout.

Parameters:
readTimeout - The HTTP read timeout, in milliseconds, zero for infinite. Must not be negative.

retrieveResource

public Resource retrieveResource(URL url)
                          throws IOException
Description copied from interface: ResourceRetriever
Retrieves the resource from the specified HTTP(S) URL.

Specified by:
retrieveResource in interface ResourceRetriever
Parameters:
url - The URL of the resource. Its scheme must be HTTP or HTTPS. Must not be null.
Returns:
The retrieved resource.
Throws:
IOException - If the HTTP connection to the specified URL failed or the resource couldn't be retrieved.


Copyright © 2013 NimbusDS. All Rights Reserved.