Issue: Unrecognized content type:application/binary when connecting via SSL
behind a proxy
I'm retrieving the spreadsheet entries using Java. Using the same source code,
I was able to perform the action successfully when NOT connected behind a
proxy. However, when I'm running the same application behind a proxy, I'm
getting the following error:
com.google.gdata.util.ParseException: Unrecognized content
type:application/binary
- Source Code Excerpt:
System.setProperty("https.proxyHost", "proxy");
System.setProperty("https.proxyPort", "port");
SSLContext sslContext = SSLContext.getInstance("SSL");
sslContext.init(null, new TrustManager[] { new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkServerTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {
}
public void checkClientTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {
}
} }, new SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory());
HttpsURLConnection.setDefaultHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAM
E_VERIFIER);
SpreadsheetService service = new SpreadsheetService(applicationName);
service.setUserCredentials(username, password);
service.setContentType(ContentType.APPLICATION_XML);
service.useSsl();
service.getEntry(new URL(httpsUrlString), SpreadsheetEntry.class);
- Tracing through Google Code:
Service.getEntry(URL, Class<E>) -> .. -> Service.parseResponseData(GDataRequest
req, Class<E> resultType) ->
protected ClientInputProperties(GDataRequest req, Class<?> expectType)
throws IOException, ServiceException {
super(req);
this.expectType = expectType;
this.inputType = req.getResponseContentType(); //-- returns application/binary when connected behind a proxy
init();
}
- What is the expected output?
No exception is thrown when 'service.getEntry(new URL(httpsUrlString),
SpreadsheetEntry.class);' is invoked when connected behind a proxy.
- What do you see instead?
com.google.gdata.util.ParseException: Unrecognized content
type:application/binary
- What version of the product are you using? On what operating system?
com.google.gdata:core:1.47.1
com.google.api.client:google-api-data-spreadsheet-v3:1.0.10-alpha
Windows 7 Enterprise
Java JDK 1.7
Original issue reported on code.google.com by joy.mari...@gmail.com on 21 Jan 2014 at 9:38
Original issue reported on code.google.com by
joy.mari...@gmail.com
on 21 Jan 2014 at 9:38