Class FavoritesListHandler
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:
- HTTP method must be
GET. user.favoritefeature flag must be enabled.- The caller must have a non-blank
userCode(a session-bound identifier produced byUserInfoHelper). query_idparameter 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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidhandle(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res) Processes oneGET /api/v2/favoritesrequest.
-
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 oneGET /api/v2/favoritesrequest.- Parameters:
req- the incoming HTTP requestres- the HTTP response to write to- Throws:
IOException- if writing the envelope fails
-