Class DocsRedirectFilter
java.lang.Object
org.gcube.informationsystem.resourceregistry.rest.docs.DocsRedirectFilter
- All Implemented Interfaces:
jakarta.servlet.Filter
Servlet filter that redirects a bare
.../model-docs request path (with or without a
trailing slash) to its index.html, so the live-registry type documentation is reachable
without requiring the client to know the exact static entry-point file name. Any other request
path is passed through unchanged. SmartGears serves and redirects /docs and
/api-docs for every service.- 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.../model-docs(and its trailing-slash variant) to itsindex.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.../model-docs(and its trailing-slash variant) to itsindex.html; delegates every other request to the rest of the filter chain unchanged. SmartGears does the same for/docsand/api-docs.- 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
-