Class SpringBootMockServletContext
java.lang.Object
org.springframework.mock.web.MockServletContext
org.springframework.boot.test.mock.web.SpringBootMockServletContext
- All Implemented Interfaces:
ServletContext
MockServletContext implementation for Spring Boot. Respects well-known Spring
Boot resource locations and uses an empty directory for "/" if no locations can be
found.- Since:
- 1.4.0
- Author:
- Phillip Webb
-
Field Summary
Fields inherited from interface ServletContext
ORDERED_LIBS, TEMPDIR -
Constructor Summary
ConstructorsConstructorDescriptionSpringBootMockServletContext(String resourceBasePath) SpringBootMockServletContext(String resourceBasePath, ResourceLoader resourceLoader) -
Method Summary
Modifier and TypeMethodDescription@Nullable URLgetResource(String path) protected final Stringprotected StringgetResourceLocation(String path) Methods inherited from class MockServletContext
addFilter, addFilter, addFilter, addFilterRegistration, addInitParameter, addJspFile, addListener, addListener, addListener, addMimeType, 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, getRequestCharacterEncoding, getRequestDispatcher, getResourceAsStream, getResourcePaths, getResponseCharacterEncoding, getServerInfo, getServletContextName, getServletRegistration, getServletRegistrations, getSessionCookieConfig, getSessionTimeout, getVirtualServerName, log, log, registerContext, registerNamedDispatcher, removeAttribute, setAttribute, setContextPath, setDefaultServletName, setEffectiveMajorVersion, setEffectiveMinorVersion, setInitParameter, setMajorVersion, setMinorVersion, setRequestCharacterEncoding, setResponseCharacterEncoding, setServletContextName, setSessionTimeout, setSessionTrackingModes, unregisterNamedDispatcherMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ServletContext
setRequestCharacterEncoding, setResponseCharacterEncoding
-
Constructor Details
-
SpringBootMockServletContext
-
SpringBootMockServletContext
-
-
Method Details
-
getResourceLocation
- Overrides:
getResourceLocationin classMockServletContext
-
getResourceBasePathLocation
-
getResource
- Specified by:
getResourcein interfaceServletContext- Overrides:
getResourcein classMockServletContext- Throws:
MalformedURLException
-