0
我想知道用戶使用我網頁的哪些部分,然後將其呈現在漂亮的圖形界面中。我唯一能想到的是:如何在Spring中記錄Web請求和響應?
@Controller
public class WebController {
@Autowired
private DatabaseResource dbr;
@RequestMapping("/foobar")
public String getFoobar(Principal principal, ModelMap model, HttpServletRequest req) {
dbr.logVisit(req); //write the request to a database
//...
在每個@RequestMapping我寫請求到數據庫。這是做這件事的最好方法嗎?
它是否存在一個這樣的庫,所以我不必寫我自己的一切?一個有點像Eclipse Usage Data Collector的軟件包。
我正在使用Spring和Spring Security。
訪問日誌記錄是應用服務器的工作,而不是應用程序的工作。 – skaffman 2012-01-18 20:45:37
使用可以使用SPring AOP – 2012-01-19 04:41:41