• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MvcFeature类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.glassfish.jersey.server.mvc.MvcFeature的典型用法代码示例。如果您正苦于以下问题:Java MvcFeature类的具体用法?Java MvcFeature怎么用?Java MvcFeature使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MvcFeature类属于org.glassfish.jersey.server.mvc包,在下文中一共展示了MvcFeature类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: configure

import org.glassfish.jersey.server.mvc.MvcFeature; //导入依赖的package包/类
@Override
public boolean configure(final FeatureContext context) {
    final Configuration config = context.getConfiguration();

    if (!config.isRegistered(VelocityViewProcessor.class)) {
        // Template Processor.
        context.register(VelocityViewProcessor.class);

        // MvcFeature.
        if (!config.isRegistered(MvcFeature.class)) {
            context.register(MvcFeature.class);
        }

        return true;
    }
    return false;
}
 
开发者ID:Feng-Zihao,项目名称:jersey-mvc-velocity,代码行数:18,代码来源:VelocityMvcFeature.java


示例2: configure

import org.glassfish.jersey.server.mvc.MvcFeature; //导入依赖的package包/类
@Override
public boolean configure(final FeatureContext context) {
    final Configuration config = context.getConfiguration();

    if (!config.isRegistered(FreemarkerViewProcessor.class)) {
        // Template Processor.
        context.register(FreemarkerViewProcessor.class);

        // MvcFeature.
        if (!config.isRegistered(MvcFeature.class)) {
            context.register(MvcFeature.class);
        }

        return true;
    }
    return false;
}
 
开发者ID:xuegongzi,项目名称:rabbitframework,代码行数:18,代码来源:FreemarkerMvcFeature.java


示例3: WebApplicationResourceConfig

import org.glassfish.jersey.server.mvc.MvcFeature; //导入依赖的package包/类
public WebApplicationResourceConfig() {
   	packages("com.giorgiosironi.gameoflife.web");
   	property(MvcFeature.TEMPLATE_BASE_PATH, "templates");
   	register(FreemarkerMvcFeature.class);
   	register(new AbstractBinder() {
		@Override
		protected void configure() {
			InMemoryGenerationRepository repository = new InMemoryGenerationRepository();
			Generation original = Generation.withAliveCells(
					Cell.onXAndY(1, 1),
					Cell.onXAndY(1, 2),
					Cell.onXAndY(2, 1),
					Cell.onXAndY(2, 2),
					Cell.onXAndY(7, 1),
					Cell.onXAndY(7, 2),
					Cell.onXAndY(7, 3),
					Cell.onXAndY(7, 8)
			);
			repository.add("a-block-and-a-bar", 0, original);
			bind(repository).to(GenerationRepository.class);
		}
   	});
}
 
开发者ID:giorgiosironi,项目名称:game-of-life-modern-java,代码行数:24,代码来源:WebApplicationResourceConfig.java


示例4: configure

import org.glassfish.jersey.server.mvc.MvcFeature; //导入依赖的package包/类
/**
     * Property defines output encoding produced by
     * {@link org.glassfish.jersey.server.mvc.spi.TemplateProcessor}. The value
     * must be a valid encoding defined that can be passed to the
     * {@link java.nio.charset.Charset#forName(String)} method.
     *
     * <p/>
     * The default value is {@code UTF-8}.
     * <p/>
     * The name of the configuration property is <tt>{@value}</tt>.
     * <p/>
     *
     * @param context
     * @return 
     */
//    public static final String ENCODING = MvcFeature.ENCODING + SUFFIX;
    @Override
    public boolean configure(final FeatureContext context) {
        final Configuration config = context.getConfiguration();

        if (!config.isRegistered(JasperViewProcessor.class)) {
            // Template Processor.
            context.register(JasperViewProcessor.class);

            // MvcFeature.
            if (!config.isRegistered(MvcFeature.class)) {
                context.register(MvcFeature.class);
            }

            return true;
        }
        return false;
    }
 
开发者ID:marcosvpcortes,项目名称:jersey-mvc-jasper,代码行数:34,代码来源:JasperMvcFeature.java


示例5: AbstractTemplateProcessor

import org.glassfish.jersey.server.mvc.MvcFeature; //导入依赖的package包/类
/**
 * <p>Constructor for AbstractTemplateProcessor.</p>
 *
 * @param config              a {@link javax.ws.rs.core.Configuration} object.
 * @param propertySuffix      a {@link java.lang.String} object.
 * @param supportedExtensions a {@link java.lang.String} object.
 */
public AbstractTemplateProcessor(Configuration config, String propertySuffix, String... supportedExtensions) {
    this.config = config;
    this.suffix = '.' + propertySuffix;
    Map<String, Object> properties = config.getProperties();
    String basePath = TemplateHelper.getBasePath(properties, propertySuffix);

    Collection<String> basePaths = TemplateHelper.getBasePaths(basePath);

    this.basePath = basePaths.toArray(new String[basePaths.size()]);

    Boolean cacheEnabled = PropertiesHelper.getValue(properties,
            MvcFeature.CACHE_TEMPLATES + this.suffix, Boolean.class, null);
    if (cacheEnabled == null) {
        cacheEnabled = PropertiesHelper.getValue(properties, MvcFeature.CACHE_TEMPLATES, false, null);
    }

    this.cache = cacheEnabled ? DataStructures.createConcurrentMap() : null;
    this.encoding = TemplateHelper.getTemplateOutputEncoding(config, this.suffix);

    this.supportedExtensions = Sets.newHashSet(Collections2.transform(
            Arrays.asList(supportedExtensions), input -> {
                input = input.toLowerCase();
                return input.startsWith(".") ? input : "." + input;
            }));

}
 
开发者ID:icode,项目名称:ameba,代码行数:34,代码来源:AbstractTemplateProcessor.java


