SlideShare a Scribd company logo
1 of 19
GOVERNMENT ARTS COLLEGE
Melur, Madurai
By
Mr. V. Veeranan
Roll No: P22PCS123
I M.Sc. Computer Science
Topic: Server Side Include
(Cookies and Filters)
PG. Department of Computer Science
ADVANCED JAVA PROGRAMMING
Server Side Includes (SSI)
Embed instructions to the Server
Inside an HTML document
HTML tag Language
A special file -> .shtml
SHTML -> the web server
Servlets
To add small of dynamic content
Otherwise static HTML pages
Server-side Includes(SSI)
 Server-Side Includes (SSI) give you the ability to embed
instructions to the server inside an HTML document.
 The instructions are given using extensions to the HTML tag
language. A special file extension,
 . shtml, signals the server that the document contains SSI directives.
 SHTML is a file extension that lets the web server know the file
should be processed as using Server Side Includes(SSI)
 Servlets are not confined to handling entire requests. Some web
servers allow servlets to add small amounts of dynamic content to
otherwise static HTML pages.
Server Side Include Tag
 A page that uses the advertisement servlet is written just like a normal
HTML page, except that it contains one or more <SERVILET> tags
and is saved with the .shtml extension.
• The <SERVIET> tag is similar to the <APPLET> tag, which loads an
applet within a page. When a client requests a .shtml page, the server
finds all of the <SERVLET> tags in the text and replaces them with the
output from the appropriate servlets.
• When you use a <SERVLET> tag, you must include a CODE parameter
that identifies the servlet to be loaded. This can be a class name or a
servlet allas set up within the server. On some servers, you can specify
an optional CODEBASE parameter that loads the servlet code from a
remote location.
Server Side Include
• Any additional parameters are treated as servlet initialization
parameters. Each <SERVLET> tag must be matched by a
closing</SERVLET> tag.
• Between the opening and closing tags, you can include as many
<PARAM> tags as necessary, where you specify NAME and
VALUE attributes for each one.
• The servlet can them access these parameters with getParameter().
Example (Time.shtml)
<HTML>
<HEAD> <TITLE> Times1</TITLE></HEAD>
<BODY>
The current time here is:
<SERVLET CODE=CurrentTime>
</SERVLET>
<p>
The current time in London is:
<SERVLET CODE
Cookies
• Cookies is a small text file containing client information sent by a
web server to a browser that can later be read back from the
browser.
• When a browser receives a cookie, it saves the cookie and there after
sends the cookie back to the server each time it accesses a page on
the server, subject to certain rules.
• Since cookie’s value can uniquely identify a client, cookies are often
used for session tracking.
• The browser is expected to support 20 cookies for each Web server,
300 cookies total any may limit cookie size to 4kb each.
Cookies
Working with Cookies
Cookies Methods
Working with Cookies
Create Cookie Class Constructor
public Cookie(String name, String Value())
Create Cookie, Send -> Browser
HttpServletResponce.addCookie(Cookie Cokie)
Servlet -> Request
HttpServletRequest.getCookies()
Cookie Methods
Specifies a Comment
public void setComment(java.lang.String purpose)
Comment using describing
public java.lang.String getComment()
Specifies the Domain name
public void setDomain(java.lang.String pattern)
The Maximum age -> Cookie
public void setMaxAge(int expiry)
Positive Vallue -> Negative value -> Zero Value
Return the Maximum age -> Cookie
public int setMaxAge()
Set of URIs -> Client
public void setPath(java.lang.String.url)
Cookie Methods
Returns the Paths
public java.lang.String.getPath()
Indicates to the Browser
public vaid setSecure(boolean flag)
Returns true if -> Browser -> Sending
public Boollean getSecure()
Filters
 Filter is a component which dynamically intercepts requests
and responses to transform or use the information contained
in the requests or response,
 Filters typically do not themselves create responses but
provide universal functions that can be “attached” to any
type of servlet or JSP page.
 A filter is a program that runs on the server before the servlet
with which it is associated.
Benefits of Filters
 Filters encapsulates common behaviour in a modular and
reusable manner.
 It separates high-level access decisions from presentation
code.
 It applies wholesale changes to many different resources.
