Class SpaResourceResolver

java.lang.Object
org.springframework.web.servlet.resource.AbstractResourceResolver
org.springframework.web.servlet.resource.PathResourceResolver
org.operaton.bpm.spring.boot.starter.webapp.neo.SpaResourceResolver
All Implemented Interfaces:
org.springframework.web.servlet.resource.ResourceResolver

public class SpaResourceResolver extends org.springframework.web.servlet.resource.PathResourceResolver
Resolves static resources for the webapps-neo SPA and falls back to index.html for client-side routes (deep links) so the single-page application can take over routing.

The fallback only applies to paths that look like application routes: paths that resolve to an actual file are served directly, requests for the API namespaces are left to 404, and requests that carry a file extension (i.e. a missing static asset) are not masked by the HTML shell.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final String
     
    protected static final List<String>
    Request prefixes that must never be answered with the SPA shell.

    Fields inherited from class org.springframework.web.servlet.resource.AbstractResourceResolver

    logger
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected org.springframework.core.io.Resource
    getResource(String resourcePath, org.springframework.core.io.Resource location)
     
    protected boolean
    isClientRoute(String resourcePath)
     

    Methods inherited from class org.springframework.web.servlet.resource.PathResourceResolver

    checkResource, getAllowedLocations, getLocationCharsets, getUrlPathHelper, resolveResourceInternal, resolveUrlPathInternal, setAllowedLocations, setLocationCharsets, setUrlPathHelper

    Methods inherited from class org.springframework.web.servlet.resource.AbstractResourceResolver

    resolveResource, resolveUrlPath

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • INDEX_HTML

      protected static final String INDEX_HTML
      See Also:
    • RESERVED_PREFIXES

      protected static final List<String> RESERVED_PREFIXES
      Request prefixes that must never be answered with the SPA shell.
  • Constructor Details

    • SpaResourceResolver

      public SpaResourceResolver()
  • Method Details

    • getResource

      protected org.springframework.core.io.Resource getResource(String resourcePath, org.springframework.core.io.Resource location) throws IOException
      Overrides:
      getResource in class org.springframework.web.servlet.resource.PathResourceResolver
      Throws:
      IOException
    • isClientRoute

      protected boolean isClientRoute(String resourcePath)