示例6: getTemplateObjectFactory

import org.glassfish.jersey.server.mvc.MvcFeature; //导入依赖的package包/类
/**
 * <p>getTemplateObjectFactory.</p>
 *
 * @param serviceLocator a {@link org.glassfish.hk2.api.ServiceLocator} object.
 * @param type           a {@link java.lang.Class} object.
 * @param defaultValue   a {@link org.glassfish.jersey.internal.util.collection.Value} object.
 * @param <F>            a F object.
 * @return a F object.
 */
@SuppressWarnings("unchecked")
protected <F> F getTemplateObjectFactory(ServiceLocator serviceLocator, Class<F> type, Value<F> defaultValue) {
    Object objectFactoryProperty = this.config.getProperty(MvcFeature.TEMPLATE_OBJECT_FACTORY + this.suffix);
    if (objectFactoryProperty != null) {
        if (type.isAssignableFrom(objectFactoryProperty.getClass())) {
            return type.cast(objectFactoryProperty);
        }

        Class<F> factoryClass = null;
        if (objectFactoryProperty instanceof String) {
            factoryClass = ReflectionHelper.<F>classForNamePA((String) objectFactoryProperty).run();
        } else if (objectFactoryProperty instanceof Class) {
            factoryClass = (Class<F>) objectFactoryProperty;
        }

        if (factoryClass != null) {
            if (type.isAssignableFrom(factoryClass)) {
                return serviceLocator.create(factoryClass);
            }

            logger.warn(LocalizationMessages.WRONG_TEMPLATE_OBJECT_FACTORY(factoryClass, type));
        }
    }

    return defaultValue.get();
}
 
开发者ID:icode,项目名称:ameba,代码行数:36,代码来源:AbstractTemplateProcessor.java


示例7: getTemplateOutputEncoding

import org.glassfish.jersey.server.mvc.MvcFeature; //导入依赖的package包/类
/**
 * Get output encoding from configuration.
 *
 * @param configuration Configuration.
 * @param suffix        Template processor suffix of the
 *                      to configuration property {@link org.glassfish.jersey.server.mvc.MvcFeature#ENCODING}.
 * @return Encoding read from configuration properties or a default encoding if no encoding is configured.
 */
public static Charset getTemplateOutputEncoding(Configuration configuration, String suffix) {
    final String enc = PropertiesHelper.getValue(configuration.getProperties(), MvcFeature.ENCODING + suffix,
            String.class, null);
    if (enc == null) {
        return DEFAULT_ENCODING;
    } else {
        return Charset.forName(enc);
    }
}
 
开发者ID:icode,项目名称:ameba,代码行数:18,代码来源:TemplateHelper.java


示例8: getBasePath

import org.glassfish.jersey.server.mvc.MvcFeature; //导入依赖的package包/类
/**
 * <p>getBasePath.</p>
 *
 * @param properties a {@link java.util.Map} object.
 * @param cfgSuffix a {@link java.lang.String} object.
 * @return a {@link java.lang.String} object.
 */
public static String getBasePath(Map<String, Object> properties, String cfgSuffix) {
    String basePath = PropertiesHelper.getValue(properties,
            MvcFeature.TEMPLATE_BASE_PATH + "." + cfgSuffix, String.class, null);
    if (basePath == null) {
        basePath = PropertiesHelper.getValue(properties, MvcFeature.TEMPLATE_BASE_PATH, "", null);
    }
    return basePath;
}
 
开发者ID:icode,项目名称:ameba,代码行数:16,代码来源:TemplateHelper.java


示例9: PandaJerseyConfig

import org.glassfish.jersey.server.mvc.MvcFeature; //导入依赖的package包/类
public PandaJerseyConfig() throws JAXBException {
    packages("de.fuberlin.panda.api.jersey");
    setApplicationName("PANDA");

    // Load Resource Map
    JAXBContext jaxbContext = JAXBContext.newInstance(ResourceMap.class);
    Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
    File configFile = new File(pandaSettings.getResourceConfFilePath());
    pandaSettings.setResourceMap((ResourceMap) unmarshaller.unmarshal(configFile));

    // create default settings
    register(new AbstractBinder() {
        @Override
        protected void configure() {
            bind(pandaSettings);
        }
    });

    // register class for JSON support
    this.register(JacksonFeature.class);

    // register JSP support
    this.register(JspMvcFeature.class);
    this.property(MvcFeature.TEMPLATE_BASE_PATH, "/WEB-INF/jsp");

    // Custom JAXB marshaller provider
    this.register(JaxbMarshallerProvider.class);

    // Custom Jackson ObjectMapper provider
    this.register(JacksonObjectMapperProvider.class);

}
 
开发者ID:chsatgithub,项目名称:PANDA-DEEPLINKING,代码行数:33,代码来源:PandaJerseyConfig.java


示例10: configure

import org.glassfish.jersey.server.mvc.MvcFeature; //导入依赖的package包/类
@Override
public boolean configure(final FeatureContext context) {
    if (!context.getConfiguration().isRegistered(MvcFeature.class)) {
        context.register(MvcFeature.class);
    }
    context.register(MustacheViewProcessor.class);
    return true;
}
 
开发者ID:trautonen,项目名称:jersey-mustache,代码行数:9,代码来源:MustacheMvcFeature.java


示例11: RallyeApplication

import org.glassfish.jersey.server.mvc.MvcFeature; //导入依赖的package包/类
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);
}
 
开发者ID:jakobwenzel,项目名称:rallye-server,代码行数:14,代码来源:RallyeApplication.java



注:本文中的org.glassfish.jersey.server.mvc.MvcFeature类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AfterStep类代码示例发布时间:2022-05-23
下一篇:
Java UnivariateIntegrator类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap