SlideShare a Scribd company logo
1 of 25
Slide 1 of 25
Filters Inter-Servlet Communication
Slide 2 of 25
Objectives
 Introduction to Filters
 Filter API
 Configuring Filter
 Manipulating Request and Responses
 Servlet Communication
Slide 3 of 25
Introduction Filter
Slide 4 of 25
Filters
 Components that add functionality to the
request and response processing of a
Web Application
 Intercept the requests and responses that
flow between a client and a Servlet/JSP.
Slide 5 of 25
Filter Participation
User Filter
Web Resource
(Servlet / JSP)
Request
Response
Filter Participating in Request-Response Process
Slide 6 of 25
Filter Life Cycle
Instantiation
and Loading
Initialization
init()
doFilter()
destroy()
Unavailable
GC
Slide 7 of 25
Filter Chain
 Invoke a series of filters
 If the Calling filter is last filter, will invoke web resource
Filter
1
Client
Filter
2
Filter
3
Web
Resourc
e
Working of Filter Chain
Filter Chain
Slide 8 of 25
Usage of Filter
 Authentication
 Logging and auditing filter
 Image conversion filters
 Data compression
 Encryption filters
 Filters that trigger resource access events
Slide 9 of 25
Benefits of Filter
Slide 10 of 25
Compress Filter
Slide 11 of 25
Working of Filter
Slide 12 of 25
Working of Filter
Slide 13 of 25
Filter API
Slide 14 of 25
“Filter” Interface
A filter is an object than perform filtering tasks
on either the request to a resource (a
servlet or static content), or on the response
from a resource, or both.
 Init()
 doFilter()
 Destroy()
Slide 15 of 25
“FilterConfig” Interface
 A filter configuration object used by a servlet
container used to pass information to a filter
during initialization
 Methods
– getFilterName()
– getInitParameter()
– getInitParameterNames()
– getServletContext()
Slide 16 of 25
“FilterChain” Interface
 A FilterChain is an object provided by the
servlet container to the developer giving a
view into the invocation chain of a filtered
request for a resource
 Methods
– doFilter()
Slide 17 of 25
Configuring Filter
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<filter>
<filter-name>TimerFilter</filter-name>
<filter-class>filters.TimerFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>TimerFilter</filter-name>
<url-pattern>/TimerFilter</url-pattern>
</filter-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>Timer.html</welcome-file>
</welcome-file-list>
</web-app>
17
Slide 18 of 25
Filter Element
 <icon>
 <filter-name>
 <display-name>
 <description>
 <filter-class>
 <init-param>
Slide 19 of 25
Filter-Mapping Element
 <filter-name>
 <url-name>
 <servlet-name>
Slide 20 of 25
Configuring Filter Chain
Slide 21 of 25
Manipulating Request and Response
Slide 22 of 25
Manipulating Request and Response
 ServletRequestWrapper
 ServletResponseWrapper
Slide 23 of 25
Inter-Servlet Communication
 A process where two or more Servlets
communicates with each other to process
the client request.
 A Servlet can forward the request to
another Servlet to process the client
request.
 A Servlet can include the output of another
Servlet to process the client request.
Slide 24 of 25
Applet – Servlet Communication
 Developing Applet front end application
 Establishing connection between applet and
servlet
 Communicasting throught object
serialisation
 Sending objects from applet to servlet
 Sending objects from servlet to applet
Slide 25 of 25
Summary
 Introduction to Filters
 Filter API
 Configuring Filter
 Manipulating Request and Responses
 Servlet Communication

More Related Content

Viewers also liked

Session 1 introduction servlet - Giáo trình Bách Khoa Aptech
Session 1   introduction servlet - Giáo trình Bách Khoa AptechSession 1   introduction servlet - Giáo trình Bách Khoa Aptech
Session 1 introduction servlet - Giáo trình Bách Khoa Aptech
MasterCode.vn
 
Session 4 : securing web application - Giáo trình Bách Khoa Aptech
Session 4 : securing web application  - Giáo trình Bách Khoa AptechSession 4 : securing web application  - Giáo trình Bách Khoa Aptech
Session 4 : securing web application - Giáo trình Bách Khoa Aptech
MasterCode.vn
 
4 introduction-php-mvc-cakephp-m4-controllers-slides
4 introduction-php-mvc-cakephp-m4-controllers-slides4 introduction-php-mvc-cakephp-m4-controllers-slides
4 introduction-php-mvc-cakephp-m4-controllers-slides
MasterCode.vn
 
