Servlets Parte III
Servlets Parte III
Servlets Parte III
THEMATIC UNIT I:
Introduction to Web Applications
ndice
1 Filtering
Introduction
2 Sessions
2/28
THEMATIC UNIT I: Introduction to Web Applications Hermes Francisco Montes Casiano
Filtering Sessions Annotations and pluggability
Introduction
Definition
Filters are Java components that allow on the fly transformations
of payload and header information in both the request into a
resource and the response from a resource
3/28
THEMATIC UNIT I: Introduction to Web Applications Hermes Francisco Montes Casiano
Filtering Sessions Annotations and pluggability
Filtering
What is a filter?
4/28
THEMATIC UNIT I: Introduction to Web Applications Hermes Francisco Montes Casiano
Filtering Sessions Annotations and pluggability
Authentication filters.
Logging and auditing filters.
Image conversion filters.
Data compression filters.
Encryption filters.
Tokenizing filters.
Filters that trigger resource access events.
XSL/T filters that transform XML content.
MIME-type chain filters.
Caching filters.
5/28
THEMATIC UNIT I: Introduction to Web Applications Hermes Francisco Montes Casiano
Filtering Sessions Annotations and pluggability
Filter Lifecycle
Filter Lifecycle
doFilter method
1 The method examines the requests headers.
2 The method may wrap the request object.
3 The method may wrap the response object.
4 The filter may invoke the next entity in the filter chain.
5 After invocation of the next filter in the chain, the filter may
examine response headers.
6 Alternatively, the filter may have thrown an exception to
indicate an error in processing.
7 When the last filter in the chain has been invoked, the next
entity accessed is the target servlet or resource at the end of
the chain.
8 Before a filter instance can be removed from service by the
container, the container must first call the destroy method.
7/28
THEMATIC UNIT I: Introduction to Web Applications Hermes Francisco Montes Casiano
Filtering Sessions Annotations and pluggability
Configuration of Filters
8/28
THEMATIC UNIT I: Introduction to Web Applications Hermes Francisco Montes Casiano
Filtering Sessions Annotations and pluggability
Configuration of Filters
Examples
9/28
THEMATIC UNIT I: Introduction to Web Applications Hermes Francisco Montes Casiano
Filtering Sessions Annotations and pluggability
Configuration of Filters
Examples
10/28
THEMATIC UNIT I: Introduction to Web Applications Hermes Francisco Montes Casiano
Filtering Sessions Annotations and pluggability
11/28
THEMATIC UNIT I: Introduction to Web Applications Hermes Francisco Montes Casiano
Filtering Sessions Annotations and pluggability
12/28
THEMATIC UNIT I: Introduction to Web Applications Hermes Francisco Montes Casiano
Filtering Sessions Annotations and pluggability
ndice
1 Filtering
2 Sessions
Introduction
13/28
THEMATIC UNIT I: Introduction to Web Applications Hermes Francisco Montes Casiano
Filtering Sessions Annotations and pluggability
Introduction
14/28
THEMATIC UNIT I: Introduction to Web Applications Hermes Francisco Montes Casiano
Filtering Sessions Annotations and pluggability
Cookies
15/28
THEMATIC UNIT I: Introduction to Web Applications Hermes Francisco Montes Casiano
Filtering Sessions Annotations and pluggability
Creating a Session
16/28
THEMATIC UNIT I: Introduction to Web Applications Hermes Francisco Montes Casiano
Filtering Sessions Annotations and pluggability
Session Scope
17/28
THEMATIC UNIT I: Introduction to Web Applications Hermes Francisco Montes Casiano
Filtering Sessions Annotations and pluggability
18/28
THEMATIC UNIT I: Introduction to Web Applications Hermes Francisco Montes Casiano
Filtering Sessions Annotations and pluggability
Session Timeouts
19/28
THEMATIC UNIT I: Introduction to Web Applications Hermes Francisco Montes Casiano
Filtering Sessions Annotations and pluggability
ndice
1 Filtering
2 Sessions
20/28
THEMATIC UNIT I: Introduction to Web Applications Hermes Francisco Montes Casiano
Filtering Sessions Annotations and pluggability
Annotations
Introduction
21/28
THEMATIC UNIT I: Introduction to Web Applications Hermes Francisco Montes Casiano
Filtering Sessions Annotations and pluggability
Annotations
Introduction
21/28
THEMATIC UNIT I: Introduction to Web Applications Hermes Francisco Montes Casiano
Filtering Sessions Annotations and pluggability
Annotations
22/28
THEMATIC UNIT I: Introduction to Web Applications Hermes Francisco Montes Casiano
Filtering Sessions Annotations and pluggability
Modularity of web.xml
Modularity of web.xml
It can include almost all the same elements that the web.xml
descriptor uses.
However the top level element for the descriptor MUST be
web-fragment and the corresponding descriptor file MUST be
called web-fragment.xml.
If a framework is packaged as a jar file and has metadata
information in the form of deployment descriptor then the
web-fragment.xml descriptor must be in the META-INF/
directory of the jar file.
If a framework wants its META-INF/web-fragment.xml
honored in such a way that it augments a web applications
web.xml, the framework must be bundled within the web
applications WEB-INF/lib directory.
24/28
THEMATIC UNIT I: Introduction to Web Applications Hermes Francisco Montes Casiano
Filtering Sessions Annotations and pluggability
Modularity of web.xml
25/28
THEMATIC UNIT I: Introduction to Web Applications Hermes Francisco Montes Casiano
Filtering Sessions Annotations and pluggability
Modularity of web.xml
Example
26/28
THEMATIC UNIT I: Introduction to Web Applications Hermes Francisco Montes Casiano
Filtering Sessions Annotations and pluggability
27/28
THEMATIC UNIT I: Introduction to Web Applications Hermes Francisco Montes Casiano
Filtering Sessions Annotations and pluggability
28/28
THEMATIC UNIT I: Introduction to Web Applications Hermes Francisco Montes Casiano