Types/Components of Filters
Filters can perform many different types of functions. Based on
their functionalities following are the filters
 Authentication: Blocking requests based on user identity.
 Logging and auditing: Tracking users of a web application.
 Image conversion: Scaling maps and so on.
 Localization: Targeting the request and response to particular
locale.
 XSL/T Transformations of XML Content: Targeting web
application responses to more than one type of client.
Programming a Filter
 Create a class that implement the filter interface
 Put the filtering behaviour in the doFilter method
 Call the doFilter Method of the FilterChain object
 Register the filter with the appropriate servlets and JSP pages
 Disable the invoker servlet.
Filter Element in web.xml
 Icon
 Filter-name
 Display-name
 Description
 Filter-class
 Init-param
 Filter-Mapping Element
 Filter-name
 url-pattern
 Servlet-name
Process of Registering
Filter with Servlet
 One filter can be associated with more than one servlet.
 More than one filter can be mapped to a servlet.
 A filter can be mapped to all the servlet using an “*”.
 The filter, filter-mapping, serdfsdvlet and servlet-mapping
element must appear in the web application deployment
descriptor in that order.
Filter Life Cycle
 Methods Controlling life cycle of a filter are as follows
 init()
 doFilter()
 destroy()
 Three methods of Filter interface makes up the life cycle of a
filter.
 public void init(FilterConfig config) throws ServletException
 public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws ServletException, IOException
 public void destroy()
Thank You…

More Related Content

Similar to GAC Java Presentation_Server Side Include_Cookies_Filters 2022.ppt

21. Application Development and Administration in DBMS
21. Application Development and Administration in DBMS21. Application Development and Administration in DBMS
21. Application Development and Administration in DBMS
koolkampus
 
Anintroductiontojavawebtechnology 090324184240-phpapp01
Anintroductiontojavawebtechnology 090324184240-phpapp01Anintroductiontojavawebtechnology 090324184240-phpapp01
Anintroductiontojavawebtechnology 090324184240-phpapp01
raviIITRoorkee
 

Similar to GAC Java Presentation_Server Side Include_Cookies_Filters 2022.ppt (20)

Webservices in SalesForce (part 1)
Webservices in SalesForce (part 1)Webservices in SalesForce (part 1)
Webservices in SalesForce (part 1)
 
Servlets
ServletsServlets
Servlets
 
Major project report
Major project reportMajor project report
Major project report
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
 
servlet 2.5 & JSP 2.0
servlet 2.5 & JSP 2.0servlet 2.5 & JSP 2.0
servlet 2.5 & JSP 2.0
 
Servlet ppt by vikas jagtap
Servlet ppt by vikas jagtapServlet ppt by vikas jagtap
Servlet ppt by vikas jagtap
 
J2EE pattern 5
J2EE pattern 5J2EE pattern 5
J2EE pattern 5
 
21. Application Development and Administration in DBMS
21. Application Development and Administration in DBMS21. Application Development and Administration in DBMS
21. Application Development and Administration in DBMS
 
Servlet.ppt
Servlet.pptServlet.ppt
Servlet.ppt
 
Servlet.ppt
Servlet.pptServlet.ppt
Servlet.ppt
 
Servlet1.ppt
Servlet1.pptServlet1.ppt
Servlet1.ppt
 
BITM3730Week12.pptx
BITM3730Week12.pptxBITM3730Week12.pptx
BITM3730Week12.pptx
 
Java Servlet Programming under Ubuntu Linux by Tushar B Kute
Java Servlet Programming under Ubuntu Linux by Tushar B KuteJava Servlet Programming under Ubuntu Linux by Tushar B Kute
Java Servlet Programming under Ubuntu Linux by Tushar B Kute
 
Web services intro.
Web services intro.Web services intro.
Web services intro.
 
Day7
Day7Day7
Day7
 
Anintroductiontojavawebtechnology 090324184240-phpapp01
Anintroductiontojavawebtechnology 090324184240-phpapp01Anintroductiontojavawebtechnology 090324184240-phpapp01
Anintroductiontojavawebtechnology 090324184240-phpapp01
 
TY.BSc.IT Java QB U3
TY.BSc.IT Java QB U3TY.BSc.IT Java QB U3
TY.BSc.IT Java QB U3
 