Pdf buoi3 4-link-building-tran-ngoc-chinh-mastercode.vn
Pdf buoi3 4-link-building-tran-ngoc-chinh-mastercode.vnPdf buoi3 4-link-building-tran-ngoc-chinh-mastercode.vn
Pdf buoi3 4-link-building-tran-ngoc-chinh-mastercode.vn
MasterCode.vn
 
Pd fbuoi5 6-ảnh hưởng của social media tới kết quả seo-mastercode.vn
Pd fbuoi5 6-ảnh hưởng của social media tới kết quả seo-mastercode.vnPd fbuoi5 6-ảnh hưởng của social media tới kết quả seo-mastercode.vn
Pd fbuoi5 6-ảnh hưởng của social media tới kết quả seo-mastercode.vn
MasterCode.vn
 
Introducing wcf-slides
Introducing wcf-slidesIntroducing wcf-slides
Introducing wcf-slides
MasterCode.vn
 
Pd fbuoi7 8--tongquanseo-mastercode.vn
Pd fbuoi7 8--tongquanseo-mastercode.vnPd fbuoi7 8--tongquanseo-mastercode.vn
Pd fbuoi7 8--tongquanseo-mastercode.vn
MasterCode.vn
 
c
cc

Viewers also liked (20)

Session 1 introduction servlet - Giáo trình Bách Khoa Aptech
Session 1   introduction servlet - Giáo trình Bách Khoa AptechSession 1   introduction servlet - Giáo trình Bách Khoa Aptech
Session 1 introduction servlet - Giáo trình Bách Khoa Aptech
 
Session 4 : securing web application - Giáo trình Bách Khoa Aptech
Session 4 : securing web application  - Giáo trình Bách Khoa AptechSession 4 : securing web application  - Giáo trình Bách Khoa Aptech
Session 4 : securing web application - Giáo trình Bách Khoa Aptech
 
Presentation skill
Presentation skillPresentation skill
Presentation skill
 
Pd fbuoi1 giới thiệu seo tools cơ bản-seo manager + seo guy-mastercode.vn
Pd fbuoi1 giới thiệu seo tools cơ bản-seo manager + seo guy-mastercode.vnPd fbuoi1 giới thiệu seo tools cơ bản-seo manager + seo guy-mastercode.vn
Pd fbuoi1 giới thiệu seo tools cơ bản-seo manager + seo guy-mastercode.vn
 
4 introduction-php-mvc-cakephp-m4-controllers-slides
4 introduction-php-mvc-cakephp-m4-controllers-slides4 introduction-php-mvc-cakephp-m4-controllers-slides
4 introduction-php-mvc-cakephp-m4-controllers-slides
 
2 seo-fundamentals-in depth keyword research (part 2)-slides
2 seo-fundamentals-in depth keyword research (part 2)-slides2 seo-fundamentals-in depth keyword research (part 2)-slides
2 seo-fundamentals-in depth keyword research (part 2)-slides
 
2. owin and katana aspdotnet-mvc5-slides
2. owin and katana aspdotnet-mvc5-slides2. owin and katana aspdotnet-mvc5-slides
2. owin and katana aspdotnet-mvc5-slides
 
Pdf buoi3 4-link-building-tran-ngoc-chinh-mastercode.vn
Pdf buoi3 4-link-building-tran-ngoc-chinh-mastercode.vnPdf buoi3 4-link-building-tran-ngoc-chinh-mastercode.vn
Pdf buoi3 4-link-building-tran-ngoc-chinh-mastercode.vn
 
Pd fbuoi5 6-ảnh hưởng của social media tới kết quả seo-mastercode.vn
Pd fbuoi5 6-ảnh hưởng của social media tới kết quả seo-mastercode.vnPd fbuoi5 6-ảnh hưởng của social media tới kết quả seo-mastercode.vn
Pd fbuoi5 6-ảnh hưởng của social media tới kết quả seo-mastercode.vn
 
7. signal r aspdotnet-mvc5-slides
7. signal r aspdotnet-mvc5-slides7. signal r aspdotnet-mvc5-slides
7. signal r aspdotnet-mvc5-slides
 
8. web developer tools and visual studio 2013 aspdotnet-mvc5-slides
8. web developer tools and visual studio 2013 aspdotnet-mvc5-slides8. web developer tools and visual studio 2013 aspdotnet-mvc5-slides
8. web developer tools and visual studio 2013 aspdotnet-mvc5-slides
 
