3131 */
3232public abstract class AbstractGoogleClient {
3333
34- static final Logger LOGGER = Logger .getLogger (AbstractGoogleClient .class .getName ());
34+ static final Logger logger = Logger .getLogger (AbstractGoogleClient .class .getName ());
3535
3636 /** The request factory for connections to the server. */
3737 private final HttpRequestFactory requestFactory ;
@@ -53,6 +53,11 @@ public abstract class AbstractGoogleClient {
5353 */
5454 private final String servicePath ;
5555
56+ /**
57+ * Batch path, for example {@code "batch/tasks"}. Must be URL-encoded.
58+ */
59+ private final String batchPath ;
60+
5661 /**
5762 * Application name to be sent in the User-Agent header of each request or {@code null} for none.
5863 */
@@ -76,8 +81,9 @@ protected AbstractGoogleClient(Builder builder) {
7681 googleClientRequestInitializer = builder .googleClientRequestInitializer ;
7782 rootUrl = normalizeRootUrl (builder .rootUrl );
7883 servicePath = normalizeServicePath (builder .servicePath );
84+ batchPath = builder .batchPath ;
7985 if (Strings .isNullOrEmpty (builder .applicationName )) {
80- LOGGER .warning ("Application name is not set. Call Builder#setApplicationName." );
86+ logger .warning ("Application name is not set. Call Builder#setApplicationName." );
8187 }
8288 applicationName = builder .applicationName ;
8389 requestFactory = builder .httpRequestInitializer == null
@@ -228,7 +234,7 @@ public final BatchRequest batch() {
228234 public final BatchRequest batch (HttpRequestInitializer httpRequestInitializer ) {
229235 BatchRequest batch =
230236 new BatchRequest (getRequestFactory ().getTransport (), httpRequestInitializer );
231- batch .setBatchUrl (new GenericUrl (getRootUrl () + "batch" ));
237+ batch .setBatchUrl (new GenericUrl (getRootUrl () + batchPath ));
232238 return batch ;
233239 }
234240
@@ -306,6 +312,9 @@ public abstract static class Builder {
306312 /** The service path of the service, for example {@code "tasks/v1/"}. */
307313 String servicePath ;
308314
315+ /** The batch path of the service, for example {@code "batch/tasks"}. */
316+ String batchPath ;
317+
309318 /**
310319 * Application name to be sent in the User-Agent header of each request or {@code null} for
311320 * none.
@@ -421,6 +430,14 @@ public Builder setServicePath(String servicePath) {
421430 return this ;
422431 }
423432
433+ /**
434+ * Sets the URL-encoded batch path of the service, for example {@code "batch/tasks"}.
435+ */
436+ public Builder setBatchPath (String batchPath ) {
437+ this .batchPath = batchPath ;
438+ return this ;
439+ }
440+
424441 /** Returns the Google client request initializer or {@code null} for none. */
425442 public final GoogleClientRequestInitializer getGoogleClientRequestInitializer () {
426443 return googleClientRequestInitializer ;
0 commit comments