Class DocsRedirectFilter

java.lang.Object
org.gcube.informationsystem.resourceregistry.rest.docs.DocsRedirectFilter
All Implemented Interfaces:
jakarta.servlet.Filter

public class DocsRedirectFilter extends Object implements 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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    No cleanup is required by this filter.
    void
    doFilter(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 corresponding index.html; delegates every other request to the rest of the filter chain unchanged.
    void
    init(jakarta.servlet.FilterConfig filterConfig)
    No initialization is required by this filter.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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:
      init in interface jakarta.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 corresponding index.html; delegates every other request to the rest of the filter chain unchanged.
      Specified by:
      doFilter in interface jakarta.servlet.Filter
      Parameters:
      request - the incoming servlet request
      response - the servlet response
      chain - the remaining filter chain
      Throws:
      IOException - if an I/O error occurs while sending the redirect or invoking the chain
      jakarta.servlet.ServletException - if an error occurs while invoking the chain
    • destroy

      public void destroy()
      No cleanup is required by this filter.
      Specified by:
      destroy in interface jakarta.servlet.Filter