Re: [android-developers] Re: (Http)URLConnection.setUseCaches(false) isn't working

2012-11-15 Thread gt8887b
We are experiencing this problem occasionally on Verizon phones.  We don't 
seem to have this issue on other networks, so it seems to be something on 
the carrier side.

Our server does include Cache-control: no-store, no-cache in its reply 
header.



On Friday, November 2, 2012 11:01:15 AM UTC-4, Robert Greenwalt wrote:

 Even if this is a carrier issue, please let us know - we'd like the 
 carriers to do the right thing and do have some contacts to explore issues 
 like this.

 Kieth, was this on mobile data or on wifi (or other)?


 On Fri, Nov 2, 2012 at 7:06 AM, bob b...@coolfone.comze.com javascript:
  wrote:

 Are you using WiFi or your phone's data connection?


 I saw this strange issue with this Origami Iris game where it would 
 somehow load a page from the cache if I used my MetroPCS connection.  
 Didn't happen on Wifi though.  Very weird.



 On Friday, November 2, 2012 1:27:38 AM UTC-5, Keith Wiley wrote:

 A few weeks ago I mentioned that I was experiencing unwanted http 
 caching (I mentioned it here because I wasn't sure if the cause of the 
 problem was the Android OS performing the caching in a way that didn't make 
 sense to me).  At the time, it was suggested that I experiment with 
 getUseCaches() and setUseCaches().  This has definitely not solved the 
 problem.  First of all, it does indeed appear that caching is enabled by 
 default (as is GZipping the stream interestingly, I think I've read about 
 this somewhere).  However, setting caching false doesn't help.  Not only 
 does my app not confidently load an updated version of the file from the 
 server, but it doesn't even detect that the file is gone from the server 
 (if I change its name for example).  Rather, the app still happily 
 retrieves the cached version of the file, even though I'm calling 
 setUseCaches(false).  Does anyone have any thoughts on how else to fix this 
 problem?  I know there is a solution because the phone's web browser app 
 (actually, I'm using Dolphin) properly loads the server version of the file 
 every time.

 Once again, I don't mean to bring this up on an Android forum if it 
 really isn't an Android issue...but I'm not sure whether the problem is 
 coming from the Android system for some reason (I'm not sure whether I 
 should expect my code to work in any other Java environment, just not 
 Android).  Where else might the cache be coming from if the URLConnection's 
 useCaches variable is definitely false (verified as I step over 
 setUseCaches(false) in the debugger)?

 I'm sorry if this is off-topic, I appreciate any help.  Here's how I 
 load the file:

 String address = httpUrlOfFileOnMyWebserver;
 URL url = new URL(address);
 HttpURLConnection conn = (HttpURLConnection) url.openConnection();
 if (conn.getUseCaches())
 conn.setUseCaches(false);
 InputStream is = (InputStream)conn.getContent()**;
 Reader reader = new InputStreamReader(is, UTF-8);
 StringWriter writer = new StringWriter();
 char[] buffer = new char[1024];
 for (int length = 0; (length = reader.read(buffer))  0;)
 writer.write(buffer, 0, length);
 is.close();
 reader.close();
 writer.close();
 String fileStr = writer.toString();

  -- 
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to 
 android-d...@googlegroups.comjavascript:
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com javascript:
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: (Http)URLConnection.setUseCaches(false) isn't working

2012-11-15 Thread b0b


On Friday, 16 November 2012 02:28:34 UTC+1, gt8887b wrote:

 We are experiencing this problem occasionally on Verizon phones.  We don't 
 seem to have this issue on other networks, so it seems to be something on 
 the carrier side.

 Our server does include Cache-control: no-store, no-cache in its reply 
 header.



Note that carriers often have http proxies which can get in the way and 
mess stuff. 

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: (Http)URLConnection.setUseCaches(false) isn't working

2012-11-03 Thread Keith Wiley
Why was my response to this message deleted?  At any rate, all I said was 
that I wasn't familiar with the methods you suggested and that I'll look 
them up.

Thanks.

On Friday, November 2, 2012 6:59:25 AM UTC-7, Streets Of Boston wrote:

 Did you try to add caching headers to the request and/or response:
 Your android client app' request: If-None-Match: **, 
 If-Modified-Since: **, If-Unmodified-Since: **
 Your server's response: Cache-Control: *no-cache*, ETag: *x*

 On Friday, November 2, 2012 2:40:57 AM UTC-4, Keith Wiley wrote:

 I guess one solution that seems to show promise is appending an unused 
 randomized GET variable to the end of the URL.  That seems pretty hackish 
 though.



-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: (Http)URLConnection.setUseCaches(false) isn't working

2012-11-02 Thread Keith Wiley
I guess one solution that seems to show promise is appending an unused 
randomized GET variable to the end of the URL.  That seems pretty hackish 
though.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: (Http)URLConnection.setUseCaches(false) isn't working

2012-11-02 Thread Streets Of Boston
Did you try to add caching headers to the request and/or response:
Your android client app' request: If-None-Match: **, If-Modified-Since: 
**, If-Unmodified-Since: **
Your server's response: Cache-Control: *no-cache*, ETag: *x*

On Friday, November 2, 2012 2:40:57 AM UTC-4, Keith Wiley wrote:

 I guess one solution that seems to show promise is appending an unused 
 randomized GET variable to the end of the URL.  That seems pretty hackish 
 though.


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: (Http)URLConnection.setUseCaches(false) isn't working

2012-11-02 Thread bob
 

Are you using WiFi or your phone's data connection?


I saw this strange issue with this Origami Iris game where it would somehow 
load a page from the cache if I used my MetroPCS connection.  Didn't happen 
on Wifi though.  Very weird.



On Friday, November 2, 2012 1:27:38 AM UTC-5, Keith Wiley wrote:

 A few weeks ago I mentioned that I was experiencing unwanted http caching 
 (I mentioned it here because I wasn't sure if the cause of the problem was 
 the Android OS performing the caching in a way that didn't make sense to 
 me).  At the time, it was suggested that I experiment with getUseCaches() 
 and setUseCaches().  This has definitely not solved the problem.  First of 
 all, it does indeed appear that caching is enabled by default (as is 
 GZipping the stream interestingly, I think I've read about this 
 somewhere).  However, setting caching false doesn't help.  Not only does my 
 app not confidently load an updated version of the file from the server, 
 but it doesn't even detect that the file is gone from the server (if I 
 change its name for example).  Rather, the app still happily retrieves the 
 cached version of the file, even though I'm calling setUseCaches(false).  
 Does anyone have any thoughts on how else to fix this problem?  I know 
 there is a solution because the phone's web browser app (actually, I'm 
 using Dolphin) properly loads the server version of the file every time.

 Once again, I don't mean to bring this up on an Android forum if it really 
 isn't an Android issue...but I'm not sure whether the problem is coming 
 from the Android system for some reason (I'm not sure whether I should 
 expect my code to work in any other Java environment, just not Android).  
 Where else might the cache be coming from if the URLConnection's useCaches 
 variable is definitely false (verified as I step over setUseCaches(false) 
 in the debugger)?

 I'm sorry if this is off-topic, I appreciate any help.  Here's how I load 
 the file:

 String address = httpUrlOfFileOnMyWebserver;
 URL url = new URL(address);
 HttpURLConnection conn = (HttpURLConnection) url.openConnection();
 if (conn.getUseCaches())
 conn.setUseCaches(false);
 InputStream is = (InputStream)conn.getContent();
 Reader reader = new InputStreamReader(is, UTF-8);
 StringWriter writer = new StringWriter();
 char[] buffer = new char[1024];
 for (int length = 0; (length = reader.read(buffer))  0;)
 writer.write(buffer, 0, length);
 is.close();
 reader.close();
 writer.close();
 String fileStr = writer.toString();



