Upload
phani
View
213
Download
1
Embed Size (px)
DESCRIPTION
Filter
Citation preview
FilterFilter is a web component like servlet whose life cycle will bemanaged by web container. Filter componenthas following three life cycle methods: ----------- Void init(FilterConfig)throws Servlet!ception " Void doFilter(Servlet#e$%est&Servlet#esponse&FilterChain)'(!ception&Servlet!ception" Void destroy()Filter component will be %sed to intercept the re$%est and response. )hen send the re$%est to the servlet container invokes the servlet service method.*efore invoking the servlet service method yo% can stop the re$%est and yo% can do some processing on the re$%est .this is called as pre-processing the re$%est yo% can do this by adding yo%r printer.Common task which yo% can do in pre-processing are Verify the sec%rity information +ogin information abo%t the client in the log file. Verifying the session is valid or not etc.(nce the re$%est processing is completed by the servlet and response is ready yo% can stop the response which is going to the client and yo% perform some task %nder response this is called as post-processing.Following are the some common task which yo% can perform in post ,processing: --------- Compressing the data. -pplying the encryption algorithm on data. +ogin the information abo%t the response in log file. .re-processing #e$%est processing .ost , processing /ello.html /elloFilter /elloServletFilter'Filter ''+oginservletnter 0ame 1) Collect the name 2) Collect the '. address3) +og the name and'. address in log file 4) Forward to the /elloServlet5) Collect the message prepared 6) +og into log file 1) Collect the name 2) Collect the '. address3) +og into log file 4) .repare the message 5) Store the message %n re$%est Click /++( -----#-7'V S/8-9 YOUR REQUEST HAVE BEENPLACES SUCCESFULLYGood night