6. entity framework 6 aspdotnet-mvc5-slides
6. entity framework 6 aspdotnet-mvc5-slides6. entity framework 6 aspdotnet-mvc5-slides
6. entity framework 6 aspdotnet-mvc5-slides
 
Introducing wcf-slides
Introducing wcf-slidesIntroducing wcf-slides
Introducing wcf-slides
 
5. web api 2 aspdotnet-mvc5-slides
5. web api 2 aspdotnet-mvc5-slides5. web api 2 aspdotnet-mvc5-slides
5. web api 2 aspdotnet-mvc5-slides
 
PRESENTATION SKILL
 PRESENTATION SKILL  PRESENTATION SKILL
PRESENTATION SKILL
 
Pd fbuoi7 8--tongquanseo-mastercode.vn
Pd fbuoi7 8--tongquanseo-mastercode.vnPd fbuoi7 8--tongquanseo-mastercode.vn
Pd fbuoi7 8--tongquanseo-mastercode.vn
 
Pdf bai 7 làm việc với truy vấn nâng cao-slide 07-quan tri csdl voi access-ma...
Pdf bai 7 làm việc với truy vấn nâng cao-slide 07-quan tri csdl voi access-ma...Pdf bai 7 làm việc với truy vấn nâng cao-slide 07-quan tri csdl voi access-ma...
Pdf bai 7 làm việc với truy vấn nâng cao-slide 07-quan tri csdl voi access-ma...
 
c
cc
c
 
Pdfbài 7 máy tính xác tay và máy in bảo trì sự cố máy tính-mastercode.vn
Pdfbài 7 máy tính xác tay và máy in   bảo trì sự cố máy tính-mastercode.vnPdfbài 7 máy tính xác tay và máy in   bảo trì sự cố máy tính-mastercode.vn
Pdfbài 7 máy tính xác tay và máy in bảo trì sự cố máy tính-mastercode.vn
 
Pdfbài 6 bảo trì máy tính bảo trì sự cố máy tính-mastercode.vn
Pdfbài 6 bảo trì máy tính   bảo trì sự cố máy tính-mastercode.vnPdfbài 6 bảo trì máy tính   bảo trì sự cố máy tính-mastercode.vn
Pdfbài 6 bảo trì máy tính bảo trì sự cố máy tính-mastercode.vn
 

Similar to Session 3 inter-servlet communication & filters - Giáo trình Bách Khoa Aptech

Session 2 servlet context and session tracking - Giáo trình Bách Khoa Aptech
Session 2   servlet context and session tracking - Giáo trình Bách Khoa AptechSession 2   servlet context and session tracking - Giáo trình Bách Khoa Aptech
Session 2 servlet context and session tracking - Giáo trình Bách Khoa Aptech
MasterCode.vn
 
Ch. 13 filters and wrappers
Ch. 13 filters and wrappersCh. 13 filters and wrappers
Ch. 13 filters and wrappers
Manolis Vavalis
 

Similar to Session 3 inter-servlet communication & filters - Giáo trình Bách Khoa Aptech (20)

Advanced java programming
Advanced java programmingAdvanced java programming
Advanced java programming
 
Servlet session 12
Servlet   session 12Servlet   session 12
Servlet session 12
 
Servlet
ServletServlet
Servlet
 
Listeners and filters in servlet
Listeners and filters in servletListeners and filters in servlet
Listeners and filters in servlet
 
Session 2 servlet context and session tracking - Giáo trình Bách Khoa Aptech
Session 2   servlet context and session tracking - Giáo trình Bách Khoa AptechSession 2   servlet context and session tracking - Giáo trình Bách Khoa Aptech
Session 2 servlet context and session tracking - Giáo trình Bách Khoa Aptech
 
Filters
FiltersFilters
Filters
 
Identifing Listeners and Filters
Identifing Listeners and FiltersIdentifing Listeners and Filters
Identifing Listeners and Filters
 
Filter
FilterFilter
Filter
 
Filter
FilterFilter
Filter
 
.NET Core, ASP.NET Core Course, Session 9
.NET Core, ASP.NET Core Course, Session 9.NET Core, ASP.NET Core Course, Session 9
.NET Core, ASP.NET Core Course, Session 9
 
