20100918 android cache

  • 8,295 views
Uploaded on

 

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
8,295
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
22
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Android HTTP Cache ( ) 2010-09-18 2010-10-03
  • 2. Android HTTP • java.net • Java • HTTP HttpURLConnection • org.apache.http • Apache HttpClient 4.0 Android • HTTP • android.webkit • Android Android UI Web • HTTP Web 2010-10-03
  • 3. (HTTP ) • Android HTTP (3G 300kbps 2000kbps) • → → → 2010-10-03
  • 4. ( ) • • • ( ) • • →HTTP/1.1 Caching 2010-10-03
  • 5. HTTP/1.1 Caching • RFC2616 • Web Web • HTTP/1.1 Caching HTTP 2010-10-03
  • 6. HTTP/1.1 Caching • HTTP • If-Modified-Since • • If-None-Match • 2010-10-03
  • 7. HTTP/1.1 Caching • HTTP • Expires • • Last-Modified • If-Modified-Since • ETag • If-None- Match 2010-10-03
  • 8. HTTP/1.1 Caching • HTTP • Cache-Control • • Pragma • Proxy : no-cache 2010-10-03
  • 9. HTTP/1.1 Caching • Apache lighthttpd Web • • ( 2010-10-03
  • 10. HTTP/1.1 Caching • android.webkit HTTP/1.1 Caching • • →Apache HttpClient-Cache 2010-10-03
  • 11. Apache HttpClient-Cache • Apache HttpClient 4.1 • HTTP/1.1 Caching • alpha (2010 9 ) 2010-10-03
  • 12. Apache HttpClient-Cache • URL • http://hc.apache.org/ • Subversion URL • http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/httpclient-cache • jar http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/ svn get mvn package • Revision: 990924 (2010-09-05 ) 990925 Serialize NotSerializableException • Maven URL • http://repo1.maven.org/maven2/org/apache/httpcomponents/httpclient-cache/ 2010-10-03
  • 13. Apache HttpClient-Cache • Caching : org.apache.http.client.HttpClient : CachingHttpClient • DefaultHttpClient CachingHttpClient • Android Apache HttpClient 4.0 ( ) • alpha ( ) 2010-10-03
  • 14. Apache HttpClient-Cache • Cache HTTP • HTTP 1.1 • Method: GET • No Header: "Pragma" • No Header: "Cache-Control: no-store" • No Header: "Cache-Control: no-cache" • ※ org.apache.http.impl.client.cache.CacheableRequestPolicy 2010-10-03
  • 15. Android • Eclipse • Android • Java Build Path Apache HttpClient 4.1 jar 2010-10-03
  • 16. Android • Apache HttpClient-Cache HTTP • Cache Data Read/Write • • Cache Data Serialize • • ※org.apache.http.client.cache.HttpCacheStorage 2010-10-03
  • 17. CachingHttpClient DefaultHttpClient Expires: Last-Modified: 281(ms) 122(ms) Etag: File Size: 295 KB Expires: Last-Modified: 50(ms) 125(ms) Etag: File Size: 4KB Expires: Last-Modified: 200 (ms) 128 (ms) Etag: File Size: 8KB ※HTTP GET HTTP Response ※5 ※Nexus One (Android 2.2) Wi-FI ※ : http://www1.axfc.net/uploader/Sc/so/154474.zip 2010-10-03
  • 18. Caching →CachingHttpClient#execute() 2010-10-03
  • 19. • Apache HttpClient-Cache • Caching Caching → HTTP Response • 2010 9 • HTTP Response Caching android.webkit 2010-10-03
  • 20. URL • HTTP/1.1: Caching in HTTP • http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html • Web • http://www.atmarkit.co.jp/fjava/rensai2/webopt12/webopt12.html • Android • http://www.ibm.com/developerworks/jp/opensource/library/os-android- networking/ 2010-10-03
  • 21. • Web • http://www.amazon.co.jp/dp/4774142042 2010-10-03