Package org.codelibs.fess.api.json
Class SearchApiManager
java.lang.Object
org.codelibs.fess.api.BaseApiManager
org.codelibs.fess.api.json.SearchApiManager
- All Implemented Interfaces:
WebApiManager
The API manager for search operations.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classThe request parameters for JSON API.protected static classThe request parameters for suggest API.Nested classes/interfaces inherited from class org.codelibs.fess.api.BaseApiManager
BaseApiManager.FormatType -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final StringThe GET method.protected static final StringThe message field.protected StringThe MIME type.protected static final StringThe POST method.protected static final StringThe result field.Fields inherited from class org.codelibs.fess.api.BaseApiManager
pathPrefix -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanacceptHttpMethod(jakarta.servlet.http.HttpServletRequest request, String... methods) Accepts the HTTP method.protected StringGets a detailed message of the throwable.protected BaseApiManager.FormatTypedetectFormatType(jakarta.servlet.http.HttpServletRequest request) Detects the format type from the request parameters.protected StringescapeCallbackName(String callbackName) Escapes a callback name.protected StringescapeJson(Object obj) Escapes a JSON object.protected StringescapeJsonKeyValue(String key, String value) Escapes a JSON key-value pair.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 voidprocessFavoriteRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain) Processes a favorite request.protected voidprocessFavoritesRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain) Processes a favorites request.protected voidprocessLabelRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain) Processes a label request.protected voidprocessPingRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain) Processes a ping request.protected voidprocessPopularWordRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain) Processes a popular word request.protected voidprocessScrollSearchRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain) Processes a scroll search request.protected voidprocessSearchRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain) Processes a search request.protected voidprocessSuggestRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain) Processes a suggest request.voidregister()Registers this API manager.voidsetMimeType(String mimeType) Sets the MIME type.protected voidwriteHeaders(jakarta.servlet.http.HttpServletResponse response) Writes custom headers to the HTTP response.protected voidwriteJsonResponse(int status, String body) Writes a JSON response.protected voidwriteJsonResponse(int status, Throwable t) Writes a JSON response.Methods inherited from class org.codelibs.fess.api.BaseApiManager
getFormatType, getPathPrefix, setPathPrefix, write
-
Field Details
-
MESSAGE_FIELD
The message field.- See Also:
-
RESULT_FIELD
The result field.- See Also:
-
GET
The GET method.- See Also:
-
POST
The POST method.- See Also:
-
mimeType
The MIME type.
-
-
Constructor Details
-
SearchApiManager
public SearchApiManager()Constructor.
-
-
Method Details
-
register
@PostConstruct public void register()Registers this API manager. -
detectFormatType
protected BaseApiManager.FormatType detectFormatType(jakarta.servlet.http.HttpServletRequest request) Description copied from class:BaseApiManagerDetects the format type from the request parameters.- Overrides:
detectFormatTypein classBaseApiManager- Parameters:
request- The HTTP servlet request.- Returns:
- The detected format type.
-
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.
-
acceptHttpMethod
protected boolean acceptHttpMethod(jakarta.servlet.http.HttpServletRequest request, String... methods) Accepts the HTTP method.- Parameters:
request- The HTTP request.methods- The accepted methods.- Returns:
- true if the method is accepted, false otherwise.
-
processScrollSearchRequest
protected void processScrollSearchRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain) Processes a scroll search request.- Parameters:
request- The HTTP request.response- The HTTP response.chain- The filter chain.
-
processPingRequest
protected void processPingRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain) Processes a ping request.- Parameters:
request- The HTTP request.response- The HTTP response.chain- The filter chain.
-
processSearchRequest
protected void processSearchRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain) Processes a search request.- Parameters:
request- The HTTP request.response- The HTTP response.chain- The filter chain.
-
detailedMessage
Gets a detailed message of the throwable.- Parameters:
t- The throwable.- Returns:
- The detailed message.
-
processLabelRequest
protected void processLabelRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain) Processes a label request.- Parameters:
request- The HTTP request.response- The HTTP response.chain- The filter chain.
-
processPopularWordRequest
protected void processPopularWordRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain) Processes a popular word request.- Parameters:
request- The HTTP request.response- The HTTP response.chain- The filter chain.
-
processFavoriteRequest
protected void processFavoriteRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain) Processes a favorite request.- Parameters:
request- The HTTP request.response- The HTTP response.chain- The filter chain.
-
processFavoritesRequest
protected void processFavoritesRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain) Processes a favorites request.- Parameters:
request- The HTTP request.response- The HTTP response.chain- The filter chain.
-
processSuggestRequest
protected void processSuggestRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain) throws IOException, jakarta.servlet.ServletException Processes a suggest request.- Parameters:
request- The HTTP request.response- The HTTP response.chain- The filter chain.- Throws:
IOException- If an I/O error occurs.jakarta.servlet.ServletException- If a servlet error occurs.
-
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.
-
writeJsonResponse
Writes a JSON response.- Parameters:
status- The status code.t- The throwable.
-
escapeJsonKeyValue
Escapes a JSON key-value pair.- Parameters:
key- The key.value- The value.- Returns:
- The escaped key-value pair.
-
writeJsonResponse
Writes a JSON response.- Parameters:
status- The status code.body- The body.
-
escapeCallbackName
Escapes a callback name.- Parameters:
callbackName- The callback name.- Returns:
- The escaped callback name.
-
escapeJson
Escapes a JSON object.- Parameters:
obj- The object to escape.- Returns:
- The escaped object.
-
setMimeType
Sets the MIME type.- Parameters:
mimeType- The MIME type.
-