-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: (Http)URLConnection.setUseCaches(false) isn't working

2012-11-02 Thread Robert Greenwalt
Even if this is a carrier issue, please let us know - we'd like the
carriers to do the right thing and do have some contacts to explore issues
like this.

Kieth, was this on mobile data or on wifi (or other)?


On Fri, Nov 2, 2012 at 7:06 AM, bob b...@coolfone.comze.com wrote:

 Are you using WiFi or your phone's data connection?


 I saw this strange issue with this Origami Iris game where it would
 somehow load a page from the cache if I used my MetroPCS connection.
 Didn't happen on Wifi though.  Very weird.



 On Friday, November 2, 2012 1:27:38 AM UTC-5, Keith Wiley wrote:

 A few weeks ago I mentioned that I was experiencing unwanted http caching
 (I mentioned it here because I wasn't sure if the cause of the problem was
 the Android OS performing the caching in a way that didn't make sense to
 me).  At the time, it was suggested that I experiment with getUseCaches()
 and setUseCaches().  This has definitely not solved the problem.  First of
 all, it does indeed appear that caching is enabled by default (as is
 GZipping the stream interestingly, I think I've read about this
 somewhere).  However, setting caching false doesn't help.  Not only does my
 app not confidently load an updated version of the file from the server,
 but it doesn't even detect that the file is gone from the server (if I
 change its name for example).  Rather, the app still happily retrieves the
 cached version of the file, even though I'm calling setUseCaches(false).
 Does anyone have any thoughts on how else to fix this problem?  I know
 there is a solution because the phone's web browser app (actually, I'm
 using Dolphin) properly loads the server version of the file every time.

 Once again, I don't mean to bring this up on an Android forum if it
 really isn't an Android issue...but I'm not sure whether the problem is
 coming from the Android system for some reason (I'm not sure whether I
 should expect my code to work in any other Java environment, just not
 Android).  Where else might the cache be coming from if the URLConnection's
 useCaches variable is definitely false (verified as I step over
 setUseCaches(false) in the debugger)?

 I'm sorry if this is off-topic, I appreciate any help.  Here's how I load
 the file:

 String address = httpUrlOfFileOnMyWebserver;
 URL url = new URL(address);
 HttpURLConnection conn = (HttpURLConnection) url.openConnection();
 if (conn.getUseCaches())
 conn.setUseCaches(false);
 InputStream is = (InputStream)conn.getContent()**;
 Reader reader = new InputStreamReader(is, UTF-8);
 StringWriter writer = new StringWriter();
 char[] buffer = new char[1024];
 for (int length = 0; (length = reader.read(buffer))  0;)
 writer.write(buffer, 0, length);
 is.close();
 reader.close();
 writer.close();
 String fileStr = writer.toString();

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: (Http)URLConnection.setUseCaches(false) isn't working

