hu.inbuss.thymeleaf.mvc.MVCWebContextFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of thymeleaf-mvc Show documentation
Show all versions of thymeleaf-mvc Show documentation
An extension providing Thymeleaf as a view engine in MVC 1.0 (JSR371) environments.
package hu.inbuss.thymeleaf.mvc;
import javax.enterprise.context.Dependent;
import javax.enterprise.inject.spi.BeanManager;
import javax.inject.Inject;
import javax.mvc.engine.ViewEngineContext;
import javax.servlet.ServletContext;
import org.thymeleaf.context.IWebContext;
/**
* @author PÁLFALVI Tamás <[email protected]>
*/
@Dependent
public class MVCWebContextFactory {
private final BeanManager beanManager;
private final ServletContext servletContext;
@Inject public MVCWebContextFactory(final BeanManager beanManager, final ServletContext servletContext) {
this.beanManager = beanManager;
this.servletContext = servletContext;
}
public IWebContext create(final ViewEngineContext ctx) {
return new MVCWebContext(ctx.getRequest(), ctx.getResponse(), beanManager, servletContext, ctx.getModels());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy