SmartDroidDeveloper / google-api-java-client

Automatically exported from code.google.com/p/google-api-java-client
0 stars 0 forks source link

httpresponse content legth=305,but content is null #133

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Version of google-api-java-client (e.g. 1.3.1-alpha)?
1.3.1-alpha

Java environment (e.g. Java 6, Android 2.3, App Engine 1.4.2)?

java 6
Describe the problem.
I use 1.3.1 to login google storage. the code like this :

        try {
               HttpResponse response = request.execute();

            System.out.println(response.parseAsString());
        }catch (HttpResponseException e){
            //xmlhttpparser
            XmlHttpParser parser = new XmlHttpParser();
            parser.contentType="application/xml";
            parser.namespaceDictionary = new XmlNamespaceDictionary();
            ErrorStatusCode err=parser.parse(e.response, ErrorStatusCode.class);
            System.out.println(err.toString());

request is :

GET http://commondatastorage.googleapis.com/ HTTP/1.1
Accept-Encoding: gzip
Authorization: GOOG1 GOOGJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Date: Mon, 28-Feb-2011 08:01:06 GMT+00:00
User-Agent: Google-API-Java-Client/1.3.1-alpha
Cache-Control: no-cache
Pragma: no-cache
Host: commondatastorage.googleapis.com
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Proxy-Connection: keep-alive

response is 

HTTP/1.0 403 Forbidden
Content-Length: 305
X-Xss-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Expires: Mon, 28 Feb 2011 07:56:18 GMT
Server: GSE
Connection: close
Cache-Control: private, max-age=0
Date: Mon, 28 Feb 2011 07:56:18 GMT
X-Frame-Options: SAMEORIGIN
Content-Type: application/xml; charset=UTF-8

<?xml version='1.0' 
encoding='UTF-8'?><Error><Code>SignatureDoesNotMatch</Code><Message>The request 
signature we calculated does not match the signature you provided. Check your 
Google secret key and signing method.</Message><StringToSign>GET

Mon, 28-Feb-2011 08:01:06 GMT+00:00
/</StringToSign></Error>

but in debug:
e.response.contentLength    =305    
e.response.content= null    

Original issue reported on code.google.com by zcmk...@gmail.com on 28 Feb 2011 at 8:01

GoogleCodeExporter commented 9 years ago
this I know how to get it ,I make a mistake

Original comment by zcmk...@gmail.com on 23 Mar 2011 at 12:49

GoogleCodeExporter commented 9 years ago
Are you saying that you have found the mistake in your code and I should close 
this issue?  I am not sure what you are saying is the problem.

Original comment by yan...@google.com on 23 Mar 2011 at 1:32