當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。