Java 类org.glassfish.jersey.server.internal.inject.ConfiguredValidator 实例源码

项目:rx-jersey    文件:RxMethodDispatcherProvider.java   
/**
 * Creates new {@link RxMethodDispatcher} if return type is in {@link RxMethodDispatcherProvider#allowedTypes}<br>
 * Original {@link ResourceMethodDispatcher} will be provided to created method dispatcher
 *
 * @param method    the invocable resource method.
 * @param handler   invocation handler to be used for the resource method invocation.
 * @param validator configured validator to be used for validation during resource method invocation
 * @return {@link RxMethodDispatcher}, or {@code null} if it could not be created for the given resource method.
 */
@Override
public ResourceMethodDispatcher create(Invocable method, InvocationHandler handler, ConfiguredValidator validator) {

    final Class<?> returnType = method.getHandlingMethod().getReturnType();
    if (!allowedTypes.contains(returnType)) {
        return null;
    }

    for (ResourceMethodDispatcher.Provider provider : providers) {
        ResourceMethodDispatcher dispatcher = provider.create(method, handler, validator);
        if (dispatcher != null) {
            dispatcher = create(dispatcher);
            serviceLocator.inject(dispatcher);
            return dispatcher;
        }
    }

    return null;
}
项目:micro-server    文件:AsyncDispatcher.java   
@Override
public ResourceMethodDispatcher create(Invocable method, InvocationHandler handler, ConfiguredValidator validator) {
    final Class<?> returnType = method.getHandlingMethod().getReturnType();
    if(Publisher.class.isAssignableFrom(returnType) & !Collection.class.isAssignableFrom(returnType)){
       Set<Provider> providers = serviceLocator.getAllServiceHandles(ResourceMethodDispatcher.Provider.class)
                                               .stream()
                                               .filter(h->!h.getActiveDescriptor()
                                                       .getImplementationClass()
                                                       .equals(AsyncDispatcherProvider.class))
                                                 .map(ServiceHandle::getService)
                                                 .collect(Collectors.toSet());

        for (ResourceMethodDispatcher.Provider provider : providers) {
            ResourceMethodDispatcher dispatcher = provider.create(method, handler, validator);
            if (dispatcher != null) {
                AsyncDispatcher result = new AsyncDispatcher(dispatcher);
                serviceLocator.inject(result);
                return result;
            }
        }

    }
    return null;
}
项目:ameba    文件:TemplateModelProcessor.java   
/**
 * Create a {@code TemplateModelProcessor} instance.
 *
 * @param resourceContext         (injected) resource context.
 * @param extendedUriInfoProvider (injected) extended uri info provider.
 */
@Inject
TemplateModelProcessor(final ResourceContext resourceContext,
                       final Provider<ConfiguredValidator> validatorProvider,
                       final Provider<ExtendedUriInfo> extendedUriInfoProvider) {
    this.resourceContext = resourceContext;
    this.validatorProvider = validatorProvider;
    this.extendedUriInfoProvider = extendedUriInfoProvider;
}
项目:ameba    文件:TemplateModelProcessor.java   
@Override
public Response apply(ContainerRequestContext requestContext) {
    final List<String> templateNames = getTemplateNames(requestContext);
    final Object model = getModel(extendedUriInfoProvider.get());

    // Validate resource class.
    final ConfiguredValidator validator = validatorProvider.get();
    if (validator != null) {
        validator.validateResourceAndInputParams(model, null, null);
    }

    return Response.ok().entity(new ImplicitViewable(templateNames, model, resourceClass)).build();
}