first NOT both interfaces are in the same hierarchy
the two interfaces are in the same hierarchy right? i mean HttpServletRequest extends ServletRequest know?
second the HttpServletRequestImpl implements the HttpServletRequest not the ServletRequest.
therefore you can pass to the doFilter() an object that implements the HttpServletRequest interface since the HttpServletRequest is a child of ServletRequest and since we know that the filter we created is for the http protocol (web app) the cast is safe.
i got that..one confusion, now if some one ask what is the objetc type (i mean req) what should we tell..is it HttpServletReuestImpl or HttpServletRequest because that object implements that interface.
What i want to know is if an object implemet an interface what does that object type becomes..i mean the newly implement interface type or the earlier class type?