Class StaticThemeFilter
- All Implemented Interfaces:
jakarta.servlet.Filter
The filter writes the response in place via StaticThemeResponder (no
RequestDispatcher forward), so the browser address bar keeps the original
request URI.
Matching is an allowlist: a request is handled by the theme only when it
targets a theme asset or one of the SPA-owned UI paths (see THEME_UI_PREFIXES).
Every other request passes through to the standard Fess routes. This is the inverse of a
denylist of infrastructure prefixes: it keeps Fess's own endpoints (admin, API, login,
crawler/system endpoints, etc.) working by default, and a newly-added Fess route is never
accidentally swallowed by the SPA. The trade-off is that a UI route the SPA expects to
own must be added to THEME_UI_PREFIXES; an unlisted path is not served as the
SPA entry.
Behavior summary:
- Non-GET requests pass through unchanged.
- Requests that are neither a
/themes/...asset nor an allowlisted UI path pass through unchanged (without even resolving the active theme). - If no active static theme is resolved, pass through.
- For
/themes/{name}/...that matches the active static theme's name, the filter callsStaticThemeResponder.serveAsset(jakarta.servlet.http.HttpServletRequest, jakarta.servlet.http.HttpServletResponse, org.codelibs.fess.theme.Theme, java.lang.String)with the path after{name}/. - For an allowlisted UI path (when
spaFallbackis enabled), the filter callsStaticThemeResponder.serveIndex(jakarta.servlet.http.HttpServletRequest, jakarta.servlet.http.HttpServletResponse, org.codelibs.fess.theme.Theme, java.lang.String)to serve the SPA entry HTML in place.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
StaticThemeFilter
public StaticThemeFilter()Default constructor.
-
-
Method Details
-
init
public void init(jakarta.servlet.FilterConfig filterConfig) throws jakarta.servlet.ServletException - Specified by:
initin interfacejakarta.servlet.Filter- Throws:
jakarta.servlet.ServletException
-
destroy
public void destroy()- Specified by:
destroyin interfacejakarta.servlet.Filter
-
doFilter
public void doFilter(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, jakarta.servlet.FilterChain chain) throws IOException, jakarta.servlet.ServletException - Specified by:
doFilterin interfacejakarta.servlet.Filter- Throws:
IOExceptionjakarta.servlet.ServletException
-