Hi,

conn.setDoOutput(true) executes POST request internally though you try
to download a spreadsheet.
And conn.setDoInput(true) isn't needed.
If you have a difficulty to debug, I recommend you to change from
https to http and capture packets of your request.


On 2月12日, 午前9:48, Garen Torikian <[email protected]> wrote:
> Been working on this all day and have gotten no where with it.
>
> My Java code looks like this:
>
>    final URL url = 
> newURL(String.format("https://spreadsheets.google.com/feeds/download/spreadsheets/Export?ke...";,
> spreadsheetId));
>
> HttpURLConnection conn = (HttpURLConnection) url.openConnection();
>
> conn.setRequestProperty("Authorization",
>
>  "GoogleLogin auth=" + wiseAuth.getAuthToken());
>
> conn.setRequestProperty("GData-Version", "3.0");
>
> conn.setRequestMethod("GET");
>
> conn.setDoInput(true);
>
> conn.setDoOutput(true);
>
> conn.setInstanceFollowRedirects(true);
>
> conn.connect();
>
> However, I always get a FileNotFound error when attempting to do
> conn.getInputStream(). I narrowed it down to being that the response code is
> 405 Method Not Allowed. What am I doing wrong here? The exception is
> returning me my URL and I can access the page just fine in my browser.

Reply via email to