当前位置: 首页>>代码示例>>Java>>正文


Java CommonProperties.getValue方法代码示例

本文整理汇总了Java中org.glassfish.jersey.CommonProperties.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java CommonProperties.getValue方法的具体用法?Java CommonProperties.getValue怎么用?Java CommonProperties.getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.glassfish.jersey.CommonProperties的用法示例。


在下文中一共展示了CommonProperties.getValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configure

import org.glassfish.jersey.CommonProperties; //导入方法依赖的package包/类
public boolean configure(final FeatureContext context) {
    final Configuration config = context.getConfiguration();
    final String jsonFeature = CommonProperties.getValue(config.getProperties(), config.getRuntimeType(), InternalProperties.JSON_FEATURE, JSON_FEATURE,
            String.class);
    // Other JSON providers registered.
    if (!JSON_FEATURE.equalsIgnoreCase(jsonFeature)) {
        return false;
    }
    // Disable other JSON providers.
    context.property(PropertiesHelper.getPropertyNameForRuntime(InternalProperties.JSON_FEATURE, config.getRuntimeType()), JSON_FEATURE);
    // Register FastJson.
    if (!config.isRegistered(FastJsonProvider.class)) {
        //DisableCircularReferenceDetect
        FastJsonProvider fastJsonProvider = new FastJsonProvider();
        FastJsonConfig fastJsonConfig = new FastJsonConfig();
        //fastJsonConfig.setSerializerFeatures(SerializerFeature.DisableCircularReferenceDetect,SerializerFeature.BrowserSecure);

        fastJsonConfig.setSerializerFeatures(SerializerFeature.DisableCircularReferenceDetect);

        fastJsonProvider.setFastJsonConfig(fastJsonConfig);

        context.register(fastJsonProvider, MessageBodyReader.class, MessageBodyWriter.class);
    }
    return true;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:Issue1341.java

示例2: registerJerseyJsonFeature

import org.glassfish.jersey.CommonProperties; //导入方法依赖的package包/类
/**
 * Register a Jersey JSON provider feature only if another JSON provider is not already registered, checking
 * {@link #JERSEY_JSON_PROVIDER_PROPERTY} property value.
 * @param context Feature context
 * @param feature Feature to register
 * @param featureName Feature name to register
 * @return <code>true</code> if feature was registered, <code>false</code> otherwise
 */
private static boolean registerJerseyJsonFeature(FeatureContext context, Class<? extends Feature> feature,
		String featureName) {
	final Configuration config = context.getConfiguration();

	final String jsonFeature = CommonProperties.getValue(config.getProperties(), config.getRuntimeType(),
			JERSEY_JSON_PROVIDER_PROPERTY, featureName, String.class);
	if (!featureName.equalsIgnoreCase(jsonFeature)) {
		// Other JSON providers registered
		return false;
	}
	// Disable other JSON providers
	context.property(
			PropertiesHelper.getPropertyNameForRuntime(JERSEY_JSON_PROVIDER_PROPERTY, config.getRuntimeType()),
			featureName);
	// Register
	if (!config.isRegistered(feature)) {
		context.register(feature);
	}
	return true;
}
 
开发者ID:holon-platform,项目名称:holon-json,代码行数:29,代码来源:GsonAutoDiscoverable.java

示例3: configure

import org.glassfish.jersey.CommonProperties; //导入方法依赖的package包/类
public boolean configure(final FeatureContext context) {
	final Configuration config = context.getConfiguration();
	final String jsonFeature = CommonProperties.getValue(config.getProperties(), config.getRuntimeType(), InternalProperties.JSON_FEATURE, JSON_FEATURE,
			String.class);
	// Other JSON providers registered.
	if (!JSON_FEATURE.equalsIgnoreCase(jsonFeature)) {
		return false;
	}
	// Disable other JSON providers.
	context.property(PropertiesHelper.getPropertyNameForRuntime(InternalProperties.JSON_FEATURE, config.getRuntimeType()), JSON_FEATURE);
	// Register FastJson.
	if (!config.isRegistered(FastJsonProvider.class)) {
		context.register(FastJsonProvider.class, MessageBodyReader.class, MessageBodyWriter.class);
	}
	return true;
}
 
开发者ID:ChineseLincoln,项目名称:JerseyRestful,代码行数:17,代码来源:FastJsonFeature.java

示例4: configure

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

  final String jsonFeature = CommonProperties.getValue(config.getProperties(), config.getRuntimeType(),
      InternalProperties.JSON_FEATURE, JSON_FEATURE, String.class);
  // Other JSON providers registered.
  if (!JSON_FEATURE.equalsIgnoreCase(jsonFeature)) {
    return false;
  }

  // Disable other JSON providers.
  context.property(PropertiesHelper.getPropertyNameForRuntime(InternalProperties.JSON_FEATURE, config.getRuntimeType()),
      JSON_FEATURE);

  // Register Jackson.
  if (!config.isRegistered(JacksonJaxbJsonProvider.class)) {
    // add the Jackson exception mappers with application/json output
    context.register(JsonMappingExceptionMapper.class);
    context.register(JsonParseExceptionMapper.class);

    if (EntityFilteringFeature.enabled(config)) {
      context.register(JacksonFilteringFeature.class);
      context.register(FilteringJacksonJaxbJsonProvider.class, MessageBodyReader.class, MessageBodyWriter.class);
    } else {
      context.register(JacksonJaxbJsonProvider.class, MessageBodyReader.class, MessageBodyWriter.class);
    }
  }

  return true;
}
 
开发者ID:sorskod,项目名称:webserver,代码行数:32,代码来源:JsonJacksonFeature.java

示例5: configure

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

    final String jsonFeature = CommonProperties.getValue(config.getProperties(),
            config.getRuntimeType(),
            InternalProperties.JSON_FEATURE,
            JSON_FEATURE,
            String.class);
    // Other JSON providers registered.
    if (!JSON_FEATURE.equalsIgnoreCase(jsonFeature)) {
        return false;
    }

    // Disable other JSON providers.
    String propName = PropertiesHelper.getPropertyNameForRuntime(InternalProperties.JSON_FEATURE,
                                                                 config.getRuntimeType());
    context.property(propName, JSON_FEATURE);

    // Register
    context.register(GsonProvider.class);
    if (gsonBuilder != null) {
        context.register(new ContextResolver<GsonBuilder>() {
            @Override
            public GsonBuilder getContext(Class type) {
                return gsonBuilder;
            }
        });
    }
    return true;
}
 
开发者ID:martinjmares,项目名称:javaone2015-cloudone,代码行数:32,代码来源:GsonFeature.java

示例6: configure

import org.glassfish.jersey.CommonProperties; //导入方法依赖的package包/类
@Override
public boolean configure(final FeatureContext context) {

    final Configuration config = context.getConfiguration();

    final String jsonFeature = CommonProperties.getValue(config.getProperties(), config.getRuntimeType(), InternalProperties.JSON_FEATURE, JSON_FEATURE,
            String.class);

    // Other JSON providers registered.
    if (!JSON_FEATURE.equalsIgnoreCase(jsonFeature))

        return false;

    // Disable other JSON providers.
    context.property(PropertiesHelper.getPropertyNameForRuntime(InternalProperties.JSON_FEATURE, config.getRuntimeType()), JSON_FEATURE);

    // Register FastJson.
    if (!config.isRegistered(FastJsonProvider.class))

        context.register(FastJsonProvider.class, MessageBodyReader.class, MessageBodyWriter.class);

    return true;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:FastJsonFeature.java


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