Spring Boot Filters Example

Introduction Servlet filters are Java classes that are invoked at pre and post processing of requests. So filters are used to intercept requests from clients before they access requests at backend (server). to manipulate responses from server before they are sent back to the client RequestContextFilter is also a servlet filter that extends OncePerRequestFilter that extends GenericFilterBean which implements servlet…

CodeIgniter 4 Filters Example

Introduction In this tutorial, I will discuss about how to work with CodeIgniter 4 filters. These filters are controller filters. Controller Filters allow you to perform actions either before or after the controllers execute. Unlike events, you can choose the specific URIs in which the filters will be applied to. Incoming filters may modify the Request while after filters can…

Excel Custom Filters on Number Column using Java and Apache POI

Introduction In this example I am going to show you how to work with filters in excel file on text column using Java and Apache POI library. The following list of custom filters for number columns can be implemented: Equals Does Not Equal Greater Than Greater Than Or Equal To Less Than Less Than Or Equal To Between Top 10…

Excel Custom Filters on Text Column using Java and Apache POI

Introduction In this example I am going to show you how to work with filters in excel file on text column using Java and Apache POI library. The following list of custom filters for text columns can be implemented: Equals Does Not Equal Begins With Ends With Contains Does Not Contain

Java 8 Stream Filter Example

Java 8 Filter This tutorial will show you how to use Java 8 stream API‘s filter() and map() methods. The filter() method in Java 8 or onward is used to produce a stream containing only a certain type of objects into the result output and map() method is used to transform a stream from one type to another type into…

Prevent user going back to login page if already logged in using filters

In this article I am going to show you how to prevent user going back to the login page if a user is already logged in or redirect a user to the login page if the user is not already logged in. When browser caches the resources then clicking on the browser’s back button will take a user to the…

Prevent Browser From Caching Resources Using Servlet Filter

Introduction In this tutorial I am going to tell you how you can prevent cache in browser using Servlet in web applications. Sometimes you may need to clear the browser cache or prevent the browser from caching resources so that users always get the latest output from the server. Disabling caching of web pages ensures resources are coming every time…

Cache static resources like css, js and images for a specific time period

Introduction In this post we will see how to cache static resources like css, js and images for a specific period of time. So we will specify the time for how long we want to cache such static resources. Static resources like css, js images etc. need not be reloaded from the server every time until and unless we want…