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
Post a Comment