Search in sources :

Example 1 with MvcFeature

use of org.glassfish.jersey.server.mvc.MvcFeature in project jersey by jersey.

the class FreemarkerMvcFeature method configure.

@Override
public boolean configure(final FeatureContext context) {
    final Configuration config = context.getConfiguration();
    if (!config.isRegistered(FreemarkerViewProcessor.class)) {
        // Template Processor.
        Configuration configuration = injectionManager.getInstance(Configuration.class);
        ServletContext servletContext = injectionManager.getInstance(ServletContext.class);
        context.register(new FreemarkerViewProcessor(configuration, servletContext, injectionManager::createAndInitialize));
        // MvcFeature.
        if (!config.isRegistered(MvcFeature.class)) {
            context.register(MvcFeature.class);
        }
        return true;
    }
    return false;
}
Also used : Configuration(javax.ws.rs.core.Configuration) ServletContext(javax.servlet.ServletContext) MvcFeature(org.glassfish.jersey.server.mvc.MvcFeature)

Example 2 with MvcFeature

use of org.glassfish.jersey.server.mvc.MvcFeature in project jersey by jersey.

the class MustacheMvcFeature method configure.

@Override
public boolean configure(final FeatureContext context) {
    final Configuration config = context.getConfiguration();
    if (!config.isRegistered(MustacheTemplateProcessor.class)) {
        // Template Processor.
        Configuration configuration = injectionManager.getInstance(Configuration.class);
        ServletContext servletContext = injectionManager.getInstance(ServletContext.class);
        context.register(new MustacheTemplateProcessor(configuration, servletContext, injectionManager::createAndInitialize));
        // MvcFeature.
        if (!config.isRegistered(MvcFeature.class)) {
            context.register(MvcFeature.class);
        }
        return true;
    }
    return false;
}
Also used : Configuration(javax.ws.rs.core.Configuration) ServletContext(javax.servlet.ServletContext) MvcFeature(org.glassfish.jersey.server.mvc.MvcFeature)

Aggregations

ServletContext (javax.servlet.ServletContext)2 Configuration (javax.ws.rs.core.Configuration)2 MvcFeature (org.glassfish.jersey.server.mvc.MvcFeature)2