Java is actually very powerful. You can obtain detailed information about the HTTP header for more detailed processing, such as the last modification time of the file.
Code:
void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { Enumeration enum1 = req.getHeaderNames(); log.debug("-----------header----------------->"); while(enum1.hasMoreElements()){ String key = (String)enum1.nextElement(); String value = req.getHeader(key); log.debug(key + ":" + value); } log.debug("<-----------header-----------------"); }
Result:
-----------header----------------->Accept:*/*Referer:http://localhost:9080/UtanWeb/imgsys/main/regTempMgr.htmlAccept-Language:zh-cnAccept-Encoding:gzip, deflateIf-Modified-Since:Thu, 15 Sep 2011 12:13:41 GMTUser-Agent:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)Host:localhost:9080Connection:Keep-Alive<-----------header-----------------