Chap4 4 1
Chap4 4 1Chap4 4 1
Chap4 4 1
 
Ch. 13 filters and wrappers
Ch. 13 filters and wrappersCh. 13 filters and wrappers
Ch. 13 filters and wrappers
 
UNIT-3 Servlet
UNIT-3 ServletUNIT-3 Servlet
UNIT-3 Servlet
 
ajava unit 1.pptx
ajava unit 1.pptxajava unit 1.pptx
ajava unit 1.pptx
 
WEB TECHNOLOGIES Servlet
WEB TECHNOLOGIES ServletWEB TECHNOLOGIES Servlet
WEB TECHNOLOGIES Servlet
 
Servlet 3.0
Servlet 3.0Servlet 3.0
Servlet 3.0
 
Lecture 3: Servlets - Session Management
Lecture 3:  Servlets - Session ManagementLecture 3:  Servlets - Session Management
Lecture 3: Servlets - Session Management
 
SOLID: the core principles of success of the Symfony web framework and of you...
SOLID: the core principles of success of the Symfony web framework and of you...SOLID: the core principles of success of the Symfony web framework and of you...
SOLID: the core principles of success of the Symfony web framework and of you...
 
PDC Highlights
PDC HighlightsPDC Highlights
PDC Highlights
 
Advancedservletsjsp
AdvancedservletsjspAdvancedservletsjsp
Advancedservletsjsp
 

More from MasterCode.vn

Pd fbuoi3 4-kỹ thuật xây dựng back link-mastercode.vn
Pd fbuoi3 4-kỹ thuật xây dựng back link-mastercode.vnPd fbuoi3 4-kỹ thuật xây dựng back link-mastercode.vn
Pd fbuoi3 4-kỹ thuật xây dựng back link-mastercode.vn
MasterCode.vn
 

More from MasterCode.vn (20)

Pd ftai lieu-tieng-anh-cho-nguoi-moi-bat-dau-mastercode.vn
Pd ftai lieu-tieng-anh-cho-nguoi-moi-bat-dau-mastercode.vnPd ftai lieu-tieng-anh-cho-nguoi-moi-bat-dau-mastercode.vn
Pd ftai lieu-tieng-anh-cho-nguoi-moi-bat-dau-mastercode.vn
 
Why apps-succeed-wpr-mastercode.vn
Why apps-succeed-wpr-mastercode.vnWhy apps-succeed-wpr-mastercode.vn
Why apps-succeed-wpr-mastercode.vn
 
Dzone performancemonitoring2016-mastercode.vn
Dzone performancemonitoring2016-mastercode.vnDzone performancemonitoring2016-mastercode.vn
Dzone performancemonitoring2016-mastercode.vn
 
Google công bố thông tin lịch xu hướng ngành 2017 mastercode.vn
Google công bố thông tin lịch xu hướng ngành 2017 mastercode.vnGoogle công bố thông tin lịch xu hướng ngành 2017 mastercode.vn
Google công bố thông tin lịch xu hướng ngành 2017 mastercode.vn
 
Nghiên cứu về khách hàng mastercode.vn
Nghiên cứu về khách hàng mastercode.vnNghiên cứu về khách hàng mastercode.vn
Nghiên cứu về khách hàng mastercode.vn
 
Lập trình sáng tạo creative computing textbook mastercode.vn
Lập trình sáng tạo creative computing textbook mastercode.vnLập trình sáng tạo creative computing textbook mastercode.vn
Lập trình sáng tạo creative computing textbook mastercode.vn
 
Pd fbuoi3 4-kỹ thuật xây dựng back link-mastercode.vn
Pd fbuoi3 4-kỹ thuật xây dựng back link-mastercode.vnPd fbuoi3 4-kỹ thuật xây dựng back link-mastercode.vn
Pd fbuoi3 4-kỹ thuật xây dựng back link-mastercode.vn
 
Pd fbuoi2 onpage – tối ưu hóa trang web-mastercode.vn
Pd fbuoi2 onpage – tối ưu hóa trang web-mastercode.vnPd fbuoi2 onpage – tối ưu hóa trang web-mastercode.vn
Pd fbuoi2 onpage – tối ưu hóa trang web-mastercode.vn
 
Pdf buoi1 2-on-page-tran-ngoc-chinh-mastercode.vn
Pdf buoi1 2-on-page-tran-ngoc-chinh-mastercode.vnPdf buoi1 2-on-page-tran-ngoc-chinh-mastercode.vn
Pdf buoi1 2-on-page-tran-ngoc-chinh-mastercode.vn
 
