This blog is to guide you how you can filter the requests and add your custom checks in ADF application.
Follow below steps to create/configure a Servlet Filter in your ADF/Webcenter application.
1. From new wizard select Servlet and select Servlet Filter
Follow below steps to create/configure a Servlet Filter in your ADF/Webcenter application.
1. From new wizard select Servlet and select Servlet Filter
2. Click on next
3. Enter the name of Servlet filter and package
4. Map to Servlet or JSP radio button should be selected and it is default selection.
5. Click on finish and you will get a servlet filter created.
This is the class generated after you click finish, it is having init, destroy and doFilter methods.
We will write our logic in doFilter method. This will be called whenever a Servlet or jsp page request arrive to application.
As we created servlet filter with ADF steps so it has added our filter entry in web.xml file which is a mandate to work our filter.
We can create other filters also but we must register it in web.xml file.
We can mention servlet initialization parameter when we are configuring our ServletFilter or after configuring also and same parameters can be used.
Main purpose of such servlet filters is to fix security issues, work on application navigation control, validation of XSS and much more.
I added some code in doFilter method. here we can check for session timeout, or any attacks from other domain etc.
Based on your validation/requirement, you can force it inside this method(doFilter) and navigate your application to desired page by setting response value. In example i have set value of initialization parameter to response variable which was added in web.xml while initializing the servlet Filter.
Comments
Post a Comment