SCWCD : Servlet web applications : CHAP 3
SCWCD : Servlet web applications : CHAP 3SCWCD : Servlet web applications : CHAP 3
SCWCD : Servlet web applications : CHAP 3
 
Webformer: a Rapid Application Development Toolkit for Writing Ajax Web Form ...
Webformer: a Rapid Application Development Toolkit for Writing Ajax Web Form ...Webformer: a Rapid Application Development Toolkit for Writing Ajax Web Form ...
Webformer: a Rapid Application Development Toolkit for Writing Ajax Web Form ...
 
Active Server Page - ( ASP )
Active Server Page - ( ASP )Active Server Page - ( ASP )
Active Server Page - ( ASP )
 

More from CUO VEERANAN VEERANAN

More from CUO VEERANAN VEERANAN (20)

Big Data - large Scale data (Amazon, FB)
Big Data - large Scale data (Amazon, FB)Big Data - large Scale data (Amazon, FB)
Big Data - large Scale data (Amazon, FB)
 
Fourier Transforms are indispensable tool
Fourier Transforms are indispensable toolFourier Transforms are indispensable tool
Fourier Transforms are indispensable tool
 
ENHANCING BIOLOGICAL RESEARCH THROUGH DIGITAL TECHNOLOGIES AND COMPUTATIONAL.ppt
ENHANCING BIOLOGICAL RESEARCH THROUGH DIGITAL TECHNOLOGIES AND COMPUTATIONAL.pptENHANCING BIOLOGICAL RESEARCH THROUGH DIGITAL TECHNOLOGIES AND COMPUTATIONAL.ppt
ENHANCING BIOLOGICAL RESEARCH THROUGH DIGITAL TECHNOLOGIES AND COMPUTATIONAL.ppt
 
ADS_Unit I_Route Map 2023.pdf
ADS_Unit I_Route Map 2023.pdfADS_Unit I_Route Map 2023.pdf
ADS_Unit I_Route Map 2023.pdf
 
CS 23 Operating System Design Principles_MULTIPROCESSOR AND REAL TIME SCHEDULING
CS 23 Operating System Design Principles_MULTIPROCESSOR AND REAL TIME SCHEDULINGCS 23 Operating System Design Principles_MULTIPROCESSOR AND REAL TIME SCHEDULING
CS 23 Operating System Design Principles_MULTIPROCESSOR AND REAL TIME SCHEDULING
 
Python Unit I MCQ.ppt
Python Unit I MCQ.pptPython Unit I MCQ.ppt
Python Unit I MCQ.ppt
 
GAC DS Priority Queue Presentation 2022.ppt
GAC DS Priority Queue Presentation 2022.pptGAC DS Priority Queue Presentation 2022.ppt
GAC DS Priority Queue Presentation 2022.ppt
 
Lab 3 Python Programming Lab 8-15 MKU.pdf
Lab 3 Python Programming Lab 8-15 MKU.pdfLab 3 Python Programming Lab 8-15 MKU.pdf
Lab 3 Python Programming Lab 8-15 MKU.pdf
 
Lab 3 Python Programming Lab 1-8 MKU.pdf
Lab 3 Python Programming Lab 1-8 MKU.pdfLab 3 Python Programming Lab 1-8 MKU.pdf
Lab 3 Python Programming Lab 1-8 MKU.pdf
 
MULTIPROCESSOR AND REAL TIME SCHEDULING.ppt
MULTIPROCESSOR AND REAL TIME SCHEDULING.pptMULTIPROCESSOR AND REAL TIME SCHEDULING.ppt
MULTIPROCESSOR AND REAL TIME SCHEDULING.ppt
 
Relational Algebra.ppt
Relational Algebra.pptRelational Algebra.ppt
Relational Algebra.ppt
 
DS Unit I to III MKU Questions.pdf
DS Unit I to III MKU Questions.pdfDS Unit I to III MKU Questions.pdf
DS Unit I to III MKU Questions.pdf
 
Acharya Vinoba Bhave.ppt
Acharya Vinoba Bhave.pptAcharya Vinoba Bhave.ppt
Acharya Vinoba Bhave.ppt
 
1.1.8 Types of computer & 1.1.8.3 Classification of Computers on the basis of...
1.1.8 Types of computer & 1.1.8.3 Classification of Computers on the basis of...1.1.8 Types of computer & 1.1.8.3 Classification of Computers on the basis of...
1.1.8 Types of computer & 1.1.8.3 Classification of Computers on the basis of...
 
