本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}