Class DocIdValidator

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

public class DocIdValidator extends Object
Shared validation for the doc_id parameter used by the document-keyed v2 handlers (CacheHandler, ClickHandler, FavoriteGetHandler, FavoritePostHandler).

Conservative allowlist — the search backend accepts more, but v2 surfaces doc_id via the URL path / request body, so it is locked down to reject odd input at the edge rather than let it reach OpenSearch as a term query (or enable path-traversal-style abuse). Centralised here so the handlers share a single compiled pattern instead of each declaring its own copy.

  • Constructor Details

    • DocIdValidator

      public DocIdValidator()
      Creates a document-id validator. Registered as the DI component v2DocIdValidator and obtained via ComponentUtil.getV2DocIdValidator().
  • Method Details

    • isValid

      public boolean isValid(String docId)
      Checks whether a document id is acceptable for the v2 surface.
      Parameters:
      docId - the candidate document id
      Returns:
      true if non-blank and composed only of allowed characters