| 1 | package fr.sii.ogham.spring.template.thymeleaf; | |
| 2 | ||
| 3 | import javax.servlet.ServletContext; | |
| 4 | import javax.servlet.http.HttpServletRequest; | |
| 5 | import javax.servlet.http.HttpServletResponse; | |
| 6 | ||
| 7 | import org.springframework.web.context.ServletContextAware; | |
| 8 | import org.springframework.web.context.request.RequestContextHolder; | |
| 9 | import org.springframework.web.context.request.ServletRequestAttributes; | |
| 10 | ||
| 11 | import fr.sii.ogham.core.template.context.Context; | |
| 12 | ||
| 13 | /** | |
| 14 | * Implementation that retrieves the current {@link HttpServletRequest} and | |
| 15 | * {@link HttpServletResponse} using {@link RequestContextHolder}. | |
| 16 | * | |
| 17 | * @author Aurélien Baudet | |
| 18 | * | |
| 19 | */ | |
| 20 | public class RequestContextHolderWebContextProvider implements WebContextProvider, ServletContextAware { | |
| 21 | private ServletContext servletContext; | |
| 22 | ||
| 23 | @Override | |
| 24 | public HttpServletRequest getRequest(Context context) { | |
| 25 |
1
1. getRequest : replaced return value with null for fr/sii/ogham/spring/template/thymeleaf/RequestContextHolderWebContextProvider::getRequest → TIMED_OUT |
return ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest(); |
| 26 | } | |
| 27 | ||
| 28 | @Override | |
| 29 | public HttpServletResponse getResponse(Context context) { | |
| 30 |
1
1. getResponse : replaced return value with null for fr/sii/ogham/spring/template/thymeleaf/RequestContextHolderWebContextProvider::getResponse → TIMED_OUT |
return ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getResponse(); |
| 31 | } | |
| 32 | ||
| 33 | @Override | |
| 34 | public ServletContext getServletContext(Context context) { | |
| 35 |
1
1. getServletContext : replaced return value with null for fr/sii/ogham/spring/template/thymeleaf/RequestContextHolderWebContextProvider::getServletContext → TIMED_OUT |
return servletContext; |
| 36 | } | |
| 37 | ||
| 38 | @Override | |
| 39 | public void setServletContext(ServletContext servletContext) { | |
| 40 | this.servletContext = servletContext; | |
| 41 | } | |
| 42 | ||
| 43 | } | |
Mutations | ||
| 25 |
1.1 |
|
| 30 |
1.1 |
|
| 35 |
1.1 |