本文整理汇总了Java中javax.ws.rs.core.Feature.configure方法的典型用法代码示例。如果您正苦于以下问题:Java Feature.configure方法的具体用法?Java Feature.configure怎么用?Java Feature.configure使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.ws.rs.core.Feature
的用法示例。
在下文中一共展示了Feature.configure方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configure
import javax.ws.rs.core.Feature; //导入方法依赖的package包/类
@Test
public void configure() throws Exception {
Feature feature = new BoundWebResourcesFeature(injector);
feature.configure(featureContext);
Mockito.verify(featureContext, Mockito.times(2)).register(Matchers.any(Object.class));
}
示例2: configure
import javax.ws.rs.core.Feature; //导入方法依赖的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;
}
示例3: testMapException_Standard
import javax.ws.rs.core.Feature; //导入方法依赖的package包/类
@Test
public void testMapException_Standard() {
LinkRestBuilder builder = new LinkRestBuilder();
Feature f = builder.build();
FeatureContext context = mock(FeatureContext.class);
f.configure(context);
verify(context).register(ValidationExceptionMapper.class);
}
示例4: testMapException_Custom
import javax.ws.rs.core.Feature; //导入方法依赖的package包/类
@Test
public void testMapException_Custom() {
LinkRestBuilder builder = new LinkRestBuilder().mapException(TestValidationExceptionMapper.class);
Feature f = builder.build();
FeatureContext context = mock(FeatureContext.class);
f.configure(context);
verify(context).register(TestValidationExceptionMapper.class);
verify(context, never()).register(ValidationExceptionMapper.class);
}