2012-11-02 Thread Keith Wiley
I don't generally use wifi unless there is an explicit reason to do so 
(poor cell coverage AND good wifi coverage...a rare combination).  My data 
plan and data usage do not drive me to go to wifi (e.g. to save bandwidth).

On Friday, November 2, 2012 7:06:52 AM UTC-7, bob wrote:

 Are you using WiFi or your phone's data connection?


 I saw this strange issue with this Origami Iris game where it would 
 somehow load a page from the cache if I used my MetroPCS connection.  
 Didn't happen on Wifi though.  Very weird.



 On Friday, November 2, 2012 1:27:38 AM UTC-5, Keith Wiley wrote:

 A few weeks ago I mentioned that I was experiencing unwanted http caching 
 (I mentioned it here because I wasn't sure if the cause of the problem was 
 the Android OS performing the caching in a way that didn't make sense to 
 me).  At the time, it was suggested that I experiment with getUseCaches() 
 and setUseCaches().  This has definitely not solved the problem.  First of 
 all, it does indeed appear that caching is enabled by default (as is 
 GZipping the stream interestingly, I think I've read about this 
 somewhere).  However, setting caching false doesn't help.  Not only does my 
 app not confidently load an updated version of the file from the server, 
 but it doesn't even detect that the file is gone from the server (if I 
 change its name for example).  Rather, the app still happily retrieves the 
 cached version of the file, even though I'm calling setUseCaches(false).  
 Does anyone have any thoughts on how else to fix this problem?  I know 
 there is a solution because the phone's web browser app (actually, I'm 
 using Dolphin) properly loads the server version of the file every time.

 Once again, I don't mean to bring this up on an Android forum if it 
 really isn't an Android issue...but I'm not sure whether the problem is 
 coming from the Android system for some reason (I'm not sure whether I 
 should expect my code to work in any other Java environment, just not 
 Android).  Where else might the cache be coming from if the URLConnection's 
 useCaches variable is definitely false (verified as I step over 
 setUseCaches(false) in the debugger)?

 I'm sorry if this is off-topic, I appreciate any help.  Here's how I load 
 the file:

 String address = httpUrlOfFileOnMyWebserver;
 URL url = new URL(address);
 HttpURLConnection conn = (HttpURLConnection) url.openConnection();
 if (conn.getUseCaches())
 conn.setUseCaches(false);
 InputStream is = (InputStream)conn.getContent();
 Reader reader = new InputStreamReader(is, UTF-8);
 StringWriter writer = new StringWriter();
 char[] buffer = new char[1024];
 for (int length = 0; (length = reader.read(buffer))  0;)
 writer.write(buffer, 0, length);
 is.close();
 reader.close();
 writer.close();
 String fileStr = writer.toString();



-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: (Http)URLConnection.setUseCaches(false) isn't working

2012-11-02 Thread Keith Wiley
I haven't considered testing different kinds of connections...I figured the 
phone was responsible for the caching and the issue was unrelated to the 
connection...but I could test it.  For that matter, it could be the fault 
of the particular phone (perhaps this phone caches http data without 
permission).   At the current time, most of my tests have been performed 
over cell, not wifi (TMobile, Seattle area if that matters).

On Friday, November 2, 2012 8:01:15 AM UTC-7, Robert Greenwalt wrote:

 Even if this is a carrier issue, please let us know - we'd like the 
 carriers to do the right thing and do have some contacts to explore issues 
 like this.

 Kieth, was this on mobile data or on wifi (or other)?



-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: (Http)URLConnection.setUseCaches(false) isn't working

2012-11-02 Thread Kostya Vasilyev
There could be an overzealous cache somewhere in the middle - either
intentionally, or misconfigured, or an old buggy version.

For example:

http://squid-web-proxy-cache.1019090.n4.nabble.com/Problem-with-cached-entries-w-ETag-and-request-without-If-None-Match-header-td1048627.html

I also vaguely recall a mention of overzealous caching in the nginx wiki
(probably under Expires or ETag)...

-- K

2012/11/2 Keith Wiley kbwi...@gmail.com

 I haven't considered testing different kinds of connections...I figured
 the phone was responsible for the caching and the issue was unrelated to
 the connection...but I could test it.  For that matter, it could be the
 fault of the particular phone (perhaps this phone caches http data without
 permission).   At the current time, most of my tests have been performed
 over cell, not wifi (TMobile, Seattle area if that matters).


 On Friday, November 2, 2012 8:01:15 AM UTC-7, Robert Greenwalt wrote:

 Even if this is a carrier issue, please let us know - we'd like the
 carriers to do the right thing and do have some contacts to explore issues
 like this.

 Kieth, was this on mobile data or on wifi (or other)?

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en