SpringWebContextProvider.java

1
package fr.sii.ogham.spring.v1.template.thymeleaf;
2
3
import java.util.Map;
4
5
import javax.servlet.ServletContext;
6
import javax.servlet.http.HttpServletRequest;
7
import javax.servlet.http.HttpServletResponse;
8
9
import org.springframework.context.ApplicationContext;
10
import org.thymeleaf.context.IContext;
11
import org.thymeleaf.spring4.context.SpringWebContext;
12
import org.thymeleaf.spring4.view.ThymeleafView;
13
14
import fr.sii.ogham.core.template.context.Context;
15
import fr.sii.ogham.spring.template.thymeleaf.ThymeleafWebContextProvider;
16
import fr.sii.ogham.spring.util.compat.HttpServletRequestWrapper;
17
import fr.sii.ogham.spring.util.compat.HttpServletResponseWrapper;
18
import fr.sii.ogham.spring.util.compat.ServletContextWrapper;
19
20
/**
21
 * Generates an instance of {@link SpringWebContext} for Thymeleaf v2.
22
 *
23
 * This is used to mimic the behavior of {@link ThymeleafView} in order to give
24
 * access to {@link HttpServletRequest}, {@link HttpServletResponse} and
25
 * {@link ServletContext} from templates.
26
 *
27
 *
28
 * @author Aurélien Baudet
29
 *
30
 */
31
public class SpringWebContextProvider implements ThymeleafWebContextProvider {
32
33
	@Override
34
	public IContext getWebContext(Context context, IContext base, HttpServletRequestWrapper request, HttpServletResponseWrapper response, ServletContextWrapper servletContext, ApplicationContext applicationContext,
35
								  Map<String, Object> springModel) {
36 1 1. getWebContext : replaced return value with null for fr/sii/ogham/spring/v1/template/thymeleaf/SpringWebContextProvider::getWebContext → RUN_ERROR
		return new SpringWebContext(request.get(), response.get(), servletContext.get(), base.getLocale(), springModel, applicationContext);
37
	}
38
39
}

Mutations

36

1.1
Location : getWebContext
Killed by :
replaced return value with null for fr/sii/ogham/spring/v1/template/thymeleaf/SpringWebContextProvider::getWebContext → RUN_ERROR

Active mutators

Tests examined


Report generated by PIT 1.13.1