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


Java CommonProperties类代码示例

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


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

示例1: JerseyApplication

import org.glassfish.jersey.CommonProperties; //导入依赖的package包/类
@Inject
public JerseyApplication(ServiceLocator serviceLocator) {
	GuiceBridge.getGuiceBridge().initializeGuiceBridge(serviceLocator);
	GuiceIntoHK2Bridge guiceBridge = serviceLocator.getService(GuiceIntoHK2Bridge.class);
    guiceBridge.bridgeGuiceInjector(AppLoader.injector);
    
    String disableMoxy = PropertiesHelper.getPropertyNameForRuntime(
    		CommonProperties.MOXY_JSON_FEATURE_DISABLE,
               getConfiguration().getRuntimeType());
       property(disableMoxy, true);
       property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true);

       // add the default Jackson exception mappers
       register(JsonParseExceptionMapper.class);
       register(JsonMappingExceptionMapper.class);
       register(JacksonJsonProvider.class, MessageBodyReader.class, MessageBodyWriter.class);
       
       packages(JerseyApplication.class.getPackage().getName());
       
    for (JerseyConfigurator configurator: AppLoader.getExtensions(JerseyConfigurator.class)) {
    	configurator.configure(this);
    }
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:24,代码来源:JerseyApplication.java

示例2: 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

示例3: 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

示例4: 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

示例5: setServletContext

import org.glassfish.jersey.CommonProperties; //导入依赖的package包/类
@Override
public void setServletContext(ServletContext servletContext) {
	String servletRegistrationName = getServletRegistrationName();
	ServletRegistration registration = servletContext
			.getServletRegistration(servletRegistrationName);
	if (registration != null) {
		if (logger.isInfoEnabled()) {
			logger.info("Configuring existing registration for Jersey servlet '"
					+ servletRegistrationName + "'");
		}
		registration.setInitParameters(this.jersey.getInit());
		registration.setInitParameter(
				CommonProperties.METAINF_SERVICES_LOOKUP_DISABLE,
				Boolean.TRUE.toString());
	}
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:17,代码来源:JerseyAutoConfiguration.java

示例6: UriTemplateApplication

import org.glassfish.jersey.CommonProperties; //导入依赖的package包/类
/**
 * Create a new UriTemplateApplication.
 * 
 */
public UriTemplateApplication()
{
   registerClasses(UriTemplateResource.class);
   registerClasses(SchemaResource.class);
   register(new Feature()
   {

      @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(JacksonJaxbJsonProvider.class, MessageBodyReader.class, MessageBodyWriter.class);
         return true;
      }

   });
}
 
开发者ID:damnhandy,项目名称:Handy-URI-Templates-WebApp,代码行数:25,代码来源:UriTemplateApplication.java

示例7: DrillRestServer

