org.springframework.boot.test

Class SpringBootMockServletContext

  • java.lang.Object
    • org.springframework.mock.web.MockServletContext
      • org.springframework.boot.test.SpringBootMockServletContext
  • All Implemented Interfaces:
    javax.servlet.ServletContext


    public class SpringBootMockServletContext
    extends org.springframework.mock.web.MockServletContext
    MockServletContext implementation for Spring Boot. Respects well know Spring Boot resource locations and uses an empty directory for "/" if no locations can be found.
    Author:
    Phillip Webb
    • Field Summary

      • Fields inherited from interface javax.servlet.ServletContext

        ORDERED_LIBS, TEMPDIR
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      URL getResource(String path) 
      protected String getResourceBasePathLocation(String path) 
      protected String getResourceLocation(String path) 
      • Methods inherited from class org.springframework.mock.web.MockServletContext

        addFilter, addFilter, addFilter, addInitParameter, addListener, addListener, addListener, addServlet, addServlet, addServlet, createFilter, createListener, createServlet, declareRoles, getAttribute, getAttributeNames, getClassLoader, getContext, getContextPath, getDeclaredRoles, getDefaultServletName, getDefaultSessionTrackingModes, getEffectiveMajorVersion, getEffectiveMinorVersion, getEffectiveSessionTrackingModes, getFilterRegistration, getFilterRegistrations, getInitParameter, getInitParameterNames, getJspConfigDescriptor, getMajorVersion, getMimeType, getMinorVersion, getNamedDispatcher, getRealPath, getRequestDispatcher, getResourceAsStream, getResourcePaths, getServerInfo, getServlet, getServletContextName, getServletNames, getServletRegistration, getServletRegistrations, getServlets, getSessionCookieConfig, log, log, log, registerContext, registerNamedDispatcher, removeAttribute, setAttribute, setContextPath, setDefaultServletName, setEffectiveMajorVersion, setEffectiveMinorVersion, setInitParameter, setMajorVersion, setMinorVersion, setServletContextName, setSessionTrackingModes, unregisterNamedDispatcher
      • Methods inherited from interface javax.servlet.ServletContext

        getVirtualServerName
    • Constructor Detail

      • SpringBootMockServletContext

        public SpringBootMockServletContext(String resourceBasePath)
      • SpringBootMockServletContext

        public SpringBootMockServletContext(String resourceBasePath,
                                            org.springframework.core.io.ResourceLoader resourceLoader)
    • Method Detail

      • getResourceLocation

        protected String getResourceLocation(String path)
        Overrides:
        getResourceLocation in class org.springframework.mock.web.MockServletContext
      • getResourceBasePathLocation

        protected final String getResourceBasePathLocation(String path)
      • getResource

        public URL getResource(String path)
                        throws MalformedURLException
        Specified by:
        getResource in interface javax.servlet.ServletContext
        Overrides:
        getResource in class org.springframework.mock.web.MockServletContext
        Throws:
        MalformedURLException

Copyright © 2016 Pivotal Software, Inc.. All rights reserved.