# Google Data APIs Client Library (1.43.0)

## com.google.gdata.client
Interface Service.GDataRequestFactory

All Known Implementing Classes:
  GoogleGDataRequest.Factory, HttpGDataRequest.Factory

Enclosing class:
  Service

    public static interface Service.GDataRequestFactory

The GDataRequestFactory interface defines a basic factory interface for constructing a new GDataRequest interface.

Method Summary
`Service.GDataRequest` `getRequest(Query query, ContentType contentType)` Creates a new GDataRequest instance for querying a service.
`Service.GDataRequest` `getRequest(Service.GDataRequest.RequestType type, java.net.URL requestUrl, ContentType contentType)` Creates a new GDataRequest instance of the specified RequestType.
`void` `setAuthToken(AuthTokenFactory.AuthToken authToken)` Set authentication token to be used on subsequent requests created via `getRequest( com.google.gdata.client.Service.GDataRequest.RequestType, URL, ContentType)`.
`void` `setHeader(java.lang.String header, java.lang.String value)` Set a header that will be included in all requests.
`void` `setPrivateHeader(java.lang.String header, java.lang.String value)` Set a header that will be included in all requests and do not log the value.

Method Detail

### setHeader

    void setHeader(java.lang.String header,
                   java.lang.String value)

  Set a header that will be included in all requests. If header of the same name was previously set, then replace the previous header value.

  Parameters:
    `header` - the name of the header
    `value` - the value of the header, if null, then unset that header.

### setPrivateHeader

    void setPrivateHeader(java.lang.String header,
                          java.lang.String value)

  Set a header that will be included in all requests and do not log the value. Useful for values that are sensitive or related to security. If header of the same name was previously set, then replace the previous header value.

  Parameters:
    `header` - the name of the header
    `value` - the value of the header. If null, then unset that header.

### setAuthToken

    void setAuthToken(AuthTokenFactory.AuthToken authToken)

  Set authentication token to be used on subsequent requests created via `getRequest( com.google.gdata.client.Service.GDataRequest.RequestType, URL, ContentType)`. An `IllegalArgumentException` is thrown if an auth token of the wrong type is passed, or if authentication is not supported.

  Parameters:
    `authToken` - Authentication token.

### getRequest

    Service.GDataRequest getRequest(Service.GDataRequest.RequestType type,
                                    java.net.URL requestUrl,
                                    ContentType contentType)
                                    throws java.io.IOException,
                                           ServiceException

  Creates a new GDataRequest instance of the specified RequestType.

  Clients should be sure to call `Service.GDataRequest.end()` on the returned request once they have finished using it.

  Parameters:
    `type` - the request type
    `requestUrl` - the target URL for the request
    `contentType` - the contentType of the data being provided in the request body. May be `null` if no data is provided.
  Throws:
    `java.io.IOException`
    `ServiceException`

### getRequest

    Service.GDataRequest getRequest(Query query,
                                    ContentType contentType)
                                    throws java.io.IOException,
                                           ServiceException

  Creates a new GDataRequest instance for querying a service. This method pushes the query parameters down to the factory method instead of serializing them as a URL. Some factory implementations prefer to get access to query parameters in their original form, not as a URL.

  Clients should be sure to call `Service.GDataRequest.end()` on the returned request once they have finished using it.

  Parameters:
    `query` - the query associated with the request
    `contentType` - this parameter is unused but remains for backwards compatibility.
  Throws:
    `java.io.IOException`
    `ServiceException`