Java 类org.glassfish.jersey.server.mvc.mustache.MustacheMvcFeature 实例源码

项目:jrestless-examples    文件:RequestHandler.java   
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();
}
项目:rallye-server    文件:RallyeApplication.java   
public RallyeApplication() {
    packages("de.rallye.api", "de.rallye.filter.auth", "de.rallye.exceptions.mappers");
    register(JacksonSmileProvider.class);
    register(JacksonXMLProvider.class);
    register(JacksonFeature.class);
    //register(EnsureMimeType.class);
    register(new RallyeBinder());
    register(MultiPartFeature.class);

       property(MvcFeature.TEMPLATE_BASE_PATH, "templates");
    property(MustacheMvcFeature.CACHE_TEMPLATES, false); //TODO enable caching once templates are no longer being modified
       register(MustacheMvcFeature.class);
}
项目:knowledgestore    文件:Application.java   
public Application(final UIConfig uiConfig, final KnowledgeStore store,
          final Boolean enableTracing, final Iterable<? extends Class<?>> resourceClasses,
                     final Iterable<CustomConfig> configs) {

      // keep track of KS and UI config
      this.store = Preconditions.checkNotNull(store);
      this.uiConfig = Preconditions.checkNotNull(uiConfig);
      customConfigs = new HashMap<>();
      if (configs != null) {
    for (CustomConfig config : configs) {
        customConfigs.put(config.getName(), config);
    }
}

      // define JAX-RS classes
      final ImmutableSet.Builder<Class<?>> classes = ImmutableSet.builder();
      classes.add(DeflateEncoder.class);
      classes.add(GZipEncoder.class);
      for (final Class<?> resourceClass : resourceClasses) {
          classes.add(resourceClass);
      }
      classes.add(Converter.class);
      classes.add(Filter.class);
      classes.add(Mapper.class);
      classes.add(Serializer.class);
      classes.add(MustacheMvcFeature.class);
      this.classes = classes.build();

      // define singletons
      this.singletons = ImmutableSet.of();

      // define JAX-RS properties
      final ImmutableMap.Builder<String, Object> properties = ImmutableMap.builder();
      properties.put(ServerProperties.APPLICATION_NAME, "KnowledgeStore");
      if (Boolean.TRUE.equals(enableTracing)) {
          properties.put(ServerProperties.TRACING, "ALL");
          properties.put(ServerProperties.TRACING_THRESHOLD, "TRACE");

          // note: in a particular instance we observed 1GB ram being used by Jersey monitoring
          // code after 1h uptime and only three requests received by the server (!). Therefore,
          // enable these settings only if strictly necessary
          properties.put(ServerProperties.MONITORING_STATISTICS_ENABLED, true);
          properties.put(ServerProperties.MONITORING_STATISTICS_MBEANS_ENABLED, true);
      }
      properties.put(ServerProperties.WADL_FEATURE_DISABLE, false);
      properties.put(ServerProperties.JSON_PROCESSING_FEATURE_DISABLE, true); // JSONLD used
      properties.put(ServerProperties.METAINF_SERVICES_LOOKUP_DISABLE, true); // not used
      properties.put(ServerProperties.MOXY_JSON_FEATURE_DISABLE, true); // not used
      properties.put(ServerProperties.OUTBOUND_CONTENT_LENGTH_BUFFER, 8192); // default value
      properties.put(MustacheMvcFeature.CACHE_TEMPLATES, true);
      properties.put(MustacheMvcFeature.TEMPLATE_BASE_PATH,
              "/eu/fbk/knowledgestore/server/http/jaxrs/");
      this.properties = properties.build();

      // Initialize globally last modified variables
      this.pendingModifications = 0;
      this.lastModified = new Date();
  }