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


Java Priorities类代码示例

本文整理汇总了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);
    }
}
 
开发者ID:yahoo,项目名称:parsec-libraries,代码行数:22,代码来源:ParsecValidationAutoDiscoverable.java

示例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);
    }
}
 
开发者ID:silb,项目名称:shiro-jersey,代码行数:19,代码来源:AuthorizationFilterFeature.java

示例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;
}
 
开发者ID:icode,项目名称:ameba,代码行数:20,代码来源:SysFilteringFeature.java

示例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);
    }
}
 
开发者ID:FroMage,项目名称:redpipe,代码行数:28,代码来源:AuthorizationFilterFeature.java

示例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;
}
 
开发者ID:holon-platform,项目名称:holon-jaxrs,代码行数:20,代码来源:AuthenticationDynamicFeature.java

示例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;
}
 
开发者ID:anton-tregubov,项目名称:javaee-design-patterns,代码行数:10,代码来源:JacksonActivator.java

示例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);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:10,代码来源:TestMediaTypeFilter.java

示例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);
}
 
开发者ID:opentracing-contrib,项目名称:java-jaxrs,代码行数:12,代码来源:InstrumentedRestApplication.java

示例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;
}
 
开发者ID:opentracing-contrib,项目名称:java-jaxrs,代码行数:10,代码来源:ClientTracingFeature.java

示例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;
}
 
开发者ID:opentracing-contrib,项目名称:java-jaxrs,代码行数:12,代码来源:ServerTracingDynamicFeature.java

示例11: getPriority

import javax.ws.rs.Priorities; //导入依赖的package包/类
@Override
public int getPriority() {
    return Priorities.USER + 1;
}
 
开发者ID:eclipse,项目名称:microprofile-rest-client,代码行数:5,代码来源:TestResponseExceptionMapperOverridePriority.java


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