cache-control

Retrofit - Okhttp client How to cache the response

拈花ヽ惹草 提交于 2019-11-27 17:32:31
I'm trying to cache the response of http calls done by Retrofit(v 1.9.0) with OkHttp(2.3.0). It always made the network calls if I try to make a call without internet then java.net.UnknownHostException . RestClient public class RestClient { public static final String BASE_URL = "http://something.example.net/JSONService"; private com.ucc.application.rest.ApiService apiService; public RestClient() { Gson gson = new GsonBuilder() .setDateFormat("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'SSS'Z'") .create(); RequestInterceptor requestInterceptor = new RequestInterceptor() { @Override public void intercept

What is Cache-Control: private?

a 夏天 提交于 2019-11-27 10:42:17
When I visit chesseng.herokuapp.com I get a response header that looks like Cache-Control:private Connection:keep-alive Content-Encoding:gzip Content-Type:text/css Date:Tue, 16 Oct 2012 06:37:53 GMT Last-Modified:Tue, 16 Oct 2012 03:13:38 GMT Status:200 OK transfer-encoding:chunked Vary:Accept-Encoding X-Rack-Cache:miss and then I refresh the page and get Cache-Control:private Connection:keep-alive Date:Tue, 16 Oct 2012 06:20:49 GMT Status:304 Not Modified X-Rack-Cache:miss so it seems like caching is working. If that works for caching then what is the point of Expires and Cache-Control:max

Max value for cache control header in HTTP

前提是你 提交于 2019-11-27 10:13:25
问题 I'm using Amazon S3 to serve static assets for my website. I want to have browsers cache these assets for as long as possible. What meta-data headers should I include with my assets Cache-Control: max-age=??? 回答1: Generally one year is advised as a standard max value. See RFC 2616: To mark a response as "never expires," an origin server sends an Expires date approximately one year from the time the response is sent. HTTP/1.1 servers SHOULD NOT send Expires dates more than one year in the

what’s the difference between Expires and Cache-Control headers?

匆匆过客 提交于 2019-11-27 10:05:35
What’s the difference between Expires and Cache-Control headers? A Lee Cache-Control was introduced in HTTP/1.1 and offers more options than Expires . They can be used to accomplish the same thing but the data value for Expires is an HTTP date whereas Cache-Control max-age lets you specify a relative amount of time so you could specify "X hours after the page was requested". HTML Cache control is a very similar question and has a good link to a caching tutorial that should answer most of your questions (e.g., http://www.mnot.net/cache_docs/#EXPIRES ). To sum up though, Expires is recommended

Cached, PHP generated Thumbnails load slowly

给你一囗甜甜゛ 提交于 2019-11-27 09:08:28
问题 Question Part A ▉ (100 bountys, awarded) Main question was how to make this site, load faster. First we needed to read these waterfalls. Thanks all for your suggestions on the waterfall readout analysis. Evident from the various waterfall graphs shown here is the main bottleneck: the PHP-generated thumbnails. The protocol-less jquery loading from CDN advised by David got my bounty, albeit making my site only 3% faster overall, and while not answering the site's main bottleneck. Time for for

Why after logout clicking back button on the page displays previous page content?

£可爱£侵袭症+ 提交于 2019-11-27 08:47:25
I am working on a Struts 2 project. When user clicks a logout button the logout action clears the session using session.clear() . But when user clicks the back button in the browser after logout, it still displays the previous page content. I want to redirect an user to the login page, if the back button was clicked in the browser after logout. Is there anything else I should clear in my logout action to solve this problem? Any help will be greatly appreciated. Turns out that your browser is caching pages before you press the back button. The browser caching mechanism is designed so to

disable caching for specific url in spring security

帅比萌擦擦* 提交于 2019-11-27 08:32:34
问题 in my situation i have four way to solve my problem: write meta config in my index.html and disable caching (doesn't work for me) change index.html to index.jsp and disable caching like here (work for me but my client Group need index.html) using a filter in web.xml and distinguish the desired request and disable caching Spring Security my question is how can i use Spring Security to disable caching for index.html (maybe using intercept-url in http tag) 回答1: You can selectively add no cache

Something is forcing responses to have cache-control: private in IIS7

眉间皱痕 提交于 2019-11-27 07:49:36
问题 I have this in my web.config: <system.webServer> <httpProtocol> <customHeaders> <clear /> <add name="Cache-Control" value="max-age=30,public" /> </customHeaders> </httpProtocol> </system.webServer> But when I load the page, this is the response header: Cache-Control: private,max-age=30,public It is an ASP.NET MVC application, the controller has no cache directives specified anywhere. 回答1: try this <system.web> <httpRuntime sendCacheControlHeader="false" /> </system.web> Let us know how it

HTTP Cache Control max-age, must-revalidate

心已入冬 提交于 2019-11-27 06:35:26
I have a couple of queries related to Cache-Control. If I specify Cache-Control max-age=3600, must-revalidate for a static html/js/images/css file, with Last Modified Header defined in HTTP header: Does browser/proxy cache(like Squid/Akamai) go all the way to origin server to validate before max-age expires ? Or will it serve content from cache till max-age expires? After max-age expiry (that is expiry from cache), is there a If-Modified-Since check or is content re-downloaded from origin server w/o If-Modified-Since check? a) If the server includes this header: Cache-Control "max-age=3600,

Add an Expires or a Cache-Control header in JSP

被刻印的时光 ゝ 提交于 2019-11-27 06:25:32
How do you add an Expires or a Cache-Control header in JSP? I want to add a far-future expiration date in an include page for my static components such as images, CSS and JavaScript files. BalusC To disable browser cache for JSP pages, create a Filter which is mapped on an url-pattern of *.jsp and does basically the following in the doFilter() method: HttpServletResponse httpResponse = (HttpServletResponse) response; httpResponse.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1 httpResponse.setHeader("Pragma", "no-cache"); // HTTP 1.0 httpResponse.setDateHeader(