java - How to define if the servlet request is initial? -


i want find out if servlet request first 1 (when getting page @ first time).

i can write filter intercept requests (even initial one), how reliable approach?

class myfilter implements filter {      private atomicboolean isfirstrequest = new atomicboolean(true);      public void dofilter(servletrequest servletrequest, servletresponse servletresponse, filterchain filterchain) throws ioexception, servletexception {         if (isfirstrequest.get()) {             isfirstrequest.set(false);         }     }      public void init(filterconfig filterconfig) throws servletexception {}     public void destroy() {} } 

can't use init method of servlet?


Comments

Popular posts from this blog

php - Admin SDK -- get information about the group -

dns - How To Use Custom Nameserver On Free Cloudflare? -

Python Error - TypeError: input expected at most 1 arguments, got 3 -