Class DocsRedirectFilter
java.lang.Object
org.gcube.informationsystem.resourceregistry.rest.docs.DocsRedirectFilter
- All Implemented Interfaces:
jakarta.servlet.Filter
Servlet filter that redirects a bare
.../docs, .../api-docs, or
.../model-docs request path (with or without a trailing slash) to its
index.html, so the Sphinx reference documentation, the OpenAPI/Swagger UI, and the
live-registry type documentation are reachable without requiring the client to know the exact
static entry-point file name. Any other request path is passed through unchanged.- Author:
- Biagio Peccerillo (ISTI - CNR), Luca Frosini (ISTI - CNR)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()No cleanup is required by this filter.voiddoFilter(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, jakarta.servlet.FilterChain chain) Redirects.../docs/.../api-docs/.../model-docs(and their trailing-slash variants) to the correspondingindex.html; delegates every other request to the rest of the filter chain unchanged.voidinit(jakarta.servlet.FilterConfig filterConfig) No initialization is required by this filter.
-
Constructor Details
-
DocsRedirectFilter
public DocsRedirectFilter()
-
-
Method Details
-
init
public void init(jakarta.servlet.FilterConfig filterConfig) throws jakarta.servlet.ServletException No initialization is required by this filter.- Specified by:
initin interfacejakarta.servlet.Filter- Parameters:
filterConfig- the servlet filter configuration- Throws:
jakarta.servlet.ServletException- never thrown by this implementation
-
doFilter
public void doFilter(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, jakarta.servlet.FilterChain chain) throws IOException, jakarta.servlet.ServletException Redirects.../docs/.../api-docs/.../model-docs(and their trailing-slash variants) to the correspondingindex.html; delegates every other request to the rest of the filter chain unchanged.- Specified by:
doFilterin interfacejakarta.servlet.Filter- Parameters:
request- the incoming servlet requestresponse- the servlet responsechain- the remaining filter chain- Throws:
IOException- if an I/O error occurs while sending the redirect or invoking the chainjakarta.servlet.ServletException- if an error occurs while invoking the chain
-
destroy
public void destroy()No cleanup is required by this filter.- Specified by:
destroyin interfacejakarta.servlet.Filter
-