Refresh the page once every second. response. setheader ("refresh", "1 ");
2 seconds to jump to other pages response. setheader ("refresh", "2; url = otherpagename ");
No cache:
Response. setheader ("Pragma", "No-Cache ");
Response. setheader ("cache-control", "No-Cache ");
Set the expiration time
Response. setdateheader ("expires", system. currenttimemillis () + time period set by yourself );
Other page: Response. setstatus (302); response. setheader ("location", "url ");
The compression format used to notify the browser of Data Compression: Response. setheader ("content-encoding", "compressed data ");
The length of the compressed data in the quick Browser: Response. setheader ("Content-Length", compressed data. Length + "");
Quick browser image or video: Response. setheader ("Content-Type", "this number of items is found in Web. xml under conf in Tomcat ");
Inputstream in = This. getservletcontext. getresourceasstream ("/2.jpg ");
Int Len = 0;
Byte buffer [] = new byte [1, 1024]
Outputstream out = response. getoutputstream ();
While (LEN = in. Read (buffer)> 0 ){
Out. Write (buffer, 0, Len)
}
The downloaded form of quick Browser: Response. setheader ("content-disposition", "attachment?filename=2.jpg ");
Inputstream in = This. getservletcontext. getresourceasstream ("/2.jpg ");
Int Len = 0;
Byte buffer [] = new byte [1, 1024]
Outputstream out = response. getoutputstream ();
While (LEN = in. Read (buffer)> 0 ){
Out. Write (buffer, 0, Len)
}
Response. setheader usage