Summary

 < Free Open Study > 



We saw in this chapter how filters can be used to add functionality such as auditing, logging, authentication, transformation, compression, and encryption to our applications at deployment time. Such functionality can be easily added and removed as business requirements change.

Filters can be used without having to touch existing code. Filter definitions and filter mapping within the deployment descriptor are used to indicate to the container how filters should be chained together and which web resource the filters should apply to. Multiple instances of the same underlying filter can even be configured within the deployment descriptor together with different initialization parameters. The container manages the lifetime of a filter, and will create and destroy instances of the filter as specified in the deployment descriptor.

To complete the chapter, we built two filters: a simple logging filter, and a transformation filter. The transformation filter allowed the same underlying service logic to service a variety of different clients Finally, we saw how these two filters could be chained together in order to combine their functionality.

In the next chapter we're going to look at how we can harness the power of servlets with the flexibility and ease of use of a markup language - by using JavaServer Pages

A

Adaptor architectural pattern

  • filter used to implement, 8

auditing filters, 8

authentication filters, 9

authorization filters, 9

B

browsers, detecting type

  • XSLT transformation filter example, 13

buffers

  • creating wrapper class for, 14

C

chaining filters

  • Logger and XSLTFilter filters, 19

classes

  • filter classes, 5

components

  • filters, 1

compression filters, 8

content substitution filters

  • XSLT transformation filter example, 14

D

decryption filters, 8

deployment descriptor

  • configuring filters, 6

destroy() method

  • filter lifecycle, 5

  • javax.servlet.Filter interface, 6

  • logging filters example, 10

  • XSLT transformation filter example, 15

doFilter() method

  • filter lifecycle, 5

  • javax.servlet.Filter interface, 5

  • logging filters example, 9

  • XSLT transformation filter example, 16

E

elements

  • !see following elements by name.

  • filter> element.

  • filter-class> element.

  • filter-mapping> element.

  • filter-name> element.

  • init-param> element.

  • param-name> element.

  • param-value> element.

  • url-pattern> element.

encryption filters, 8

F

filter> element

  • defining filters, 6

filterChain object

  • filter operations, 5

  • logging filter example, 9

filter-class> element

  • defining filters, 6

  • logging filter example, 11

filterConfig object

  • filter lifecycle, 5

  • releasing reference, 10

  • XSLT transformation filter example, 15

filter-mapping> element

  • chaining filters, 8

  • logging filter example, 11

  • mapping filters, 7

filter-name> element

  • chaining filters, 8

  • defining filters, 6

  • logging filter example, 11

  • mapping filters, 7

filters

  • classes, 5

  • deployment descriptor, 6

  • developing filters, 20

  • explained, 1

  • interfaces, 5

  • lifecycle, 5

  • logical view, 3

  • physical view, 4

  • pre-processing filter logic, 6

  • web application component, 1–20

  • web services and, 3

  • wrapper class for a buffer, creating, 14

filters, configuring, 6

  • chaining filters, 8, 19

    • order within chain, 8

  • defining filters, 6

  • mapping filters, 7

filters, examples/types

  • chargeable pages filter, 2

  • content substitution filters, 14

  • frequently used pages filter, 2

  • logging filter example, 9

  • XSLT transformation filter example, 13

filters, uses, 4, 8

  • adding new functionality, 2

  • patching legacy code, 2

  • prototyping new functionality, 2

G

getInitParameter() method

  • XSLT transformation filter example, 15

H

HTML (HyperText Markup Language)

  • converting from XML, 13

I

init() method

  • filter lifecycle, 5

  • javax.servlet.Filter interface, 5

  • logging filters example, 10

  • order called, 7

  • XSLT transformation filter example, 15

init-param> element

  • defining filters, 6

interfaces

  • filter interfaces, 5

  • javax.servlet.Filter interface, 5

J

javax.servlet.Filter interface

  • methods, 5

L

lifecycle of a filter, 5

log file

  • logging filter example, 12

logging filter example

  • configuring filter, 11

logging filters, 8

  • example, 9

    • using, 12

M

methods

  • !see following methods by name.

  • destroy() method.

  • doFilter() method.

  • getInitParameter() method.

  • init() method.

P

param-name> element

  • defining filters, 6

param-value> element

  • defining filters, 6

R

request transformation see filters.

response transformation see filters.

S

servlet> element

  • logging filter example, 11

servlet-class> element

  • logging filter example, 11

ServletException object

  • init() method, 5

servlet-name> element

  • logging filter example, 11

  • mapping filters, 7

T

transformation filters, 9

U

url-pattern> element

  • chaining filters, 8

  • logging filter example, 11

  • mapping filters, 7

USER-AGENT header

  • browser type, detecting, 13

  • XSLT transformation filter example, 16

W

web services

  • filters and, 3

web-app> element

  • logging filter example, 11

wrapper class

  • creating for a buffer, 14

X

XML (eXtensible Markup Language)

  • converting to HTML, 13

XSLT parser

  • web site for download, 14

XSLT transformation filter example, 13

  • browser type, detecting, 13

  • configuring filter, 17

  • converting XML to HTML, 13

  • implementing, 14

  • using, 18

  • XSLT parser web site, 14

xsltFactory object

  • XSLT transformation filter example, 15

xsltTemplates object

  • XSLT transformation filter example, 15



 < Free Open Study > 



Professional Java Servlets 2.3
Professional Java Servlets 2.3
ISBN: 186100561X
EAN: 2147483647
Year: 2006
Pages: 130

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net