import org.glassfish.jersey.CommonProperties; //导入依赖的package包/类
public DrillRestServer(final WorkManager workManager) {
  register(DrillRoot.class);
  register(StatusResources.class);
  register(StorageResources.class);
  register(ProfileResources.class);
  register(QueryResources.class);
  register(MetricsResources.class);
  register(ThreadsResources.class);
  register(FreemarkerMvcFeature.class);
  register(MultiPartFeature.class);
  property(ServerProperties.METAINF_SERVICES_LOOKUP_DISABLE, true);


  //disable moxy so it doesn't conflict with jackson.
  final String disableMoxy = PropertiesHelper.getPropertyNameForRuntime(CommonProperties.MOXY_JSON_FEATURE_DISABLE, getConfiguration().getRuntimeType());
  property(disableMoxy, true);

  register(JsonParseExceptionMapper.class);
  register(JsonMappingExceptionMapper.class);
  register(GenericExceptionMapper.class);

  JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider();
  provider.setMapper(workManager.getContext().getConfig().getMapper());
  register(provider);

  register(new AbstractBinder() {
    @Override
    protected void configure() {
      bind(workManager).to(WorkManager.class);
      bind(workManager.getContext().getConfig().getMapper()).to(ObjectMapper.class);
      bind(workManager.getContext().getPersistentStoreProvider()).to(PStoreProvider.class);
      bind(workManager.getContext().getStorage()).to(StoragePluginRegistry.class);
    }
  });
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:36,代码来源:DrillRestServer.java

示例8: 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

示例9: init

import org.glassfish.jersey.CommonProperties; //导入依赖的package包/类
protected void init(ScanResult result) {
  // FILTERS
  register(JSONPrettyPrintFilter.class);
  register(MediaTypeFilter.class);

  // RESOURCES
  for (Class<?> resource : result.getAnnotatedClasses(APIResource.class)) {
    register(resource);
  }

  // FEATURES
  register(DACAuthFilterFeature.class);
  register(DACJacksonJaxbJsonFeature.class);
  register(DACExceptionMapperFeature.class);

  // EXCEPTION MAPPERS
  register(JsonParseExceptionMapper.class);
  register(JsonMappingExceptionMapper.class);

  // PROPERTIES
  property(ServerProperties.METAINF_SERVICES_LOOKUP_DISABLE, true);
  property(ServerProperties.RESPONSE_SET_STATUS_OVER_SEND_ERROR, "true");

  final String disableMoxy = PropertiesHelper.getPropertyNameForRuntime(CommonProperties.MOXY_JSON_FEATURE_DISABLE,
    getConfiguration().getRuntimeType());
  property(disableMoxy, true);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:28,代码来源:APIServer.java

示例10: configureFramework

import org.glassfish.jersey.CommonProperties; //导入依赖的package包/类
public Config configureFramework() {
    property(CommonProperties.FEATURE_AUTO_DISCOVERY_DISABLE, true);
    register(JacksonJaxbJsonProvider.class, MessageBodyReader.class, MessageBodyWriter.class);
    register(MultiPartFeature.class);

    return this;
}
 
开发者ID:coding4people,项目名称:mosquito-report-api,代码行数:8,代码来源:Config.java

示例11: configure

import org.glassfish.jersey.CommonProperties; //导入依赖的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

示例12: 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

示例13: configure

import org.glassfish.jersey.CommonProperties; //导入依赖的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

示例14: initializeJerseyApplication

import org.glassfish.jersey.CommonProperties; //导入依赖的package包/类
private void initializeJerseyApplication(String applicationName, ClassLoader classLoader, Validator validator, ObjectMapper mapper, ResourceConfig resourceConfig, HttpConfiguration configuration) {
    // set our name
    resourceConfig.setApplicationName(applicationName);

    // set the class-loader to be the system-wide class loader
    resourceConfig.setClassLoader(classLoader);

    // set default properties
    resourceConfig.addProperties(ImmutableMap.of(
                    CommonProperties.METAINF_SERVICES_LOOKUP_DISABLE, true,
                    ServerProperties.WADL_FEATURE_DISABLE, true,
                    ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true)
    );

    // add exception mappers
    if (configuration.getUseDefaultExceptionMappers()) {
        resourceConfig.register(DefaultExceptionMapper.class);
        resourceConfig.register(AuthenticationExceptionMapper.class);
        resourceConfig.register(IllegalArgumentExceptionMapper.class);
        resourceConfig.register(JsonProcessingExceptionMapper.class);
        resourceConfig.register(ConstraintViolationExceptionMapper.class);
    }

    // add other providers
    resourceConfig.register(new ChannelIdBinder());
    resourceConfig.register(new RequestIdBinder());
    resourceConfig.register(AuthenticationFilter.class);
    resourceConfig.register(RolesAllowedDynamicFeature.class);
    resourceConfig.register(new ValidatingJacksonJaxbJsonProvider(validator, mapper, JacksonJaxbJsonProvider.DEFAULT_ANNOTATIONS));
}
 
开发者ID:redbooth,项目名称:baseline,代码行数:31,代码来源:Service.java

示例15: getProperties

import org.glassfish.jersey.CommonProperties; //导入依赖的package包/类
/**
 * Enabling tracing allows us to see how web resource names were matched from the client, in headers.
 * Disable auto-discovery of features because it's extremely obnoxious to debug and interacts
 * in confusing ways with manually registered features.
 */
// @Override
public Map<String, Object> getProperties() {
    Map<String, Object> props = Maps.newHashMap();
    props.put(ServerProperties.TRACING, Boolean.TRUE);
    props.put(CommonProperties.FEATURE_AUTO_DISCOVERY_DISABLE, Boolean.TRUE);
    return props;
}
 
开发者ID:trein,项目名称:gtfs-java,代码行数:13,代码来源:OTPApplication.java


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