Class JKSetCharacterEncodingFilter

java.lang.Object
com.jk.web.filters.JKSetCharacterEncodingFilter
All Implemented Interfaces:
jakarta.servlet.Filter

public class JKSetCharacterEncodingFilter extends Object implements jakarta.servlet.Filter
This class is a Java Servlet filter that sets the character encoding for incoming requests.
Version:
1.0
Author:
Dr. Jalal H. Kiswani
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected String
    Represents the encoding.
    protected jakarta.servlet.FilterConfig
    Represents the filter configuration.
    protected boolean
    Indicates whether to ignore the filter or not.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    void
    doFilter(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, jakarta.servlet.FilterChain chain)
    void
    init(jakarta.servlet.FilterConfig filterConfig)
    protected String
    selectEncoding(jakarta.servlet.ServletRequest request)
    This method selects the character encoding.

    Methods inherited from class java.lang.Object

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

    • encoding

      protected String encoding
      Represents the encoding.
    • filterConfig

      protected jakarta.servlet.FilterConfig filterConfig
      Represents the filter configuration.
    • ignore

      protected boolean ignore
      Indicates whether to ignore the filter or not.
  • Constructor Details

    • JKSetCharacterEncodingFilter

      public JKSetCharacterEncodingFilter()
  • Method Details

    • destroy

      public void destroy()
      Specified by:
      destroy in interface jakarta.servlet.Filter
    • 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
    • init

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

      protected String selectEncoding(jakarta.servlet.ServletRequest request)
      This method selects the character encoding.
      Parameters:
      request - Specifies the servlet request.
      Returns:
      the selected character encoding.