本文整理匯總了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);
}