本文整理汇总了Java中org.glassfish.jersey.internal.util.PropertiesHelper.getPropertyNameForRuntime方法的典型用法代码示例。如果您正苦于以下问题:Java PropertiesHelper.getPropertyNameForRuntime方法的具体用法?Java PropertiesHelper.getPropertyNameForRuntime怎么用?Java PropertiesHelper.getPropertyNameForRuntime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.glassfish.jersey.internal.util.PropertiesHelper
的用法示例。
在下文中一共展示了PropertiesHelper.getPropertyNameForRuntime方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: JerseyApplication
import org.glassfish.jersey.internal.util.PropertiesHelper; //导入方法依赖的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);
}
}
示例2: DrillRestServer
import org.glassfish.jersey.internal.util.PropertiesHelper; //导入方法依赖的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);
}
});
}
示例3: init
import org.glassfish.jersey.internal.util.PropertiesHelper; //导入方法依赖的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);
}
示例4: configure
import org.glassfish.jersey.internal.util.PropertiesHelper; //导入方法依赖的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;
}
示例5: init
import org.glassfish.jersey.internal.util.PropertiesHelper; //导入方法依赖的package包/类
protected void init(ScanResult result) {
// FILTERS //
register(JSONPrettyPrintFilter.class);
register(MediaTypeFilter.class);
// RESOURCES //
for (Class<?> resource : result.getAnnotatedClasses(RestResource.class)) {
register(resource);
}
// FEATURES
property(FreemarkerMvcFeature.TEMPLATE_OBJECT_FACTORY, getFreemarkerConfiguration());
register(FreemarkerMvcFeature.class);
register(MultiPartFeature.class);
register(FirstTimeFeature.class);
register(DACAuthFilterFeature.class);
register(DACExceptionMapperFeature.class);
register(DACJacksonJaxbJsonFeature.class);
register(TestResourcesFeature.class);
// LISTENERS //
register(TimingApplicationEventListener.class);
// EXCEPTION MAPPERS //
register(JsonParseExceptionMapper.class);
register(JsonMappingExceptionMapper.class);
// BODY WRITERS //
register(QlikAppMessageBodyGenerator.class);
register(TableauMessageBodyGenerator.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);
property(TableauMessageBodyGenerator.CUSTOMIZATION_ENABLED, false);
}
示例6: DrillRestServer
import org.glassfish.jersey.internal.util.PropertiesHelper; //导入方法依赖的package包/类
public DrillRestServer(final WorkManager workManager, final ServletContext servletContext, final Drillbit drillbit) {
register(DrillRoot.class);
register(StatusResources.class);
register(StorageResources.class);
register(ProfileResources.class);
register(QueryResources.class);
register(MetricsResources.class);
register(ThreadsResources.class);
register(LogsResources.class);
property(FreemarkerMvcFeature.TEMPLATE_OBJECT_FACTORY, getFreemarkerConfiguration(servletContext));
register(FreemarkerMvcFeature.class);
register(MultiPartFeature.class);
property(ServerProperties.METAINF_SERVICES_LOOKUP_DISABLE, true);
final boolean isAuthEnabled =
workManager.getContext().getConfig().getBoolean(ExecConstants.USER_AUTHENTICATION_ENABLED);
if (isAuthEnabled) {
register(LogInLogOutResources.class);
register(AuthDynamicFeature.class);
register(RolesAllowedDynamicFeature.class);
}
//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().getLpPersistence().getMapper());
register(provider);
// Get an EventExecutor out of the BitServer EventLoopGroup to notify listeners for WebUserConnection. For
// actual connections between Drillbits this EventLoopGroup is used to handle network related events. Though
// there is no actual network connection associated with WebUserConnection but we need a CloseFuture in
// WebSessionResources, so we are using EvenExecutor from network EventLoopGroup pool.
final EventExecutor executor = workManager.getContext().getBitLoopGroup().next();
register(new AbstractBinder() {
@Override
protected void configure() {
bind(drillbit).to(Drillbit.class);
bind(workManager).to(WorkManager.class);
bind(executor).to(EventExecutor.class);
bind(workManager.getContext().getLpPersistence().getMapper()).to(ObjectMapper.class);
bind(workManager.getContext().getStoreProvider()).to(PersistentStoreProvider.class);
bind(workManager.getContext().getStorage()).to(StoragePluginRegistry.class);
bind(new UserAuthEnabled(isAuthEnabled)).to(UserAuthEnabled.class);
if (isAuthEnabled) {
bindFactory(DrillUserPrincipalProvider.class).to(DrillUserPrincipal.class);
bindFactory(AuthWebUserConnectionProvider.class).to(WebUserConnection.class);
} else {
bindFactory(AnonDrillUserPrincipalProvider.class).to(DrillUserPrincipal.class);
bindFactory(AnonWebUserConnectionProvider.class).to(WebUserConnection.class);
}
}
});
}