Generated by
JDiff

org.springframework.mock.web Documentation Differences

This file contains all the changes in documentation in the package org.springframework.mock.web as colored differences. Deletions are shown like this, and additions are shown like this.
If no deletions or additions are shown in an entry, the HTML tags will be what has changed. The new HTML tags are shown in the differences. If no documentation existed, and then some was added in a later version, this change is noted in the appropriate class pages of differences, but the change is not shown on this page. Only changes in existing text are shown here. Similarly, documentation which was inherited from another class or interface is not shown here.
Note that an HTML error in the new documentation may cause the display of other documentation changes to be presented incorrectly. For instance, failure to close a <code> tag will cause all subsequent paragraphs to be displayed differently.

Class MockFilterChain

Mock implementation of the javax.servlet.FilterConfigFilterChain interface. UsedUsed for testing the web framework; also useful for testing customtesting custom javax.servlet.Filter implementations.

A MockFilterChain can be configured with one or more filters and a Servlet to invoke. The first time the chain is called, it invokes all filters and the Servlet, and saves the request and response. Subsequent invocations raise an IllegalStateException unless .reset() is called. @author Juergen Hoeller @author Rob Winch @author Rossen Stoyanchev @since 2.0.3 @see MockFilterConfig @see PassThroughFilterChain

Class MockFilterChain, void doFilter(ServletRequest, ServletResponse)

Records theInvoke registered Filters and/or Servlet also saving the request and response.

Class MockHttpServletRequest

Mock implementation of the javax.servlet.http.HttpServletRequest interface.

Compatible with Servlet 2.5 and partially with Servlet 3.0 (notable exceptions: the getPart(s) and startAsync families of methods). @author Juergen Hoeller @author Rod Johnson @author Rick Evans @author Mark Fisher @author Sam Brannen @since 1.0.2

Class MockHttpServletRequest, constructor MockHttpServletRequest()

Create a new {@code MockHttpServletRequest} with a default MockServletContext. @see MockServletContext#MockHttpServletRequest(ServletContext, String, String)
Class MockHttpServletRequest, constructor MockHttpServletRequest(ServletContext)

Create a new {@code MockHttpServletRequest} with the supplied ServletContext. @param servletContext the ServletContext that the request runs in (may be null to use a default MockServletContext) @see MockServletContext#MockHttpServletRequest(ServletContext, String, String)
Class MockHttpServletRequest, constructor MockHttpServletRequest(ServletContext, String, String)

Create a new {@code MockHttpServletRequest} with the supplied ServletContext, {@code method}, and {@code requestURI}.

The preferred locale will be set to Locale.ENGLISH. @param servletContext the ServletContext that the request runs in (may be null to use a default MockServletContext) @param method the request method (may be null) @param requestURI the request URI (may be null) @see #setMethod @see #setRequestURI @see #setPreferredLocales @see MockServletContext

Class MockHttpServletRequest, constructor MockHttpServletRequest(String, String)

Create a new {@code MockHttpServletRequest} with a default MockServletContext. @param method the request method (may be null) @param requestURI the request URI (may be null) @see #setMethod @see #setRequestURI @see MockServletContext#MockHttpServletRequest(ServletContext, String, String)
Class MockHttpServletRequest, void addParameter(String, String)

Add a single value for the specified HTTP parameter.

If there are already one or more values registered for the given parameter name, the given value will be added to the end of the list.

Class MockHttpServletRequest, void addParameter(String, String[])

Add an array of values for the specified HTTP parameter.

If there are already one or more values registered for the given parameter name, the given values will be added to the end of the list.

Class MockHttpServletRequest, void addParameters(Map)

Adds all provided parameters without replacing any existing values. To replace existing values, use .setParameters(java.util.Map).
Class MockHttpServletRequest, void addPreferredLocale(Locale)

Add a new preferred locale, before any existing locales. @see #setPreferredLocales
Class MockHttpServletRequest, void removeParameter(String)

Remove already registered values for the specified HTTP parameter, if if any.
Class MockHttpServletRequest, void setParameter(String, String)

Set a single value for the specified HTTP parameter.

If there are already one or more values registered for the given parameter name, they will be replaced.

Class MockHttpServletRequest, void setParameter(String, String[])

Set an array of values for the specified HTTP parameter.

If there are already one or more values registered for the given parameter name, they will be replaced.

Class MockHttpServletRequest, void setParameters(Map)

Sets all provided parameters replacing any existing values for the provided parameter names. To add without replacing existing values, use .addParameters(java.util.Map).

Class MockHttpServletResponse, String encodeRedirectURL(String)

The default implementation delegates to .encodeURL, returning the given URL String as-is.

Can be overridden in subclasses, appending a session id or the like in a redirect-specific fashion. For general URL encoding rules, override the common .encodeURL method instead, appyling applying to redirect URLs as well as to general URLs.