Pdfbài 5 bảo trì và tối ưu windows bảo trì sự cố máy tính-mastercode.vn
Pdfbài 5 bảo trì và tối ưu windows   bảo trì sự cố máy tính-mastercode.vnPdfbài 5 bảo trì và tối ưu windows   bảo trì sự cố máy tính-mastercode.vn
Pdfbài 5 bảo trì và tối ưu windows bảo trì sự cố máy tính-mastercode.vn
 
Pdfbài 4 ổ cứng hard drive bảo trì sự cố máy tính-mastercode.vn
Pdfbài 4 ổ cứng hard drive   bảo trì sự cố máy tính-mastercode.vnPdfbài 4 ổ cứng hard drive   bảo trì sự cố máy tính-mastercode.vn
Pdfbài 4 ổ cứng hard drive bảo trì sự cố máy tính-mastercode.vn
 
Pdfbài 3 cpu và ram bảo trì sự cố máy tính-mastercode.vn
Pdfbài 3 cpu và ram   bảo trì sự cố máy tính-mastercode.vnPdfbài 3 cpu và ram   bảo trì sự cố máy tính-mastercode.vn
Pdfbài 3 cpu và ram bảo trì sự cố máy tính-mastercode.vn
 
Pdfbài 1 giới thiệu chung về phần cứng bảo trì sự cố máy tính-mastercode.vn
Pdfbài 1 giới thiệu chung về phần cứng   bảo trì sự cố máy tính-mastercode.vnPdfbài 1 giới thiệu chung về phần cứng   bảo trì sự cố máy tính-mastercode.vn
Pdfbài 1 giới thiệu chung về phần cứng bảo trì sự cố máy tính-mastercode.vn
 
Pdfbài 2 bo mạch chủ (main) bảo trì sự cố máy tính-mastercode.vn
Pdfbài 2 bo mạch chủ (main)   bảo trì sự cố máy tính-mastercode.vnPdfbài 2 bo mạch chủ (main)   bảo trì sự cố máy tính-mastercode.vn
Pdfbài 2 bo mạch chủ (main) bảo trì sự cố máy tính-mastercode.vn
 
Pdf bai 6 làm việc với truy vấn cơ bản-slide 06-quan tri csdl voi access-mast...
Pdf bai 6 làm việc với truy vấn cơ bản-slide 06-quan tri csdl voi access-mast...Pdf bai 6 làm việc với truy vấn cơ bản-slide 06-quan tri csdl voi access-mast...
Pdf bai 6 làm việc với truy vấn cơ bản-slide 06-quan tri csdl voi access-mast...
 
Pdf bai 5 làm việc với báo cáo nâng cao-slide 05-quan tri csdl voi access-mas...
Pdf bai 5 làm việc với báo cáo nâng cao-slide 05-quan tri csdl voi access-mas...Pdf bai 5 làm việc với báo cáo nâng cao-slide 05-quan tri csdl voi access-mas...
Pdf bai 5 làm việc với báo cáo nâng cao-slide 05-quan tri csdl voi access-mas...
 
Pdf bai 4 làm việc với báo cáo cơ bản-slide 04-quan tri csdl voi access-maste...
Pdf bai 4 làm việc với báo cáo cơ bản-slide 04-quan tri csdl voi access-maste...Pdf bai 4 làm việc với báo cáo cơ bản-slide 04-quan tri csdl voi access-maste...
Pdf bai 4 làm việc với báo cáo cơ bản-slide 04-quan tri csdl voi access-maste...
 
Pdf bai 3 làm việc với biểu mẫu nâng cao-slide 03-quan tri csdl voi access-ma...
Pdf bai 3 làm việc với biểu mẫu nâng cao-slide 03-quan tri csdl voi access-ma...Pdf bai 3 làm việc với biểu mẫu nâng cao-slide 03-quan tri csdl voi access-ma...
Pdf bai 3 làm việc với biểu mẫu nâng cao-slide 03-quan tri csdl voi access-ma...
 
Pdf bai 2 làm việc với biểu mẫu cơ bản-slide 02-quan tri csdl voi access-mast...
Pdf bai 2 làm việc với biểu mẫu cơ bản-slide 02-quan tri csdl voi access-mast...Pdf bai 2 làm việc với biểu mẫu cơ bản-slide 02-quan tri csdl voi access-mast...
Pdf bai 2 làm việc với biểu mẫu cơ bản-slide 02-quan tri csdl voi access-mast...
 
