English 中文(简体)
15分钟
原标题:Use Server cache for 15 minutes

我想使用15分钟的服务器,这样一来,在定购中必须使用什么?

请帮助我。

我在此使用的是我的法典。

private HttpURLConnection httpCon = null;
httpCon = (HttpURLConnection) httpUrl.openConnection();
httpCon.setRequestMethod("GET");
httpCon.setRequestProperty("Connection", "Keep-Alive");
httpCon.setRequestProperty("Pragma","public");
httpCon.setRequestProperty("Cache-Control","maxage=900");
httpCon.setUseCaches(true);
最佳回答

你正在告诉服务器你愿意接收答复,但是没有保证服务器将这样做或能够这样做(除非你控制服务器并落实这一规定)。

您还可以尝试建立一个中间的吉大港山区接收器,接收客户和服务器,如Valnish、英镑或Squid等代理海滩。

最后,你可以自己做浏览器,支持安 Android瓦网包裹,但并没有违约。 为此:

- http://developer.android.com/app/java/net/HttpURLConnection.html HttpURLConnection,其中详细说明(在“Response Caching”部分)你必须执行“Cache”和“Default”。

-Also check out ResponseCache Example which has examples of this, and something quirky to watch out for at the end (which may or may not still be true).

亲爱!

问题回答

不是使用HttpConnection,而是使用DefaultHttpClient和CachingHttpClient(部分是App Http的客户,与Anderson合在一起)。

查阅http://hc.apache.org/http://components-client-ga/tutorial/html/caching.html。 了解如何使用沥滤的更多细节。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签