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


Java ContainerRequestFilter类代码示例

本文整理汇总了Java中javax.ws.rs.container.ContainerRequestFilter的典型用法代码示例。如果您正苦于以下问题:Java ContainerRequestFilter类的具体用法?Java ContainerRequestFilter怎么用?Java ContainerRequestFilter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ContainerRequestFilter类属于javax.ws.rs.container包,在下文中一共展示了ContainerRequestFilter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: RequestHandler

import javax.ws.rs.container.ContainerRequestFilter; //导入依赖的package包/类
public RequestHandler() {
	// configure the application with the resource
	ResourceConfig config = new ResourceConfig()
			.register(GatewayFeature.class)
			.packages("com.jrestless.aws.examples")
			.register(ApplicationExceptionMapper.class)
			// auto-discovery works, too
			// .register(GlobalExceptionMapper.class)
			.register(new ContainerRequestFilter() {
				@Override
				public void filter(ContainerRequestContext request) throws IOException {
					LOG.info("baseUri: " + request.getUriInfo().getBaseUri());
					LOG.info("requestUri: " + request.getUriInfo().getRequestUri());
				}
			});
	init(config);
	start();
}
 
开发者ID:bbilger,项目名称:jrestless-examples,代码行数:19,代码来源:RequestHandler.java

示例2: configure

import javax.ws.rs.container.ContainerRequestFilter; //导入依赖的package包/类
@Override
protected Application configure() {
    enable(TestProperties.LOG_TRAFFIC);
    ResourceConfig config = new ResourceConfig();
    config.register(LocaleContextFilter.class, 1);
    config.register(new ContainerRequestFilter() {

        @Override
        public void filter(ContainerRequestContext requestContext) throws IOException {
            called.incrementAndGet();
            locale = LocaleContextKeeper.getLocale();
        }

    }, 2);
    config.register(TestResource.class);
    return config;
}
 
开发者ID:ctc-g,项目名称:sinavi-jfw,代码行数:18,代码来源:LocaleContextFilterTest.java

示例3: build

import javax.ws.rs.container.ContainerRequestFilter; //导入依赖的package包/类
public static <F,T> ContainerRequestFilter build(
        final ContainerRequestPredicate predicate,
        final Function<ContainerRequestContext, F> extractData,
        final Function<F,T> transform,
        final Function<ContainerRequestContext, DateTime> determineTimestamp,
        final WritingWorkerManager<T> writingWorkerManager,
        final boolean skipNulls)
{
    final Recorder<ContainerRequestContext> recorder = new BasicRecorder<>(
            predicate,
            extractData,
            transform,
            determineTimestamp,
            writingWorkerManager,
            skipNulls
    );
    return new ContainerRequestFilter() {
        @Override
        public void filter(ContainerRequestContext requestContext) {
            recorder.record(requestContext);
        }
    };
}
 
开发者ID:Multifarious,项目名称:skid-road,代码行数:24,代码来源:RecorderFilterFactory.java

示例4: registerFilter

import javax.ws.rs.container.ContainerRequestFilter; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void registerFilter(final Class<?> c) {
    if (ContainerRequestFilter.class.isAssignableFrom(c)) {
        requestFilters.add((Class<? extends ContainerRequestFilter>) c);
    }

    if (ContainerResponseFilter.class.isAssignableFrom(c)) {
        responseFilters.add((Class<? extends ContainerResponseFilter>) c);
    }
}
 
开发者ID:minijax,项目名称:minijax,代码行数:11,代码来源:MinijaxApplication.java

示例5: configure

import javax.ws.rs.container.ContainerRequestFilter; //导入依赖的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

示例6: createAuthFactory

import javax.ws.rs.container.ContainerRequestFilter; //导入依赖的package包/类
/**
 * Default implementation for the Keycloak auth factory. Please provide your own if you implement
 * your own User's representation.
 *
 * @param configuration the application's configuration
 * @return Keycloak auth factory
 */
protected ContainerRequestFilter createAuthFactory(T configuration) {
    return new KeycloakAuthFilter.Builder<Principal>()
            .setConfig(getKeycloakConfiguration(configuration))
            .setAuthenticator(createAuthenticator(getKeycloakConfiguration(configuration)))
            .setAuthorizer(createAuthorizer())
            .setRealm(getRealm(configuration))
            .buildAuthFilter();
}
 
开发者ID:ahus1,项目名称:keycloak-dropwizard-integration,代码行数:16,代码来源:KeycloakBundle.java

示例7: getAuthFilter

