| 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 | ||
| 17 | /** | |
| 18 | * Generates an instance of {@link SpringWebContext} for Thymeleaf v2. | |
| 19 | * | |
| 20 | * This is used to mimic the behavior of {@link ThymeleafView} in order to give | |
| 21 | * access to {@link HttpServletRequest}, {@link HttpServletResponse} and | |
| 22 | * {@link ServletContext} from templates. | |
| 23 | * | |
| 24 | * | |
| 25 | * @author Aurélien Baudet | |
| 26 | * | |
| 27 | */ | |
| 28 | public class SpringWebContextProvider implements ThymeleafWebContextProvider { | |
| 29 | ||
| 30 | @Override | |
| 31 | public IContext getWebContext(Context context, IContext base, HttpServletRequest request, HttpServletResponse response, ServletContext servletContext, ApplicationContext applicationContext, | |
| 32 | Map<String, Object> springModel) { | |
| 33 |
1
1. getWebContext : replaced return value with null for fr/sii/ogham/spring/v1/template/thymeleaf/SpringWebContextProvider::getWebContext → TIMED_OUT |
return new SpringWebContext(request, response, servletContext, base.getLocale(), springModel, applicationContext); |
| 34 | } | |
| 35 | ||
| 36 | } | |
Mutations | ||
| 33 |
1.1 |