本文整理汇总了Java中javax.ws.rs.Priorities类的典型用法代码示例。如果您正苦于以下问题:Java Priorities类的具体用法?Java Priorities怎么用?Java Priorities使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Priorities类属于javax.ws.rs包,在下文中一共展示了Priorities类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configure
import javax.ws.rs.Priorities; //导入依赖的package包/类
@Override
public void configure(FeatureContext context) {
final int priorityInc = 3000;
// Jersey MOXY provider have higher priority(7000), so we need set higher than it
int priority = Priorities.USER + priorityInc;
Configuration config = context.getConfiguration();
if (!config.isRegistered(ParsecValidationExceptionMapper.class)) {
context.register(ParsecValidationExceptionMapper.class, priority);
}
if (!config.isRegistered(ValidationConfigurationContextResolver.class)) {
context.register(ValidationConfigurationContextResolver.class, priority);
}
if (!config.isRegistered(ParsecMoxyProvider.class)) {
context.register(ParsecMoxyProvider.class, priority);
}
if (!config.isRegistered(JaxbExceptionMapper.class)) {
context.register(JaxbExceptionMapper.class, priority);
}
}
示例2: configure
import javax.ws.rs.Priorities; //导入依赖的package包/类
@Override
public void configure(ResourceInfo resourceInfo, FeatureContext context) {
List<Annotation> authzSpecs = new ArrayList<>();
for (Class<? extends Annotation> annotationClass : shiroAnnotations) {
// XXX What is the performance of getAnnotation vs getAnnotations?
Annotation classAuthzSpec = resourceInfo.getResourceClass().getAnnotation(annotationClass);
Annotation methodAuthzSpec = resourceInfo.getResourceMethod().getAnnotation(annotationClass);
if (classAuthzSpec != null) authzSpecs.add(classAuthzSpec);
if (methodAuthzSpec != null) authzSpecs.add(methodAuthzSpec);
}
if (!authzSpecs.isEmpty()) {
context.register(new AuthorizationFilter(authzSpecs), Priorities.AUTHORIZATION);
}
}
示例3: configure
import javax.ws.rs.Priorities; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public boolean configure(FeatureContext context) {
Configuration configuration = context.getConfiguration();
if (!configuration.isRegistered(UriConnegFilter.class)) {
context.register(UriConnegFilter.class, Priorities.AUTHENTICATION - 100);
}
if (!context.getConfiguration().isRegistered(DownloadEntityFilter.class)) {
context.register(DownloadEntityFilter.class);
}
if (!configuration.isRegistered(LoadBalancerRequestFilter.class)) {
context.register(LoadBalancerRequestFilter.class);
}
return true;
}
示例4: configure
import javax.ws.rs.Priorities; //导入依赖的package包/类
@Override
public void configure(ResourceInfo resourceInfo, FeatureContext context) {
List<Annotation> authzSpecs = new ArrayList<>();
boolean canRedirect = true;
for (Class<? extends Annotation> annotationClass : filterAnnotations) {
// XXX What is the performance of getAnnotation vs getAnnotations?
Annotation classAuthzSpec = resourceInfo.getResourceClass().getAnnotation(annotationClass);
Annotation methodAuthzSpec = resourceInfo.getResourceMethod().getAnnotation(annotationClass);
if (classAuthzSpec != null) authzSpecs.add(classAuthzSpec);
if (methodAuthzSpec != null) authzSpecs.add(methodAuthzSpec);
if(resourceInfo.getResourceClass().isAnnotationPresent(NoAuthRedirect.class)
|| resourceInfo.getResourceMethod().isAnnotationPresent(NoAuthRedirect.class))
canRedirect = false;
if(resourceInfo.getResourceClass().isAnnotationPresent(NoAuthFilter.class)
|| resourceInfo.getResourceMethod().isAnnotationPresent(NoAuthFilter.class))
return;
}
if (!authzSpecs.isEmpty()) {
if(canRedirect)
context.register(new LoginRedirectFilter(), Priorities.AUTHENTICATION + 1);
context.register(new AuthorizationFilter(authzSpecs), Priorities.AUTHORIZATION);
}
}
示例5: registerAuthenticationFilters
import javax.ws.rs.Priorities; //导入依赖的package包/类
/**
* Checks if given <code>element</code> has the {@link Authenticate} annotation and if so registers the required
* authentication filters.
* @param context Feature context
* @param element Annotated element
* @return <code>true</code> if the {@link Authenticate} annotation was found and the authentication filters were
* registered, <code>false</code> otherwise
*/
private static boolean registerAuthenticationFilters(FeatureContext context, AnnotatedElement element) {
if (element.isAnnotationPresent(Authenticate.class)) {
// AuthContext setup for SecurityContext
context.register(AuthContextFilter.class, Priorities.AUTHENTICATION - 10);
// Authenticator
context.register(new AuthenticationFilter(element.getAnnotation(Authenticate.class).schemes()),
Priorities.AUTHENTICATION);
return true;
}
return false;
}
示例6: configure
import javax.ws.rs.Priorities; //导入依赖的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;
}
示例7: testAnnotations
import javax.ws.rs.Priorities; //导入依赖的package包/类
@Test
public void testAnnotations() {
// Check that the class is correctly annotated
assertNotNull("@PreMatching annotation is required to modify headers", MediaTypeFilter.class.getAnnotation(PreMatching.class));
Priority priority = MediaTypeFilter.class.getAnnotation(Priority.class);
assertNotNull("@Priority annotation is required to modify headers", priority);
assertTrue("priority should be higher than HEADER_DECORATOR", priority.value() <= Priorities.HEADER_DECORATOR);
}
示例8: configure
import javax.ws.rs.Priorities; //导入依赖的package包/类
@Override
public void configure(ResourceInfo resourceInfo, FeatureContext context) {
context.register(new ContainerRequestFilter() {
@Override
public void filter(ContainerRequestContext requestContext) throws IOException {
if (requestContext.getUriInfo().getPath().endsWith("filtered")) {
throw new ForbiddenException();
}
}
}, Priorities.AUTHORIZATION);
}
示例9: Builder
import javax.ws.rs.Priorities; //导入依赖的package包/类
public Builder(Tracer tracer) {
this.tracer = tracer;
this.spanDecorators = Collections.singletonList(ClientSpanDecorator.STANDARD_TAGS);
this.serializationSpanDecorators = Arrays.asList(InterceptorSpanDecorator.STANDARD_TAGS);
// by default do not use Priorities.AUTHENTICATION due to security concerns
this.priority = Priorities.HEADER_DECORATOR;
this.serializationPriority = Priorities.ENTITY_CODER;
this.traceSerialization = true;
}
示例10: Builder
import javax.ws.rs.Priorities; //导入依赖的package包/类
public Builder(Tracer tracer) {
this.tracer = tracer;
this.spanDecorators = Collections.singletonList(ServerSpanDecorator.STANDARD_TAGS);
this.serializationSpanDecorators = Collections.singletonList(InterceptorSpanDecorator.STANDARD_TAGS);
// by default do not use Priorities.AUTHENTICATION due to security concerns
this.priority = Priorities.HEADER_DECORATOR;
this.serializationPriority = Priorities.ENTITY_CODER;
this.allTraced = true;
this.operationNameBuilder = WildcardOperationName.newBuilder();
this.traceSerialization = true;
}
示例11: getPriority
import javax.ws.rs.Priorities; //导入依赖的package包/类
@Override
public int getPriority() {
return Priorities.USER + 1;
}
开发者ID:eclipse,项目名称:microprofile-rest-client,代码行数:5,代码来源:TestResponseExceptionMapperOverridePriority.java