當前位置: 首頁>>代碼示例>>Java>>正文


Java FeatureContext.property方法代碼示例

本文整理匯總了Java中javax.ws.rs.core.FeatureContext.property方法的典型用法代碼示例。如果您正苦於以下問題:Java FeatureContext.property方法的具體用法?Java FeatureContext.property怎麽用?Java FeatureContext.property使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.ws.rs.core.FeatureContext的用法示例。


在下文中一共展示了FeatureContext.property方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: configure

import javax.ws.rs.core.FeatureContext; //導入方法依賴的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 javax.ws.rs.core.FeatureContext; //導入方法依賴的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 javax.ws.rs.core.FeatureContext; //導入方法依賴的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: applyInternalCommonConfig

import javax.ws.rs.core.FeatureContext; //導入方法依賴的package包/類
private void applyInternalCommonConfig(FeatureContext context, InternalCommonConfig internalCommonConfig)
{
    for ( Class<?> clazz : internalCommonConfig.getClasses() )
    {
        log.info(String.format("Registering %s as a component", clazz));
        context.register(clazz);
    }
    for ( Object obj : internalCommonConfig.getInstances() )
    {
        log.info(String.format("Registering instance of %s as a component", obj.getClass()));
        context.register(obj);
    }
    for ( Map.Entry<String, Object> entry : internalCommonConfig.getProperties().entrySet() )
    {
        String key = entry.getKey();
        Object value = entry.getValue();
        log.info(String.format("Registering property key: %s\tvalue: %s", key, value));
        context.property(key, value);
    }
}
 
開發者ID:soabase,項目名稱:soabase,代碼行數:21,代碼來源:GuiceBundle.java

示例5: configure

import javax.ws.rs.core.FeatureContext; //導入方法依賴的package包/類
@Override
public void configure(ResourceInfo resourceInfo, FeatureContext context) {
	Class<?> resourceClass = resourceInfo.getResourceClass();
	Method method = resourceInfo.getResourceMethod();
	logger.info("getResourceClass: " + resourceClass);
	logger.info("getResourceMethod: " + method);
	context.property("new_dynamic_feature", resourceClass + "|" + method);
}
 
開發者ID:PacktPublishing,項目名稱:Mastering-Java-EE-Development-with-WildFly,代碼行數:9,代碼來源:MyResourceSingleton.java

示例6: configure

import javax.ws.rs.core.FeatureContext; //導入方法依賴的package包/類
public boolean configure(FeatureContext context) {
    context.property("jersey.config.server.disableMoxyJson", Boolean.valueOf(true));
    Configuration config = context.getConfiguration();
    context.property(getPropertyNameForRuntime("jersey.config.jsonFeature", config.getRuntimeType()), JSON_FEATURE);
    if (!config.isRegistered(JacksonJaxbJsonProvider.class)) {
        context.register(JsonParseExceptionMapper.class);
        context.register(JsonMappingExceptionMapper.class);
        context.register(JacksonJaxbJsonProvider.class, new Class[]{MessageBodyReader.class, MessageBodyWriter.class});
    }

    return true;
}
 
開發者ID:igorzg,項目名稱:payara-micro-docker-starter-kit,代碼行數:13,代碼來源:JacksonFeature.java

示例7: configure

import javax.ws.rs.core.FeatureContext; //導入方法依賴的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

示例8: configure

import javax.ws.rs.core.FeatureContext; //導入方法依賴的package包/類
@Override
public boolean configure(FeatureContext context) {
    final Configuration config = context.getConfiguration();
    context.property("jersey.config." + config.getRuntimeType().toString().toLowerCase(Locale.ENGLISH) + ".jsonFeature", "JacksonFeature");
    context.register(JsonParseExceptionMapper.class, Priorities.ENTITY_CODER);
    context.register(JsonMappingExceptionMapper.class, Priorities.ENTITY_CODER);
    context.register(JacksonJsonProviderForJsonMediaType.class, Priorities.ENTITY_CODER);
    return true;
}
 
開發者ID:anton-tregubov,項目名稱:javaee-design-patterns,代碼行數:10,代碼來源:JacksonActivator.java

