Class FavoritesListHandler

java.lang.Object
org.codelibs.fess.api.v2.handlers.FavoritesListHandler

public class FavoritesListHandler extends Object
Handles GET /api/v2/favorites.

Returns the document IDs in a previously-issued search result set that the calling user has favorited. Mirrors the v1 SearchApiManager#processFavoritesRequest contract but emits the v2 envelope and uses snake_case keys throughout.

The query_id query parameter is required and must correspond to a search executed in the current session (the same opaque id echoed by /api/v2/search). The handler resolves the result document ids via UserInfoHelper.getResultDocIds(String), looks up the bound URLs, then filters them against the user's favorite log to produce the intersection.

The response payload is:


 { "record_count": <int>, "data": [{ "doc_id": "<id>" }, ...] }
 

Order of checks:

  1. HTTP method must be GET.
  2. user.favorite feature flag must be enabled.
  3. The caller must have a non-blank userCode (a session-bound identifier produced by UserInfoHelper).
  4. query_id parameter must be non-blank.

MJ-30 i18n contract: error.message values are developer-facing English strings. Clients MUST use error.code for user-facing i18n.

  • Constructor Details

    • FavoritesListHandler

      public FavoritesListHandler()
      Default constructor. The handler is stateless and intended to be instantiated once by the API manager and shared across concurrent requests.
  • Method Details

    • handle

      public void handle(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res) throws IOException
      Processes one GET /api/v2/favorites request.
      Parameters:
      req - the incoming HTTP request
      res - the HTTP response to write to
      Throws:
      IOException - if writing the envelope fails