Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the purpose of <filter> tag in web.xml?

What is the purpose of <filter> tag in web.xml?

like image 319
vinoth kumar Avatar asked Dec 13 '22 17:12

vinoth kumar


1 Answers

It allows you to declare servlet filters, which are aspects for HTTP requests. A filter chain can intercept an incoming request and/or an outgoing response and modify it as needed.

A common example is to have a filter that performs a GZIP compression on a response stream if the user's browser can accept it. This improves performance by reducing the number of bytes on the wire, provided that the savings is greater than the time to compress and decompress.

like image 107
duffymo Avatar answered Dec 28 '22 22:12

duffymo