Class ServletContextResourceAccessor

  • All Implemented Interfaces:
    ResourceAccessor, org.springframework.beans.factory.Aware, org.springframework.web.context.ServletContextAware

    public class ServletContextResourceAccessor
    extends Object
    implements org.springframework.web.context.ServletContextAware, ResourceAccessor
    An implementation of ResourceAccessor that gets resources via the servlet context.
    • Constructor Detail

      • ServletContextResourceAccessor

        public ServletContextResourceAccessor()
    • Method Detail

      • getResource

        public InputStream getResource​(String resourcePath)
        Description copied from interface: ResourceAccessor
        Returns an InputStream for reading a resource. A new input stream is returned for each call to this method.
        Specified by:
        getResource in interface ResourceAccessor
        Parameters:
        resourcePath - the relative URL path of the resource. For example: /images/foo.png
        Returns:
        an InputStream for reading the resource
      • setServletContext

        public void setServletContext​(javax.servlet.ServletContext servletContext)
        Specified by:
        setServletContext in interface org.springframework.web.context.ServletContextAware