1.1.8 Types of computer & 1.1.8.2 Classification of Computers on the basis of...
1.1.8 Types of computer & 1.1.8.2 Classification of Computers on the basis of...1.1.8 Types of computer & 1.1.8.2 Classification of Computers on the basis of...
1.1.8 Types of computer & 1.1.8.2 Classification of Computers on the basis of...
 
1.1.8 Types of computer & 1.1.8.1 Classification of Computers on the basis of...
1.1.8 Types of computer & 1.1.8.1 Classification of Computers on the basis of...1.1.8 Types of computer & 1.1.8.1 Classification of Computers on the basis of...
1.1.8 Types of computer & 1.1.8.1 Classification of Computers on the basis of...
 
1.1.7 Block diagram and Working Principle of Computer
1.1.7 Block diagram and Working Principle of Computer1.1.7 Block diagram and Working Principle of Computer
1.1.7 Block diagram and Working Principle of Computer
 
1.1.6 Characteristics of Computer
1.1.6 Characteristics of Computer1.1.6 Characteristics of Computer
1.1.6 Characteristics of Computer
 
1.1.5 Terms related to Computer & 1.1.5.3 Technical Industry
1.1.5 Terms related to Computer & 1.1.5.3 Technical Industry1.1.5 Terms related to Computer & 1.1.5.3 Technical Industry
1.1.5 Terms related to Computer & 1.1.5.3 Technical Industry
 
1.1.5 Terms related to Computer & 1.1.5.2 Software.ppt
1.1.5 Terms related to Computer & 1.1.5.2 Software.ppt1.1.5 Terms related to Computer & 1.1.5.2 Software.ppt
1.1.5 Terms related to Computer & 1.1.5.2 Software.ppt
 

Recently uploaded

MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MysoreMuleSoftMeetup
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
AnaAcapella
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
CaitlinCummins3
 

Recently uploaded (20)

UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024
 
Michaelis Menten Equation and Estimation Of Vmax and Tmax.pptx
Michaelis Menten Equation and Estimation Of Vmax and Tmax.pptxMichaelis Menten Equation and Estimation Of Vmax and Tmax.pptx
Michaelis Menten Equation and Estimation Of Vmax and Tmax.pptx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptx
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17
 
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
 
dusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learningdusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learning
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdfUGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
Diuretic, Hypoglycemic and Limit test of Heavy metals and Arsenic.-1.pdf
Diuretic, Hypoglycemic and Limit test of Heavy metals and Arsenic.-1.pdfDiuretic, Hypoglycemic and Limit test of Heavy metals and Arsenic.-1.pdf
Diuretic, Hypoglycemic and Limit test of Heavy metals and Arsenic.-1.pdf
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17
 
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
Ernest Hemingway's For Whom the Bell Tolls
Ernest Hemingway's For Whom the Bell TollsErnest Hemingway's For Whom the Bell Tolls
Ernest Hemingway's For Whom the Bell Tolls
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 