import javax.ws.rs.container.ContainerRequestFilter; //导入依赖的package包/类
protected ContainerRequestFilter getAuthFilter() {
    BasicCredentialAuthFilter.Builder<Principal> builder = new BasicCredentialAuthFilter.Builder<>();
    builder.setAuthorizer(AuthUtil.getTestAuthorizer(ADMIN_USER, ADMIN_ROLE));
    builder.setAuthenticator(AuthUtil.getBasicAuthenticator(ImmutableList.of(ADMIN_USER, ORDINARY_USER)));
    builder.setPrefix(CUSTOM_PREFIX);
    return builder.buildAuthFilter();
}
 
开发者ID:dropwizard,项目名称:dropwizard-java8,代码行数:8,代码来源:BasicCustomAuthProviderTest.java

示例8: WSApplication

import javax.ws.rs.container.ContainerRequestFilter; //导入依赖的package包/类
/**
 * Register JAX-RS application components.
 */
public WSApplication () {
    
	// Register JAX-RS ContainerRequestFilter. 
    register(ContainerRequestFilter.class);
    
    //Register Jackson feature for JSON
    register(JacksonFeature.class);
    
    // Default test factory container
    property(TestProperties.CONTAINER_FACTORY, org.glassfish.jersey.test.grizzly.GrizzlyTestContainerFactory.class);
}
 
开发者ID:Tanaguru,项目名称:Tanaguru,代码行数:15,代码来源:WSApplication.java

示例9: isProvider

import javax.ws.rs.container.ContainerRequestFilter; //导入依赖的package包/类
private static <T> boolean isProvider(final Class<T> clazz) {
    return MessageBodyReader.class.isAssignableFrom(clazz) ||
            MessageBodyWriter.class.isAssignableFrom(clazz) ||
            ParamConverter.class.isAssignableFrom(clazz) ||
            ContainerRequestFilter.class.isAssignableFrom(clazz) ||
            ContainerResponseFilter.class.isAssignableFrom(clazz) ||
            ReaderInterceptor.class.isAssignableFrom(clazz) ||
            WriterInterceptor.class.isAssignableFrom(clazz) ||
            ParamConverterProvider.class.isAssignableFrom(clazz) ||
            ContextResolver.class.isAssignableFrom(clazz) ||
            new MetaAnnotatedClass<>(clazz).isAnnotationPresent(Provider.class);
}
 
开发者ID:apache,项目名称:tomee,代码行数:13,代码来源:RESTService.java

示例10: runRequestFilters

import javax.ws.rs.container.ContainerRequestFilter; //导入依赖的package包/类
private void runRequestFilters(final MinijaxRequestContext context) throws IOException {
    for (final Class<? extends ContainerRequestFilter> filterClass : requestFilters) {
        final ContainerRequestFilter filter = get(filterClass);
        filter.filter(context);
    }
}
 
开发者ID:minijax,项目名称:minijax,代码行数:7,代码来源:MinijaxApplication.java

示例11: requestLoggerFilter

import javax.ws.rs.container.ContainerRequestFilter; //导入依赖的package包/类
ContainerRequestFilter requestLoggerFilter() {
  return (req) -> LOGGER.info("Request: {}", req.getUriInfo().getRequestUri().getPath());
}
 
开发者ID:sorskod,项目名称:webserver,代码行数:4,代码来源:WebServerIntegrationTest.java

示例12: RegisterAuthDynamicFeature

import javax.ws.rs.container.ContainerRequestFilter; //导入依赖的package包/类
public RegisterAuthDynamicFeature(Class<? extends ContainerRequestFilter> filterClass) {
    this.filterClass = filterClass;
}
 
开发者ID:openregister,项目名称:openregister-java,代码行数:4,代码来源:RegisterAuthDynamicFeature.java

示例13: createApplicationPathFilter

import javax.ws.rs.container.ContainerRequestFilter; //导入依赖的package包/类
private static ContainerRequestFilter createApplicationPathFilter(Application app) {
	ApplicationPathFilter filter = new ApplicationPathFilter();
	filter.setApplication(app);
	return filter;
}
 
开发者ID:bbilger,项目名称:jrestless,代码行数:6,代码来源:ApplicationPathFilterTest.java

示例14: addContainerRequestFilter

import javax.ws.rs.container.ContainerRequestFilter; //导入依赖的package包/类
public void addContainerRequestFilter(ContainerRequestFilter requestFilter) {
    jerseyEndpoints.addContainerRequestFilter(requestFilter);
}
 
开发者ID:jivesoftware,项目名称:routing-bird,代码行数:4,代码来源:RestfulManageServer.java

示例15: addContainerRequestFilter

import javax.ws.rs.container.ContainerRequestFilter; //导入依赖的package包/类
public JerseyEndpoints addContainerRequestFilter(ContainerRequestFilter containerRequestFilter) {
    containerRequestFilters.add(containerRequestFilter);
    return this;
}
 
开发者ID:jivesoftware,项目名称:routing-bird,代码行数:5,代码来源:JerseyEndpoints.java


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