Author: zhoresh
Date: Tue Jun 29 01:27:35 2010
New Revision: 958802
URL: http://svn.apache.org/viewvc?rev=958802&view=rev
Log:
Set default injection for fetcher proxy to null
http://codereview.appspot.com/1690049/show
Modified:
shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java
Modified:
shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java
URL:
http://svn.apache.org/viewvc/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java?rev=958802&r1=958801&r2=958802&view=diff
==============================================================================
---
shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java
(original)
+++
shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java
Tue Jun 29 01:27:35 2010
@@ -20,6 +20,7 @@ package org.apache.shindig.gadgets.http;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Inject;
import com.google.inject.Singleton;
+import com.google.inject.internal.Nullable;
import com.google.inject.internal.Preconditions;
import com.google.inject.name.Named;
@@ -117,7 +118,7 @@ public class BasicHttpFetcher implements
* @param basicHttpFetcherProxy The http proxy to use.
*/
@Inject
- public
BasicHttpFetcher(@Named("org.apache.shindig.gadgets.http.basicHttpFetcherProxy")
+ public BasicHttpFetcher(@Nullable
@Named("org.apache.shindig.gadgets.http.basicHttpFetcherProxy")
String basicHttpFetcherProxy) {
this(DEFAULT_MAX_OBJECT_SIZE, DEFAULT_CONNECT_TIMEOUT_MS,
DEFAULT_READ_TIMEOUT_MS,
basicHttpFetcherProxy);
@@ -227,6 +228,7 @@ public class BasicHttpFetcher implements
super(entity);
}
+ @Override
public InputStream getContent() throws IOException, IllegalStateException {
// the wrapped entity's getContent() decides about repeatability
InputStream wrappedin = wrappedEntity.getContent();
@@ -234,6 +236,7 @@ public class BasicHttpFetcher implements
return new GZIPInputStream(wrappedin);
}
+ @Override
public long getContentLength() {
// length of ungzipped content is not known
return -1;
@@ -245,6 +248,7 @@ public class BasicHttpFetcher implements
super(entity);
}
+ @Override
public InputStream getContent()
throws IOException, IllegalStateException {
@@ -254,13 +258,14 @@ public class BasicHttpFetcher implements
return new InflaterInputStream(wrappedin, new Inflater(true));
}
+ @Override
public long getContentLength() {
// length of ungzipped content is not known
return -1;
}
}
- public HttpResponse fetch(org.apache.shindig.gadgets.http.HttpRequest
request)
+ public HttpResponse fetch(org.apache.shindig.gadgets.http.HttpRequest
request)
throws GadgetException {
HttpUriRequest httpMethod = null;
Preconditions.checkNotNull(request);
@@ -362,7 +367,7 @@ public class BasicHttpFetcher implements
LOG.log(Level.INFO, "Got Exception fetching " + request.getUri() + " - "
+ (now - started) + "ms", e);
- // Separate shindig error from external error
+ // Separate shindig error from external error
throw new GadgetException(GadgetException.Code.INTERNAL_SERVER_ERROR, e,
HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
} finally {