0

I want to know what parts of my web page the users use and then present it in a nice graphic interface. The only thing I could come up with was this:

@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
 //...

At each @RequestMapping I write the request to the database. Is this the best way to do it?

Does it exists a library for this so I do not have to write it all my self? A package that works a bit like Eclipse Usage Data Collector.

I'm using Spring and Spring Security.

Tomasz Nurkiewicz
  • 334,321
  • 69
  • 703
  • 674

1 Answers1

1

Write a custom HandlerInterceptor, this feature is specificaly designed to implement features like this.

Another approach is to use Logback Access that tightly and seamlessly integrates with Tomcat.

Tomasz Nurkiewicz
  • 334,321
  • 69
  • 703
  • 674