Package org.codelibs.fess.api.engine
Class SearchEngineApiManager
java.lang.Object
org.codelibs.fess.api.BaseApiManager
org.codelibs.fess.api.engine.SearchEngineApiManager
- All Implemented Interfaces:
WebApiManager
API manager for search engine administrative operations.
Provides secure access to search engine APIs through authentication and token-based authorization.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.codelibs.fess.api.BaseApiManager
BaseApiManager.FormatType -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String[]Roles that are allowed to access the search engine APIFields inherited from class org.codelibs.fess.api.BaseApiManager
pathPrefix -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the server path with access token for API requests.booleanmatches(jakarta.servlet.http.HttpServletRequest request) Checks if the request matches this API manager.voidprocess(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain) Processes the request through this API manager.protected voidprocessPluginRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String path) Processes requests for plugin resources (static files).protected voidprocessRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String path) Processes API requests to the search engine.voidregister()Registers this API manager with the web API manager factory.voidGenerates and saves a new access token for the current session.voidsetAcceptedRoles(String[] acceptedRoles) Sets the roles that are allowed to access the search engine API.protected voidwriteHeaders(jakarta.servlet.http.HttpServletResponse response) Writes custom headers to the HTTP response.Methods inherited from class org.codelibs.fess.api.BaseApiManager
detectFormatType, getFormatType, getPathPrefix, setPathPrefix, write
-
Field Details
-
acceptedRoles
Roles that are allowed to access the search engine API
-
-
Constructor Details
-
SearchEngineApiManager
public SearchEngineApiManager()Default constructor. Initializes the API manager with the admin server path prefix.
-
-
Method Details
-
register
@PostConstruct public void register()Registers this API manager with the web API manager factory. Called automatically after construction via @PostConstruct. -
matches
public boolean matches(jakarta.servlet.http.HttpServletRequest request) Description copied from interface:WebApiManagerChecks if the request matches this API manager.- Parameters:
request- The HTTP servlet request.- Returns:
- True if the request matches, false otherwise.
-
process
public void process(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain) throws IOException, jakarta.servlet.ServletException Description copied from interface:WebApiManagerProcesses the request through this API manager.- Parameters:
request- The HTTP servlet request.response- The HTTP servlet response.chain- The filter chain.- Throws:
IOException- If an input/output error occurs.jakarta.servlet.ServletException- If a servlet error occurs.
-
processRequest
protected void processRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String path) Processes API requests to the search engine. Handles both regular API calls and plugin requests.- Parameters:
request- the HTTP servlet requestresponse- the HTTP servlet responsepath- the request path after removing the prefix
-
processPluginRequest
protected void processPluginRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String path) Processes requests for plugin resources (static files). Sets appropriate content types and serves files from the resource path.- Parameters:
request- the HTTP servlet requestresponse- the HTTP servlet responsepath- the plugin resource path
-
setAcceptedRoles
Sets the roles that are allowed to access the search engine API.- Parameters:
acceptedRoles- array of role names that can access the API
-
getServerPath
Gets the server path with access token for API requests.- Returns:
- the complete server path including the access token
- Throws:
FessSystemException- if no access token is available
-
saveToken
public void saveToken()Generates and saves a new access token for the current session. The token is used to authenticate API requests. -
writeHeaders
protected void writeHeaders(jakarta.servlet.http.HttpServletResponse response) Description copied from class:BaseApiManagerWrites custom headers to the HTTP response.- Specified by:
writeHeadersin classBaseApiManager- Parameters:
response- The HTTP servlet response.
-