Class MockHttpServletResponse, String getHeader(String)

Return the primary value for the given header as a String, if any. Will return the first value in case of multiple values.

As of Servlet 3.0, this method is also defined in HttpServletResponse. As of Spring 3.1, it returns a stringified value for Servlet 3.0 compatibility. Consider using .getHeaderValue(String) for raw Object access. @param name the name of the header @return the associated header value, or null if none

Class MockHttpServletResponse, List<String> getHeaders(String)

Return all values for the given header as a List of Strings.

As of Servlet 3.0, this method is also defined in HttpServletResponse. As of Spring 3.1, it returns a List of stringified values for Servlet 3.0 compatibility. Consider using .getHeaderValues(String) for raw Object access. @param name the name of the header @return the associated header values, or an empty List if none


Class MockHttpSession

Mock implementation of the javax.servlet.http.HttpSession interface.

Compatible with Servlet 2.5 as well as Servlet 3.0.

Used for testing the web framework; also useful for testing application controllers. @author Juergen Hoeller @author Rod Johnson @author Mark Fisher @author Sam Brannen @since 1.0.2


Class MockRequestDispatcher

Mock implementation of the javax.servlet.RequestDispatcher interface.

Used for testing the web framework; typically not necessary for testing application controllers. @author Rod Johnson @author Juergen Hoeller @author Sam Brannen @since 1.0.2

Class MockRequestDispatcher, constructor MockRequestDispatcher(String)

Create a new MockRequestDispatcher for the given URLresource. @param urlresource the URLserver resource to dispatch to., located at a particular path or given by a particular name
Class MockRequestDispatcher, MockHttpServletResponse getMockHttpServletResponse(ServletResponse)

Obtain the underlying MockHttpServletResponse, unwrappingunwrapping HttpServletResponseWrapper decorators if necessary.

Class MockServletContext

Mock implementation of the javax.servlet.ServletContext interface.

Compatible with Servlet 2.5 and partially with Servlet 3.0. Can be configured to expose a specific version through .setMajorVersion/.setMinorVersion; default is 2.5. Note that Servlet 3.0 support is limited: servlet, filter and listener registration methods are not supported; neither is cookie or JSP configuration. We generally do not recommend to unit-test your ServletContainerInitializers and WebApplicationInitializers which is where those registration methods would be used.

Used for testing the Spring web framework; only rarely necessary for testing application controllers. As long as application components don't explicitly access the {@code ServletContext}, {@code ClassPathXmlApplicationContext} or {@code FileSystemXmlApplicationContext} can be used to load the context filesfiles for testing, even for {@code DispatcherServlet} context definitions.

For setting up a full {@code WebApplicationContext} in a test environment, you can can use {@code AnnotationConfigWebApplicationContext}, {@code XmlWebApplicationContext}, (or {@code GenericWebApplicationContext)}, passing in an an appropriate {@code MockServletContext} instance. You might wantwant to configure your your {@code MockServletContext} with a {@code FileSystemResourceLoader} in that case, to make your ensure that resource paths are interpreted as relative filefilesystem system locations.

A common setup is to point your JVM working directory to the root of your web application directory, in combination with filesystem-based resource loading. This allows to load the context files as used in the web application, with relative paths getting interpreted correctly. Such a setup will work with both {@code FileSystemXmlApplicationContext} (which will load straight from the filethe systemfilesystem) and {@code XmlWebApplicationContext} with an underlyingunderlying {@code MockServletContext} (as long as as the {@code MockServletContext} has beenbeen configured with a {@code FileSystemResourceLoader}). @author Rod Johnson @author Juergen Hoeller @author Sam Brannen @since 1.0.2 @see #MockServletContext(org.springframework.core.io.ResourceLoader) @see org.springframework.web.context.support.AnnotationConfigWebApplicationContext @see org.springframework.web.context.support.XmlWebApplicationContext @see org.springframework.web.context.support.GenericWebApplicationContext @see org.springframework.context.support.ClassPathXmlApplicationContext @see org.springframework.context.support.FileSystemXmlApplicationContext

Class MockServletContext, constructor MockServletContext(String)

Create a new MockServletContext, using a DefaultResourceLoader. @param resourceBasePath the WAR root directory of the WAR (should not end with a slash) @see org.springframework.core.io.DefaultResourceLoader
Class MockServletContext, constructor MockServletContext(String, ResourceLoader)

Create a new MockServletContext using the supplied resource base path and resource loader.

Registers a MockRequestDispatcher for the Servlet named #COMMON_DEFAULT_SERVLET_NAME "default". @param resourceBasePath the WAR root directory of the WAR (should not end with a slash) @param resourceLoader the ResourceLoader to use (or null for the default) @see #registerNamedDispatcher