Class AbstractController

java.lang.Object
org.ff4j.web.controller.AbstractController
Direct Known Subclasses:
AuditController, FeaturesController, FeatureUsageController, HomeController, InfosController, NotFoundController, OperationsController, PropertiesController, SettingsController, StaticResourceController, TimeSeriesController

public abstract class AbstractController extends Object
Display view.
Author:
Cedrick LUNVEN (@clunven)
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Set<String>
    List of groups to consider admins
    protected FF4j
    FF4J instance.
    protected static final String
    KEY.
    static final org.slf4j.Logger
    Logger for this class.
    protected static SimpleDateFormat
    Date format.
    static final SimpleDateFormat
    Slot for the date.
    protected String
    Success View.
    protected org.thymeleaf.TemplateEngine
    Template engine.
  • Constructor Summary

    Constructors
    Constructor
    Description
    AbstractController(FF4j ff4j, String view, org.thymeleaf.TemplateEngine te)
    Default constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    buildQuery(jakarta.servlet.http.HttpServletRequest req)
     
    void
    get(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res)
    Invoked by dispatcher.
    abstract void
    get(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res, org.thymeleaf.context.WebContext ctx)
    Create view from template.
    Getter accessor for attribute 'ff4j'.
    Getter accessor for attribute 'successView'.
    org.thymeleaf.TemplateEngine
    Getter accessor for attribute 'templateEngine'.
    protected boolean
    isValidParam(jakarta.servlet.http.HttpServletRequest req, String param)
    Check parameter for date.
    parseQuery(jakarta.servlet.http.HttpServletRequest req)
    Retrieve time interval for audit events in history by parsing incoming http request.
    void
    post(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res)
    Invoked by dispatcher.
    abstract void
    post(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res, org.thymeleaf.context.WebContext ctx)
    Create view from template.
    void
    setFf4j(FF4j ff4j)
    Setter accessor for attribute 'ff4j'.
    void
    setSuccessView(String successView)
    Setter accessor for attribute 'successView'.
    void
    setTemplateEngine(org.thymeleaf.TemplateEngine templateEngine)
    Setter accessor for attribute 'templateEngine'.

    Methods inherited from class java.lang.Object

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

    • LOGGER

      public static final org.slf4j.Logger LOGGER
      Logger for this class.
    • SDF

      protected static SimpleDateFormat SDF
      Date format.
    • SDFSLOT

      public static final SimpleDateFormat SDFSLOT
      Slot for the date.
    • ADMIN_GROUPS

      public static final Set<String> ADMIN_GROUPS
      List of groups to consider admins
    • KEY_TITLE

      protected static final String KEY_TITLE
      KEY.
      See Also:
    • ff4j

      protected FF4j ff4j
      FF4J instance.
    • templateEngine

      protected org.thymeleaf.TemplateEngine templateEngine
      Template engine.
    • successView

      protected String successView
      Success View.
  • Constructor Details

    • AbstractController

      public AbstractController(FF4j ff4j, String view, org.thymeleaf.TemplateEngine te)
      Default constructor.
      Parameters:
      ff4j - current instance of FF4J.
      te - target template engine.
  • Method Details

    • get

      public void get(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res) throws IOException
      Invoked by dispatcher.
      Parameters:
      req - current request
      res - current response
      Throws:
      IOException - error occured.
    • post

      public void post(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res) throws IOException
      Invoked by dispatcher.
      Parameters:
      req - current request
      res - current response
      Throws:
      IOException - error occured.
    • get

      public abstract void get(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res, org.thymeleaf.context.WebContext ctx) throws Exception
      Create view from template.
      Parameters:
      req - current http request
      res - current http response
      Throws:
      IOException - target error
      Exception
    • post

      public abstract void post(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res, org.thymeleaf.context.WebContext ctx) throws Exception
      Create view from template.
      Parameters:
      req - current http request
      res - current http response
      Throws:
      IOException - target error
      Exception
    • isValidParam

      protected boolean isValidParam(jakarta.servlet.http.HttpServletRequest req, String param)
      Check parameter for date.
      Parameters:
      req - current http request.
      param - parameter name
      Returns:
      if the param exist and is not null
    • parseQuery

      protected EventQueryDefinition parseQuery(jakarta.servlet.http.HttpServletRequest req)
      Retrieve time interval for audit events in history by parsing incoming http request.
      Parameters:
      req - current http request
      Returns:
      a time intervale startTime - endTime
    • buildQuery

      protected EventQueryDefinition buildQuery(jakarta.servlet.http.HttpServletRequest req)
    • getFf4j

      public FF4j getFf4j()
      Getter accessor for attribute 'ff4j'.
      Returns:
      current value of 'ff4j'
    • setFf4j

      public void setFf4j(FF4j ff4j)
      Setter accessor for attribute 'ff4j'.
      Parameters:
      ff4j - new value for 'ff4j '
    • getTemplateEngine

      public org.thymeleaf.TemplateEngine getTemplateEngine()
      Getter accessor for attribute 'templateEngine'.
      Returns:
      current value of 'templateEngine'
    • setTemplateEngine

      public void setTemplateEngine(org.thymeleaf.TemplateEngine templateEngine)
      Setter accessor for attribute 'templateEngine'.
      Parameters:
      templateEngine - new value for 'templateEngine '
    • getSuccessView

      public String getSuccessView()
      Getter accessor for attribute 'successView'.
      Returns:
      current value of 'successView'
    • setSuccessView

      public void setSuccessView(String successView)
      Setter accessor for attribute 'successView'.
      Parameters:
      successView - new value for 'successView '