org.glassfish.jersey.server.mvc.mustache.MustacheMvcFeature Java Examples

The following examples show how to use org.glassfish.jersey.server.mvc.mustache.MustacheMvcFeature. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EmissaryServer.java    From emissary with Apache License 2.0 6 votes vote down vote up
private ContextHandler buildMVCHandler() {

        final ResourceConfig application = new ResourceConfig();
        application.register(MultiPartFeature.class);
        // setup mustache templates
        application.property(MustacheMvcFeature.TEMPLATE_BASE_PATH, "/templates");
        application.register(MustacheMvcFeature.class).packages("emissary.server.mvc");

        ServletHolder mvcHolder = new ServletHolder(new org.glassfish.jersey.servlet.ServletContainer(application));
        // mvcHolder.setInitOrder(1);

        ServletContextHandler mvcHolderContext = new ServletContextHandler(ServletContextHandler.SESSIONS);
        mvcHolderContext.addServlet(mvcHolder, "/*");

        return mvcHolderContext;
    }
 
Example #2
Source File: EndpointTestBase.java    From emissary with Apache License 2.0 5 votes vote down vote up
@Override
protected Application configure() {
    new UnitTest().setupSystemProperties();
    // Tells Jersey to use first available port, fixes address already in use exception
    forceSet(TestProperties.CONTAINER_PORT, "0");
    final ResourceConfig application = new ResourceConfig();
    application.register(MultiPartFeature.class);
    application.property(MustacheMvcFeature.TEMPLATE_BASE_PATH, "/templates");
    application.register(MustacheMvcFeature.class).packages("emissary.server.mvc");
    application.register(MustacheMvcFeature.class).packages("emissary.server.api");

    return application;
}
 
Example #3
Source File: RequestHandler.java    From jrestless-examples with Apache License 2.0 5 votes vote down vote up
public RequestHandler() {
	// configure the application with the resource
	ResourceConfig config = new ResourceConfig()
			.register(GatewayFeature.class)
			.register(MustacheMvcFeature.class)
			.packages("com.jrestless.aws.examples");
	init(config);
	start();
}
 
Example #4
Source File: TFBApplication.java    From FrameworkBenchmarks with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public TFBApplication() {
	super(ServerHeaderFilter.class, JacksonFeature.class, Jackson2MapperProvider.class,
			MustacheMvcFeature.class, PlaintextResource.class, JsonResource.class,
			FortunesResource.class, WorldResource.class);
	property("jersey.config.server.mvc.caching.mustache", "true");
	register(new AbstractBinder() {
		@Override
		protected void configure() {
			bindFactory(EMFactory.class).to(EntityManagerFactory.class).in(Singleton.class);
		}
	});
}