Pdf bai 1 tổng quan về ms access-quan tri csdl voi access-mastercode.vn
Pdf bai 1 tổng quan về ms access-quan tri csdl voi access-mastercode.vnPdf bai 1 tổng quan về ms access-quan tri csdl voi access-mastercode.vn
Pdf bai 1 tổng quan về ms access-quan tri csdl voi access-mastercode.vn
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 

Session 3 inter-servlet communication & filters - Giáo trình Bách Khoa Aptech

  • 1. Slide 1 of 25 Filters Inter-Servlet Communication
  • 2. Slide 2 of 25 Objectives  Introduction to Filters  Filter API  Configuring Filter  Manipulating Request and Responses  Servlet Communication
  • 3. Slide 3 of 25 Introduction Filter
  • 4. Slide 4 of 25 Filters  Components that add functionality to the request and response processing of a Web Application  Intercept the requests and responses that flow between a client and a Servlet/JSP.
  • 5. Slide 5 of 25 Filter Participation User Filter Web Resource (Servlet / JSP) Request Response Filter Participating in Request-Response Process
  • 6. Slide 6 of 25 Filter Life Cycle Instantiation and Loading Initialization init() doFilter() destroy() Unavailable GC
  • 7. Slide 7 of 25 Filter Chain  Invoke a series of filters  If the Calling filter is last filter, will invoke web resource Filter 1 Client Filter 2 Filter 3 Web Resourc e Working of Filter Chain Filter Chain
  • 8. Slide 8 of 25 Usage of Filter  Authentication  Logging and auditing filter  Image conversion filters  Data compression  Encryption filters  Filters that trigger resource access events
  • 9. Slide 9 of 25 Benefits of Filter
  • 10. Slide 10 of 25 Compress Filter
  • 11. Slide 11 of 25 Working of Filter
  • 12. Slide 12 of 25 Working of Filter
  • 13. Slide 13 of 25 Filter API
  • 14. Slide 14 of 25 “Filter” Interface A filter is an object than perform filtering tasks on either the request to a resource (a servlet or static content), or on the response from a resource, or both.  Init()  doFilter()  Destroy()
  • 15. Slide 15 of 25 “FilterConfig” Interface  A filter configuration object used by a servlet container used to pass information to a filter during initialization  Methods – getFilterName() – getInitParameter() – getInitParameterNames() – getServletContext()
  • 16. Slide 16 of 25 “FilterChain” Interface  A FilterChain is an object provided by the servlet container to the developer giving a view into the invocation chain of a filtered request for a resource  Methods – doFilter()
  • 17. Slide 17 of 25 Configuring Filter <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <filter> <filter-name>TimerFilter</filter-name> <filter-class>filters.TimerFilter</filter-class> </filter> <filter-mapping> <filter-name>TimerFilter</filter-name> <url-pattern>/TimerFilter</url-pattern> </filter-mapping> <session-config> <session-timeout> 30 </session-timeout> </session-config> <welcome-file-list> <welcome-file>Timer.html</welcome-file> </welcome-file-list> </web-app> 17
  • 18. Slide 18 of 25 Filter Element  <icon>  <filter-name>  <display-name>  <description>  <filter-class>  <init-param>
  • 19. Slide 19 of 25 Filter-Mapping Element  <filter-name>  <url-name>  <servlet-name>
  • 20. Slide 20 of 25 Configuring Filter Chain
  • 21. Slide 21 of 25 Manipulating Request and Response
  • 22. Slide 22 of 25 Manipulating Request and Response  ServletRequestWrapper  ServletResponseWrapper
  • 23. Slide 23 of 25 Inter-Servlet Communication  A process where two or more Servlets communicates with each other to process the client request.  A Servlet can forward the request to another Servlet to process the client request.  A Servlet can include the output of another Servlet to process the client request.
  • 24. Slide 24 of 25 Applet – Servlet Communication  Developing Applet front end application  Establishing connection between applet and servlet  Communicasting throught object serialisation  Sending objects from applet to servlet  Sending objects from servlet to applet
  • 25. Slide 25 of 25 Summary  Introduction to Filters  Filter API  Configuring Filter  Manipulating Request and Responses  Servlet Communication