syncloud.google.docs.RequestFactory Maven / Gradle / Ivy
package syncloud.google.docs;
import com.google.api.client.googleapis.GoogleHeaders;
import com.google.api.client.http.HttpRequest;
import com.google.api.client.http.HttpRequestFactory;
import com.google.api.client.http.HttpRequestInitializer;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.http.xml.atom.AtomParser;
import syncloud.google.docs.model.Namespace;
/**
* User: bob
* Date: 6/30/11
*/
public class RequestFactory {
public static HttpRequestFactory getRequestFactory(final String auth) {
NetHttpTransport transport = new NetHttpTransport();
return transport.createRequestFactory(new HttpRequestInitializer() {
@Override
public void initialize(HttpRequest request) {
GoogleHeaders headers = new GoogleHeaders();
headers.setApplicationName("syncloud/1.0");
headers.gdataVersion = "3";
headers.setAcceptEncoding(null);
headers.setGoogleLogin(auth);
request.setHeaders(headers);
request.addParser(new AtomParser(Namespace.DICTIONARY));
}
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy