Skip to content

Commit d77535a

Browse files
committed
rename applicationContext to httpContext (Yaniv didn't like applicationContext name in http artifact)
1 parent 9eab9b9 commit d77535a

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed
Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,21 @@
1717
import com.google.api.client.json.JsonFactory;
1818

1919
/**
20-
* @author [email protected] (Your Name Here)
20+
* HTTP context which contains the transport layer, the Json factory and the user agent header which
21+
* are going to be used in the different requests.
2122
*
23+
* @author [email protected] (Nick Miceli)
24+
* @author [email protected] (Eyal Peled)
25+
* @since 1.18
2226
*/
23-
public interface ApplicationContext {
27+
public interface HttpContext {
2428

29+
/** Returns the transport layer. */
2530
HttpTransport getTransport();
2631

32+
/** Returns the Json factory. */
2733
JsonFactory getJsonFactory();
2834

29-
String getApplicationName();
30-
35+
/** Returns the user-agent header which is going to be used in every HTTP request. */
36+
String getUserAgent();
3137
}

google-http-client/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,24 @@ public final class ApacheHttpTransport extends HttpTransport {
8787
/** Apache HTTP client. */
8888
private final HttpClient httpClient;
8989

90+
/**
91+
* {@link Beta} <br/>
92+
* Returns a global thread-safe instance.
93+
*
94+
* @since 1.18
95+
*/
96+
@Beta
97+
public static ApacheHttpTransport getDefaultInstance() {
98+
return InstanceHolder.INSTANCE;
99+
}
100+
101+
/** Holder for the result of {@link #getDefaultInstance()}. */
102+
@Beta
103+
static class InstanceHolder {
104+
static final ApacheHttpTransport INSTANCE = new ApacheHttpTransport();
105+
}
106+
107+
90108
/**
91109
* Constructor that uses {@link #newDefaultHttpClient()} for the Apache HTTP client.
92110
*

0 commit comments

Comments
 (0)