org.apache.jmeter.protocol.http.util.accesslog

## Class SessionFilter

- java.lang.Object
- - org.apache.jmeter.protocol.http.util.accesslog.SessionFilter

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, Filter, TestCloneable, ThreadListener

      public class SessionFilter
      extends java.lang.Object
      implements Filter, java.io.Serializable, TestCloneable, ThreadListener

  Provides Session Filtering for the AccessLog Sampler.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SessionFilter()` Creates a new SessionFilter and initializes its fields to new collections
    `SessionFilter(java.util.Map<java.lang.String,CookieManager> cookieManagers, java.util.Set<CookieManager> managersInUse)` Creates a new SessionFilter, but re-uses the given collections

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.Object` | `clone()`
    `void` | `excludeFiles(java.lang.String[] filenames)` Exclude all files in the array
    `void` | `excludePattern(java.lang.String[] regexp)` Exclude any log entry that contains the following regular expression pattern.
    `java.lang.String` | `filter(java.lang.String text)` In case the user wants to replace the file extension, log parsers should call this method.
    `protected CookieManager` | `getCookieManager(java.lang.String ipAddr)`
    `protected java.lang.String` | `getIpAddress(java.lang.String logLine)`
    `protected boolean` | `hasExcPattern(java.lang.String text)`
    `void` | `includeFiles(java.lang.String[] filenames)` Include all files in the array.
    `void` | `includePattern(java.lang.String[] regexp)` Include any log entry that contains the following regular expression pattern.
    `boolean` | `isFiltered(java.lang.String path, TestElement sampler)` Log parser will call this method to see if a particular entry should be filtered or not.
    `void` | `reset()` Tell the filter when the parsing has reached the end of the log file and is about to begin again.
    `void` | `setReplaceExtension(java.lang.String oldextension, java.lang.String newextension)`
    `void` | `threadFinished()` Called for each thread after all samples have been processed.
    `void` | `threadStarted()` Called for each thread before starting sampling.

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

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

- - ### Constructor Detail

    - #### SessionFilter

          public SessionFilter()

      Creates a new SessionFilter and initializes its fields to new collections

    - #### SessionFilter

          public SessionFilter(java.util.Map<java.lang.String,CookieManager> cookieManagers,
                               java.util.Set<CookieManager> managersInUse)

      Creates a new SessionFilter, but re-uses the given collections
      Parameters:
        `cookieManagers` - `CookieManager`s to be used for the different IPs
        `managersInUse` - CookieManagers currently in use by other threads

  - ### Method Detail

    - #### hasExcPattern

          protected boolean hasExcPattern(java.lang.String text)

    - #### getIpAddress

          protected java.lang.String getIpAddress(java.lang.String logLine)

    - #### reset

          public void reset()

      Tell the filter when the parsing has reached the end of the log file and is about to begin again. Gives the filter a chance to adjust it's values, if needed.
      Specified by:
        `reset` in interface `Filter`

    - #### clone

          public java.lang.Object clone()

      Specified by:
        `clone` in interface `TestCloneable`
      Overrides:
        `clone` in class `java.lang.Object`

    - #### excludeFiles

          public void excludeFiles(java.lang.String[] filenames)

      Exclude all files in the array
      Specified by:
        `excludeFiles` in interface `Filter`
      Parameters:
        `filenames` - names of files to exclude

    - #### excludePattern

          public void excludePattern(java.lang.String[] regexp)

      Exclude any log entry that contains the following regular expression pattern.
      Specified by:
        `excludePattern` in interface `Filter`
      Parameters:
        `regexp` - list of regexp that match entries that should be excluded

    - #### filter

          public java.lang.String filter(java.lang.String text)

      In case the user wants to replace the file extension, log parsers should call this method. This is useful for regression test plans. If a website is migrating from one platform to another and the file extension changes, the filter provides an easy way to do it without spending a lot of time.
      Specified by:
        `filter` in interface `Filter`
      Parameters:
        `text` - log line to be filtered
      Returns:
        String

    - #### includeFiles

          public void includeFiles(java.lang.String[] filenames)

      Include all files in the array.
      Specified by:
        `includeFiles` in interface `Filter`
      Parameters:
        `filenames` - names of files to include

    - #### includePattern

          public void includePattern(java.lang.String[] regexp)

      Include any log entry that contains the following regular expression pattern.
      Specified by:
        `includePattern` in interface `Filter`
      Parameters:
        `regexp` - list of regexp that match entries that should be included

    - #### isFiltered

          public boolean isFiltered(java.lang.String path,
                                    TestElement sampler)

      Log parser will call this method to see if a particular entry should be filtered or not.
      Specified by:
        `isFiltered` in interface `Filter`
      Parameters:
        `path` - log line that should be checked if it should to be filtered out
        `sampler` - `TestElement` in which the line would be added
      Returns:
        boolean `true` if line should be filtered out, `false` otherwise

    - #### getCookieManager

          protected CookieManager getCookieManager(java.lang.String ipAddr)

    - #### setReplaceExtension

          public void setReplaceExtension(java.lang.String oldextension,
                                          java.lang.String newextension)

      Specified by:
        `setReplaceExtension` in interface `Filter`
      Parameters:
        `oldextension` - old extension
        `newextension` - new extension

    - #### threadFinished

          public void threadFinished()

      Called for each thread after all samples have been processed. See org.apache.jmeter.threads.JMeterThread#threadFinished(org.apache.jmeter.engine.event.LoopIterationListener)
      Specified by:
        `threadFinished` in interface `ThreadListener`

    - #### threadStarted

          public void threadStarted()

      Called for each thread before starting sampling. WARNING: this is called before any Config test elements are processed, so any properties they define will not have been merged in yet. See org.apache.jmeter.threads.JMeterThread#threadStarted()
      Specified by:
        `threadStarted` in interface `ThreadListener`

Copyright © 1998-2019 Apache Software Foundation. All Rights Reserved.