示例9: configure

import javax.ws.rs.core.FeatureContext; //導入方法依賴的package包/類
@Override
public boolean configure(FeatureContext context) {
	final String disableMoxy = CommonProperties.MOXY_JSON_FEATURE_DISABLE + '.'
			+ context.getConfiguration().getRuntimeType().name().toLowerCase();
	context.property(disableMoxy, true);

	// add the default Jackson exception mappers
	context.register(JsonParseExceptionMapper.class);
	context.register(JsonMappingExceptionMapper.class);
	context.register(JacksonProvider.class, MessageBodyReader.class, MessageBodyWriter.class);
	return true;
}
 
開發者ID:infinitiessoft,項目名稱:keystone4j,代碼行數:13,代碼來源:JacksonFeature.java

示例10: configure

import javax.ws.rs.core.FeatureContext; //導入方法依賴的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

示例11: configure

import javax.ws.rs.core.FeatureContext; //導入方法依賴的package包/類
@Override
public boolean configure(final FeatureContext context) {
    final String disableMoxy = CommonProperties.MOXY_JSON_FEATURE_DISABLE + '.' + context.getConfiguration().getRuntimeType().name().toLowerCase();
    context.property(disableMoxy, true);

    context.register(new JacksonJaxbJsonProvider(mapper, DEFAULT_ANNOTATIONS), MessageBodyReader.class, MessageBodyWriter.class);
    return true;
}
 
開發者ID:jivesoftware,項目名稱:routing-bird,代碼行數:9,代碼來源:JacksonFeature.java

示例12: configure

import javax.ws.rs.core.FeatureContext; //導入方法依賴的package包/類
@Override
public boolean configure(final FeatureContext context) {
    final Configuration config = context.getConfiguration();
    //client side only configuration
    if (RuntimeType.CLIENT == config.getRuntimeType()) {
        if (!config.isRegistered(JWSJerseyFilter.class)){
            context.property(JWSJerseyFilter.JWS_FILTER_KEY, key);
            context.register(JWSJerseyFilter.class);
            return true;
        }
    }
    return false;
}
 
開發者ID:Appverse,項目名稱:appverse-server,代碼行數:14,代碼來源:JWSJerseyFeature.java

示例13: configure

import javax.ws.rs.core.FeatureContext; //導入方法依賴的package包/類
/** {@inheritDoc} */
@Override
public boolean configure(final FeatureContext context) {
    // disable Jersey default BeanValidation feature
    context.property(ServerProperties.BV_FEATURE_DISABLE, "true");
    context.register(new ValidationBinder())
            .register(ValidationExceptionMapper.class)
            .register(ValidationConfigurationContextResolver.class);
    return true;
}
 
開發者ID:icode,項目名稱:ameba,代碼行數:11,代碼來源:ValidationFeature.java

示例14: configure

import javax.ws.rs.core.FeatureContext; //導入方法依賴的package包/類
@Override
public boolean configure(FeatureContext context) {

    // this gives everyone access to the LinkRest services
    context.property(LinkRestRuntime.LINK_REST_CONTAINER_PROPERTY, injector);

    @SuppressWarnings("unchecked")
    Map<String, Class> bodyWriters =
            injector.getInstance(Key.getMapOf(String.class, Class.class, LinkRestRuntime.BODY_WRITERS_MAP));

    for (Class<?> type : bodyWriters.values()) {
        context.register(type);
    }

    context.register(ResponseStatusDynamicFeature.class);

    context.register(EntityUpdateReader.class);
    context.register(EntityUpdateCollectionReader.class);

    for (Class<?> c : extraComponents) {
        context.register(c);
    }

    for (Feature f : extraFeatures) {
        f.configure(context);
    }

    return true;
}
 
開發者ID:nhl,項目名稱:link-rest,代碼行數:30,代碼來源:LinkRestRuntime.java

示例15: configure

import javax.ws.rs.core.FeatureContext; //導入方法依賴的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


注:本文中的javax.ws.rs.core.FeatureContext.property方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。