GAC Java Presentation_Server Side Include_Cookies_Filters 2022.ppt

  • 1. GOVERNMENT ARTS COLLEGE Melur, Madurai By Mr. V. Veeranan Roll No: P22PCS123 I M.Sc. Computer Science Topic: Server Side Include (Cookies and Filters) PG. Department of Computer Science ADVANCED JAVA PROGRAMMING
  • 2. Server Side Includes (SSI) Embed instructions to the Server Inside an HTML document HTML tag Language A special file -> .shtml SHTML -> the web server Servlets To add small of dynamic content Otherwise static HTML pages
  • 3. Server-side Includes(SSI)  Server-Side Includes (SSI) give you the ability to embed instructions to the server inside an HTML document.  The instructions are given using extensions to the HTML tag language. A special file extension,  . shtml, signals the server that the document contains SSI directives.  SHTML is a file extension that lets the web server know the file should be processed as using Server Side Includes(SSI)  Servlets are not confined to handling entire requests. Some web servers allow servlets to add small amounts of dynamic content to otherwise static HTML pages.
  • 4. Server Side Include Tag  A page that uses the advertisement servlet is written just like a normal HTML page, except that it contains one or more <SERVILET> tags and is saved with the .shtml extension. • The <SERVIET> tag is similar to the <APPLET> tag, which loads an applet within a page. When a client requests a .shtml page, the server finds all of the <SERVLET> tags in the text and replaces them with the output from the appropriate servlets. • When you use a <SERVLET> tag, you must include a CODE parameter that identifies the servlet to be loaded. This can be a class name or a servlet allas set up within the server. On some servers, you can specify an optional CODEBASE parameter that loads the servlet code from a remote location.
  • 5. Server Side Include • Any additional parameters are treated as servlet initialization parameters. Each <SERVLET> tag must be matched by a closing</SERVLET> tag. • Between the opening and closing tags, you can include as many <PARAM> tags as necessary, where you specify NAME and VALUE attributes for each one. • The servlet can them access these parameters with getParameter().
  • 6. Example (Time.shtml) <HTML> <HEAD> <TITLE> Times1</TITLE></HEAD> <BODY> The current time here is: <SERVLET CODE=CurrentTime> </SERVLET> <p> The current time in London is: <SERVLET CODE
  • 7. Cookies • Cookies is a small text file containing client information sent by a web server to a browser that can later be read back from the browser. • When a browser receives a cookie, it saves the cookie and there after sends the cookie back to the server each time it accesses a page on the server, subject to certain rules. • Since cookie’s value can uniquely identify a client, cookies are often used for session tracking. • The browser is expected to support 20 cookies for each Web server, 300 cookies total any may limit cookie size to 4kb each.
  • 9. Working with Cookies Create Cookie Class Constructor public Cookie(String name, String Value()) Create Cookie, Send -> Browser HttpServletResponce.addCookie(Cookie Cokie) Servlet -> Request HttpServletRequest.getCookies()
  • 10. Cookie Methods Specifies a Comment public void setComment(java.lang.String purpose) Comment using describing public java.lang.String getComment() Specifies the Domain name public void setDomain(java.lang.String pattern) The Maximum age -> Cookie public void setMaxAge(int expiry) Positive Vallue -> Negative value -> Zero Value Return the Maximum age -> Cookie public int setMaxAge() Set of URIs -> Client public void setPath(java.lang.String.url)
  • 11. Cookie Methods Returns the Paths public java.lang.String.getPath() Indicates to the Browser public vaid setSecure(boolean flag) Returns true if -> Browser -> Sending public Boollean getSecure()
  • 12. Filters  Filter is a component which dynamically intercepts requests and responses to transform or use the information contained in the requests or response,  Filters typically do not themselves create responses but provide universal functions that can be “attached” to any type of servlet or JSP page.  A filter is a program that runs on the server before the servlet with which it is associated.
  • 13. Benefits of Filters  Filters encapsulates common behaviour in a modular and reusable manner.  It separates high-level access decisions from presentation code.  It applies wholesale changes to many different resources.
  • 14. Types/Components of Filters Filters can perform many different types of functions. Based on their functionalities following are the filters  Authentication: Blocking requests based on user identity.  Logging and auditing: Tracking users of a web application.  Image conversion: Scaling maps and so on.  Localization: Targeting the request and response to particular locale.  XSL/T Transformations of XML Content: Targeting web application responses to more than one type of client.
  • 15. Programming a Filter  Create a class that implement the filter interface  Put the filtering behaviour in the doFilter method  Call the doFilter Method of the FilterChain object  Register the filter with the appropriate servlets and JSP pages  Disable the invoker servlet.
  • 16. Filter Element in web.xml  Icon  Filter-name  Display-name  Description  Filter-class  Init-param  Filter-Mapping Element  Filter-name  url-pattern  Servlet-name
  • 17. Process of Registering Filter with Servlet  One filter can be associated with more than one servlet.  More than one filter can be mapped to a servlet.  A filter can be mapped to all the servlet using an “*”.  The filter, filter-mapping, serdfsdvlet and servlet-mapping element must appear in the web application deployment descriptor in that order.
  • 18. Filter Life Cycle  Methods Controlling life cycle of a filter are as follows  init()  doFilter()  destroy()  Three methods of Filter interface makes up the life cycle of a filter.  public void init(FilterConfig config) throws ServletException  public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException, IOException  public void destroy()

Editor's Notes

  1. Connected component