Class RelatedContentHandler
java.lang.Object
org.codelibs.fess.api.v2.handlers.RelatedContentHandler
Handles
GET /api/v2/related-content.
Returns related HTML content for the given q parameter by delegating to
RelatedContentHelper.getRelatedContents(String). When multiple content items
are returned they are joined with a newline separator. When q is blank or
absent the response contains an empty content string. The response shape
is always a success envelope with status:0:
{ "status": 0, "content": "<html>...</html>", "content_type": "html" }
This handler is GET-only; other methods are rejected with
V2ErrorCode.METHOD_NOT_ALLOWED.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidhandle(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res) Processes oneGET /api/v2/related-contentrequest.
-
Constructor Details
-
RelatedContentHandler
public RelatedContentHandler()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/related-contentrequest.Reads the
qquery parameter, delegates toRelatedContentHelper.getRelatedContents(String), and writes the result as a success envelope. Multiple content items are joined with a newline. An empty or absentqyields an emptycontentstring rather than an error.- Parameters:
req- the incoming HTTP requestres- the HTTP response to write to- Throws:
IOException- if writing the envelope fails
-