Class SearchEngineApiManager

java.lang.Object
org.codelibs.fess.api.BaseApiManager
org.codelibs.fess.api.engine.SearchEngineApiManager
All Implemented Interfaces:
WebApiManager

public class SearchEngineApiManager extends BaseApiManager
API manager for search engine administrative operations. Provides secure access to search engine APIs through authentication and token-based authorization.
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.codelibs.fess.api.BaseApiManager

    BaseApiManager.FormatType
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected String[]
    Roles that are allowed to access the search engine API

    Fields inherited from class org.codelibs.fess.api.BaseApiManager

    pathPrefix
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the server path with access token for API requests.
    boolean
    matches(jakarta.servlet.http.HttpServletRequest request)
    Checks if the request matches this API manager.
    void
    process(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain)
    Processes the request through this API manager.
    protected void
    processPluginRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String path)
    Processes requests for plugin resources (static files).
    protected void
    processRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String path)
    Processes API requests to the search engine.
    void
    Registers this API manager with the web API manager factory.
    void
    Generates and saves a new access token for the current session.
    void
    setAcceptedRoles(String[] acceptedRoles)
    Sets the roles that are allowed to access the search engine API.
    protected void
    writeHeaders(jakarta.servlet.http.HttpServletResponse response)
    Writes custom headers to the HTTP response.

    Methods inherited from class org.codelibs.fess.api.BaseApiManager

    detectFormatType, getFormatType, getPathPrefix, setPathPrefix, write

    Methods inherited from class java.lang.Object

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

    • acceptedRoles

      protected String[] acceptedRoles
      Roles that are allowed to access the search engine API
  • Constructor Details

    • SearchEngineApiManager

      public SearchEngineApiManager()
      Default constructor. Initializes the API manager with the admin server path prefix.
  • Method Details

    • register

      @PostConstruct public void register()
      Registers this API manager with the web API manager factory. Called automatically after construction via @PostConstruct.
    • matches

      public boolean matches(jakarta.servlet.http.HttpServletRequest request)
      Description copied from interface: WebApiManager
      Checks if the request matches this API manager.
      Parameters:
      request - The HTTP servlet request.
      Returns:
      True if the request matches, false otherwise.
    • process

      public void process(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain) throws IOException, jakarta.servlet.ServletException
      Description copied from interface: WebApiManager
      Processes the request through this API manager.
      Parameters:
      request - The HTTP servlet request.
      response - The HTTP servlet response.
      chain - The filter chain.
      Throws:
      IOException - If an input/output error occurs.
      jakarta.servlet.ServletException - If a servlet error occurs.
    • processRequest

      protected void processRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String path)
      Processes API requests to the search engine. Handles both regular API calls and plugin requests.
      Parameters:
      request - the HTTP servlet request
      response - the HTTP servlet response
      path - the request path after removing the prefix
    • processPluginRequest

      protected void processPluginRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String path)
      Processes requests for plugin resources (static files). Sets appropriate content types and serves files from the resource path.
      Parameters:
      request - the HTTP servlet request
      response - the HTTP servlet response
      path - the plugin resource path
    • setAcceptedRoles

      public void setAcceptedRoles(String[] acceptedRoles)
      Sets the roles that are allowed to access the search engine API.
      Parameters:
      acceptedRoles - array of role names that can access the API
    • getServerPath

      public String getServerPath()
      Gets the server path with access token for API requests.
      Returns:
      the complete server path including the access token
      Throws:
      FessSystemException - if no access token is available
    • saveToken

      public void saveToken()
      Generates and saves a new access token for the current session. The token is used to authenticate API requests.
    • writeHeaders

      protected void writeHeaders(jakarta.servlet.http.HttpServletResponse response)
      Description copied from class: BaseApiManager
      Writes custom headers to the HTTP response.
      Specified by:
      writeHeaders in class BaseApiManager
      Parameters:
      response - The HTTP servlet response.