Package org.silverpeas.looks.aurora.matomo

# Class MatomoInjectionFilter

java.lang.Object
org.silverpeas.looks.aurora.matomo.MatomoInjectionFilter

All Implemented Interfaces:
  `jakarta.servlet.Filter`

public class MatomoInjectionFilter extends Object implements jakarta.servlet.Filter
Servlet `Filter` responsible for injecting the Matomo tracking script into generated JSP pages.

The script is dynamically built using a Silverpeas template and enriched with contextual information such as the current user, space and component identifiers.

The injection is performed just before the closing `</body>` tag of the HTML response.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `MatomoInjectionFilter()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `doFilter(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, jakarta.servlet.FilterChain chain)`
  `String`
  `getCurrentUserId(jakarta.servlet.http.HttpServletRequest request)`
  `void`
  `init(jakarta.servlet.FilterConfig filterConfig)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface jakarta.servlet.Filter

  `destroy`

- ## Constructor Details

  - ### MatomoInjectionFilter

    public MatomoInjectionFilter()

- ## Method Details

  - ### init

    public void init(jakarta.servlet.FilterConfig filterConfig) throws jakarta.servlet.ServletException
    Specified by:
      `init` in interface `jakarta.servlet.Filter`
    Throws:
      `jakarta.servlet.ServletException`

  - ### doFilter

    public void doFilter(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, jakarta.servlet.FilterChain chain) throws IOException, jakarta.servlet.ServletException
    Specified by:
      `doFilter` in interface `jakarta.servlet.Filter`
    Throws:
      `IOException`
      `jakarta.servlet.ServletException`

  - ### getCurrentUserId

    public String getCurrentUserId(jakarta.servlet.http.HttpServletRequest request)