Class SearchApiManager

java.lang.Object
org.codelibs.fess.api.BaseApiManager
org.codelibs.fess.api.json.SearchApiManager
All Implemented Interfaces:
WebApiManager

public class SearchApiManager extends BaseApiManager
The API manager for search operations.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    protected static class 
    The request parameters for JSON API.
    protected static class 
    The request parameters for suggest API.

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

    BaseApiManager.FormatType
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final String
    The GET method.
    protected static final String
    The message field.
    protected String
    The MIME type.
    protected static final String
    The POST method.
    protected static final String
    The result field.

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

    pathPrefix
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected boolean
    acceptHttpMethod(jakarta.servlet.http.HttpServletRequest request, String... methods)
    Accepts the HTTP method.
    protected String
    Gets a detailed message of the throwable.
    detectFormatType(jakarta.servlet.http.HttpServletRequest request)
    Detects the format type from the request parameters.
    protected String
    escapeCallbackName(String callbackName)
    Escapes a callback name.
    protected String
    Escapes a JSON object.
    protected String
    Escapes a JSON key-value pair.
    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
    processFavoriteRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain)
    Processes a favorite request.
    protected void
    processFavoritesRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain)
    Processes a favorites request.
    protected void
    processLabelRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain)
    Processes a label request.
    protected void
    processPingRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain)
    Processes a ping request.
    protected void
    processPopularWordRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain)
    Processes a popular word request.
    protected void
    processScrollSearchRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain)
    Processes a scroll search request.
    protected void
    processSearchRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain)
    Processes a search request.
    protected void
    processSuggestRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain)
    Processes a suggest request.
    void
    Registers this API manager.
    void
    setMimeType(String mimeType)
    Sets the MIME type.
    protected void
    writeHeaders(jakarta.servlet.http.HttpServletResponse response)
    Writes custom headers to the HTTP response.
    protected void
    writeJsonResponse(int status, String body)
    Writes a JSON response.
    protected void
    writeJsonResponse(int status, Throwable t)
    Writes a JSON response.

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

    getFormatType, getPathPrefix, setPathPrefix, write

    Methods inherited from class java.lang.Object

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

  • Constructor Details

    • SearchApiManager

      public SearchApiManager()
      Constructor.
  • Method Details

    • register

      @PostConstruct public void register()
      Registers this API manager.
    • detectFormatType

      protected BaseApiManager.FormatType detectFormatType(jakarta.servlet.http.HttpServletRequest request)
      Description copied from class: BaseApiManager
      Detects the format type from the request parameters.
      Overrides:
      detectFormatType in class BaseApiManager
      Parameters:
      request - The HTTP servlet request.
      Returns:
      The detected format type.
    • 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.
    • acceptHttpMethod

      protected boolean acceptHttpMethod(jakarta.servlet.http.HttpServletRequest request, String... methods)
      Accepts the HTTP method.
      Parameters:
      request - The HTTP request.
      methods - The accepted methods.
      Returns:
      true if the method is accepted, false otherwise.
    • processScrollSearchRequest

      protected void processScrollSearchRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain)
      Processes a scroll search request.
      Parameters:
      request - The HTTP request.
      response - The HTTP response.
      chain - The filter chain.
    • processPingRequest

      protected void processPingRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain)
      Processes a ping request.
      Parameters:
      request - The HTTP request.
      response - The HTTP response.
      chain - The filter chain.
    • processSearchRequest

      protected void processSearchRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain)
      Processes a search request.
      Parameters:
      request - The HTTP request.
      response - The HTTP response.
      chain - The filter chain.
    • detailedMessage

      protected String detailedMessage(Throwable t)
      Gets a detailed message of the throwable.
      Parameters:
      t - The throwable.
      Returns:
      The detailed message.
    • processLabelRequest

      protected void processLabelRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain)
      Processes a label request.
      Parameters:
      request - The HTTP request.
      response - The HTTP response.
      chain - The filter chain.
    • processPopularWordRequest

      protected void processPopularWordRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain)
      Processes a popular word request.
      Parameters:
      request - The HTTP request.
      response - The HTTP response.
      chain - The filter chain.
    • processFavoriteRequest

      protected void processFavoriteRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain)
      Processes a favorite request.
      Parameters:
      request - The HTTP request.
      response - The HTTP response.
      chain - The filter chain.
    • processFavoritesRequest

      protected void processFavoritesRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain)
      Processes a favorites request.
      Parameters:
      request - The HTTP request.
      response - The HTTP response.
      chain - The filter chain.
    • processSuggestRequest

      protected void processSuggestRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain) throws IOException, jakarta.servlet.ServletException
      Processes a suggest request.
      Parameters:
      request - The HTTP request.
      response - The HTTP response.
      chain - The filter chain.
      Throws:
      IOException - If an I/O error occurs.
      jakarta.servlet.ServletException - If a servlet error occurs.
    • 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.
    • writeJsonResponse

      protected void writeJsonResponse(int status, Throwable t)
      Writes a JSON response.
      Parameters:
      status - The status code.
      t - The throwable.
    • escapeJsonKeyValue

      protected String escapeJsonKeyValue(String key, String value)
      Escapes a JSON key-value pair.
      Parameters:
      key - The key.
      value - The value.
      Returns:
      The escaped key-value pair.
    • writeJsonResponse

      protected void writeJsonResponse(int status, String body)
      Writes a JSON response.
      Parameters:
      status - The status code.
      body - The body.
    • escapeCallbackName

      protected String escapeCallbackName(String callbackName)
      Escapes a callback name.
      Parameters:
      callbackName - The callback name.
      Returns:
      The escaped callback name.
    • escapeJson

      protected String escapeJson(Object obj)
      Escapes a JSON object.
      Parameters:
      obj - The object to escape.
      Returns:
      The escaped object.
    • setMimeType

      public void setMimeType(String mimeType)
      Sets the MIME type.
      Parameters:
      mimeType - The MIME type.