Class CacheHandler
java.lang.Object
org.codelibs.fess.api.v2.handlers.CacheHandler
Handles
GET /api/v2/cache/{docId}.
Returns the cached HTML rendering of an indexed document, mirroring the
v1 CacheAction#index behavior but emitting a v2 envelope instead of
a StreamResponse. The cached content is embedded in the success
payload alongside doc_id and mimetype so JS clients can
render it inline without a second round-trip.
Order of checks:
- HTTP method must be
GET. Other methods produce405 method_not_allowedwith anAllow: GETheader. - When
app.login.required=trueand no authenticated user is present, returns401 auth_required— parity with v1CacheAction:68-70. docIdmust be non-blank and match[A-Za-z0-9_-]+.- The document must exist in the index (otherwise
404 not_found). ViewHelper.createCacheContent(java.util.Map<java.lang.String, java.lang.Object>, java.lang.String[])must return a non-null body (otherwise404 not_foundwith a "no cache for" message — same semantics as v1'saddErrorsDocidNotFound).
The hq query parameter is multi-valued and passed straight through
to ViewHelper.createCacheContent(Map, String[]). Null is acceptable.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
CacheHandler
public CacheHandler()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, String docId) throws IOException Processes one/api/v2/cache/{docId}GET request.- Parameters:
req- the incoming HTTP requestres- the HTTP response to write todocId- the document id extracted from the URL path- Throws:
IOException- if writing the envelope fails
-