Nuxeo Enterprise Platform 5.4

org.nuxeo.opensocial.shindig.gadgets
Class NXHttpFetcher

java.lang.Object
  extended by org.nuxeo.opensocial.shindig.gadgets.NXHttpFetcher
All Implemented Interfaces:
org.apache.shindig.gadgets.http.HttpFetcher

public class NXHttpFetcher
extends java.lang.Object
implements org.apache.shindig.gadgets.http.HttpFetcher

We have to copy BasicHttpFetcher because we must override the way proxy is used (it's not handling authentication), and since the makeRespons method is private, we cant' use it. Therefore, as there is only two methods in the base class : the one we want to override and the one that is private, it makes non sense to find a way to override it.

Author:
dmetzler

Constructor Summary
NXHttpFetcher()
          Creates a new fetcher using the default maximum object size and timeout -- no limit and 5 seconds.
NXHttpFetcher(int maxObjSize, int connectionTimeoutMs)
          Creates a new fetcher for fetching HTTP objects.
 
Method Summary
 org.apache.shindig.gadgets.http.HttpResponse fetch(org.apache.shindig.gadgets.http.HttpRequest request)
          
 void setConnectionTimeoutMs(int connectionTimeoutMs)
          Change the global connection timeout for all fetchs.
 void setMaxObjectSizeBytes(int maxObjectSizeBytes)
          Change the global maximum fetch size (in bytes) for all fetches.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NXHttpFetcher

public NXHttpFetcher(int maxObjSize,
                     int connectionTimeoutMs)
Creates a new fetcher for fetching HTTP objects. Not really suitable for production use. Use of an HTTP proxy for security is also necessary for production deployment.

Parameters:
maxObjSize - Maximum size, in bytes, of the object we will fetch, 0 if no limit..
connectionTimeoutMs - timeout, in milliseconds, for requests.

NXHttpFetcher

public NXHttpFetcher()
Creates a new fetcher using the default maximum object size and timeout -- no limit and 5 seconds.

Method Detail

setMaxObjectSizeBytes

@Inject(optional=true)
public void setMaxObjectSizeBytes(int maxObjectSizeBytes)
Change the global maximum fetch size (in bytes) for all fetches.

Parameters:
maxObjectSizeBytes - value for maximum number of bytes, or 0 for no limit

setConnectionTimeoutMs

@Inject(optional=true)
public void setConnectionTimeoutMs(int connectionTimeoutMs)
Change the global connection timeout for all fetchs.

Parameters:
connectionTimeoutMs - new connection timeout in milliseconds

fetch

public org.apache.shindig.gadgets.http.HttpResponse fetch(org.apache.shindig.gadgets.http.HttpRequest request)

Specified by:
fetch in interface org.apache.shindig.gadgets.http.HttpFetcher

Nuxeo Enterprise Platform 5.4

Copyright © 2010 Nuxeo SAS. All Rights Reserved.