Package filter

Class ActivityLoggingFilter

java.lang.Object
filter.ActivityLoggingFilter
All Implemented Interfaces:
javax.servlet.Filter

public class ActivityLoggingFilter extends Object implements javax.servlet.Filter
Filter that logs user activities in the banking system Records who did what
Author:
TAMIL MUGHILAN
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Cleans up resources when filter is destroyed.
    void
    doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain)
    Filters requests and logs user activities after processing.
    void
    init(javax.servlet.FilterConfig filterConfig)
    Initializes the filter when application starts.
    private boolean
    Checks if the requested path is a static resource like CSS, JS, or images.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ActivityLoggingFilter

      public ActivityLoggingFilter()
  • Method Details

    • doFilter

      public void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException
      Filters requests and logs user activities after processing. Skips logging for static files and open pages.
      Specified by:
      doFilter in interface javax.servlet.Filter
      Parameters:
      request - the servlet request
      response - the servlet response
      chain - the filter chain to continue processing
      Throws:
      IOException - if an I/O error occurs
      javax.servlet.ServletException - if a servlet error occurs
    • isStaticResource

      private boolean isStaticResource(String path)
      Checks if the requested path is a static resource like CSS, JS, or images.
      Parameters:
      path - the request path to check
      Returns:
      true if it's a static resource, false otherwise
    • init

      public void init(javax.servlet.FilterConfig filterConfig)
      Initializes the filter when application starts.
      Specified by:
      init in interface javax.servlet.Filter
      Parameters:
      filterConfig - the filter configuration
    • destroy

      public void destroy()
      Cleans up resources when filter is destroyed.
      Specified by:
      destroy in interface javax.servlet.Filter