All Downloads are FREE. Search and download functionalities are using the official Maven repository.

hu.inbuss.thymeleaf.mvc.MVCWebContextFactory Maven / Gradle / Ivy

Go to download

An extension providing Thymeleaf as a view engine in MVC 1.0 (JSR371) environments.

There is a newer version: 0.0.9
Show newest version
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