@Override protected Function<ContainerRequest, SseEventSink> createValueProvider(Parameter parameter) { if (parameter == null) { return null; } final Class<?> rawParameterType = parameter.getRawType(); if (rawParameterType == SseEventSink.class && parameter.isAnnotationPresent(Context.class)) { return new SseEventSinkValueSupplier(asyncContextSupplier); } return null; }
@Nullable @Override protected Function<ContainerRequest, ?> createValueProvider(Parameter parameter) { if (!parameter.isAnnotationPresent(Auth.class)) { return null; } else if (principalClassSet.contains(parameter.getRawType())) { return request -> new PrincipalContainerRequestValueFactory(request).provide(); } else { final boolean isOptionalPrincipal = parameter.getRawType() == Optional.class && ParameterizedType.class.isAssignableFrom(parameter.getType().getClass()) && principalClassSet.contains(((ParameterizedType) parameter.getType()).getActualTypeArguments()[0]); return isOptionalPrincipal ? request -> new OptionalPrincipalContainerRequestValueFactory(request).provide() : null; } }
final List<Class<?>[]> groups = new ArrayList<>(); for (Parameter parameter : invocable.getParameters()) { if (parameter.isAnnotationPresent(Validated.class)) { groups.add(parameter.getAnnotation(Validated.class).value());
@Nullable @Override protected Function<ContainerRequest, ?> createValueProvider(Parameter parameter) { if (!parameter.isAnnotationPresent(Auth.class)) { return null; } else if (principalClass.equals(parameter.getRawType())) { return request -> new PrincipalContainerRequestValueFactory(request).provide(); } else { final boolean isOptionalPrincipal = parameter.getRawType() == Optional.class && ParameterizedType.class.isAssignableFrom(parameter.getType().getClass()) && principalClass == ((ParameterizedType) parameter.getType()).getActualTypeArguments()[0]; return isOptionalPrincipal ? request -> new OptionalPrincipalContainerRequestValueFactory(request).provide() : null; } }
if (p.isAnnotationPresent(FormParam.class)) { Errors.fatal(method, LocalizationMessages.GET_CONSUMES_FORM_PARAM(invocable.getHandlingMethod())); break;
if (p.isAnnotationPresent(FormParam.class)) { Errors.fatal(method, LocalizationMessages.GET_CONSUMES_FORM_PARAM(invocable.getHandlingMethod())); break;
if (p.isAnnotationPresent(FormParam.class)) { Errors.fatal(method, LocalizationMessages.GET_CONSUMES_FORM_PARAM(invocable.getHandlingMethod())); break;
@Override public boolean apply(@Nullable Parameter input) { return input.isAnnotationPresent(FormDataParam.class) && input.getRawType() != FormDataContentDisposition.class; } });
@Override public boolean apply(@Nullable Parameter input) { return input.isAnnotationPresent(FormDataParam.class) && input.getRawType() != FormDataContentDisposition.class; } });
@Override public boolean apply(@Nullable Parameter input) { return input.isAnnotationPresent(FormDataParam.class) && input.getRawType() != FormDataContentDisposition.class; } });
private Map<String, Boolean> getRequestParameters(ResourceMethod method) { Map<String, Boolean> requestParameters = new LinkedHashMap<>(); method.getInvocable().getParameters().forEach(parameter -> { if (parameter.isAnnotationPresent(QueryParam.class)) { QueryParam annotation = parameter.getAnnotation(QueryParam.class); requestParameters.put("method.request.querystring." + annotation.value(), true); } if (parameter.isAnnotationPresent(HeaderParam.class)) { HeaderParam annotation = parameter.getAnnotation(HeaderParam.class); requestParameters.put("method.request.header." + annotation.value(), true); } if (parameter.isAnnotationPresent(PathParam.class)) { PathParam annotation = parameter.getAnnotation(PathParam.class); requestParameters.put("method.request.path." + annotation.value(), true); } }); return requestParameters; }
final ImmutableList.Builder<Class<?>[]> builder = ImmutableList.builder(); for (Parameter parameter : invocable.getParameters()) { if (parameter.isAnnotationPresent(Validated.class)) { builder.add(parameter.getAnnotation(Validated.class).value());
/** * Return a factory for the provided parameter. We only expect objects of * the type {@link T} being annotated with {@link Auth} annotation. * * @param parameter parameter that was annotated for being injected * @return the factory if annotated parameter matched type */ @Override @Nullable public AbstractContainerRequestValueFactory<?> createValueFactory(Parameter parameter) { if (!parameter.isAnnotationPresent(Auth.class)) { return null; } else if (principalClassSet.contains(parameter.getRawType())) { return new PrincipalContainerRequestValueFactory(); } else { final boolean isOptionalPrincipal = parameter.getRawType() == Optional.class && ParameterizedType.class.isAssignableFrom(parameter.getType().getClass()) && principalClassSet.contains(((ParameterizedType) parameter.getType()).getActualTypeArguments()[0]); return isOptionalPrincipal ? new OptionalPrincipalContainerRequestValueFactory() : null; } }
@Override protected Factory<?> createValueFactory(Parameter parameter) { if (parameter.isAnnotationPresent(Pac4JProfileManager.class)) { if (ProfileManager.class.isAssignableFrom(parameter.getRawType())) { return manager.get(); } throw new IllegalStateException("Cannot inject a Pac4J profile manager into a parameter of type " + parameter.getRawType().getName()); } if (parameter.isAnnotationPresent(Pac4JProfile.class)) { if (CommonProfile.class.isAssignableFrom(parameter.getRawType())) { return profile.get(); } if (Optional.class.isAssignableFrom(parameter.getRawType())) { List<ClassTypePair> ctps = ReflectionHelper.getTypeArgumentAndClass(parameter.getRawType()); ClassTypePair ctp = (ctps.size() == 1) ? ctps.get(0) : null; if (ctp == null || CommonProfile.class.isAssignableFrom(ctp.rawClass())) { return optProfile.get(); } } throw new IllegalStateException( "Cannot inject a Pac4J profile into a parameter of type " + parameter.getRawType().getName()); } return null; } }
private Map<String, String> getRequestParametersIntegration(ResourceMethod method) { Map<String, String> requestParameters = new LinkedHashMap<>(); method.getInvocable().getParameters().forEach(parameter -> { /** * Path parameter */ if (parameter.isAnnotationPresent(PathParam.class)) { PathParam annotation = parameter.getAnnotation(PathParam.class); requestParameters.put("integration.request.path." + annotation.value(), "method.request.path." + annotation.value()); } /** * Query parameter */ if (parameter.isAnnotationPresent(QueryParam.class)) { QueryParam annotation = parameter.getAnnotation(QueryParam.class); requestParameters.put("integration.request.querystring." + annotation.value(), "method.request.querystring." + annotation.value()); } /** * Header parameter */ if (parameter.isAnnotationPresent(HeaderParam.class)) { HeaderParam annotation = parameter.getAnnotation(HeaderParam.class); requestParameters.put("integration.request.header." + annotation.value(), "method.request.header." + annotation.value()); } }); return requestParameters; }
@Override protected Function<ContainerRequest, ?> createValueProvider(Parameter parameter) { if (parameter.isAnnotationPresent(Pac4JProfileManager.class)) { if (ProfileManager.class.isAssignableFrom(parameter.getRawType())) { return manager.get(); } throw new IllegalStateException("Cannot inject a Pac4J profile manager into a parameter of type " + parameter.getRawType().getName()); } if (parameter.isAnnotationPresent(Pac4JProfile.class)) { if (CommonProfile.class.isAssignableFrom(parameter.getRawType())) { return profile.get(); } if (Optional.class.isAssignableFrom(parameter.getRawType())) { List<ClassTypePair> ctps = ReflectionHelper.getTypeArgumentAndClass(parameter.getRawType()); ClassTypePair ctp = (ctps.size() == 1) ? ctps.get(0) : null; if (ctp == null || CommonProfile.class.isAssignableFrom(ctp.rawClass())) { return optProfile.get(); } } throw new IllegalStateException( "Cannot inject a Pac4J profile into a parameter of type " + parameter.getRawType().getName()); } return null; } }
/** * Return a factory for the provided parameter. We only expect objects of * the type {@link T} being annotated with {@link Auth} annotation. * * @param parameter parameter that was annotated for being injected * @return the factory if annotated parameter matched type */ @Override @Nullable public AbstractContainerRequestValueFactory<?> createValueFactory(Parameter parameter) { if (!parameter.isAnnotationPresent(Auth.class)) { return null; } else if (principalClass.equals(parameter.getRawType())) { return new PrincipalContainerRequestValueFactory(); } else { final boolean isOptionalPrincipal = parameter.getRawType() == Optional.class && ParameterizedType.class.isAssignableFrom(parameter.getType().getClass()) && principalClass == ((ParameterizedType) parameter.getType()).getActualTypeArguments()[0]; return isOptionalPrincipal ? new OptionalPrincipalContainerRequestValueFactory() : null; } }
@Override protected Factory<?> createValueFactory(Parameter parameter) { if (parameter.isAnnotationPresent(Pac4JProfileManager.class)) { if (ProfileManager.class.isAssignableFrom(parameter.getRawType())) { return manager.get(); } throw new IllegalStateException("Cannot inject a Pac4J profile manager into a parameter of type " + parameter.getRawType().getName()); } if (parameter.isAnnotationPresent(Pac4JProfile.class)) { if (CommonProfile.class.isAssignableFrom(parameter.getRawType())) { return profile.get(); } if (Optional.class.isAssignableFrom(parameter.getRawType())) { List<ClassTypePair> ctps = ReflectionHelper.getTypeArgumentAndClass(parameter.getRawType()); ClassTypePair ctp = (ctps.size() == 1) ? ctps.get(0) : null; if (ctp == null || CommonProfile.class.isAssignableFrom(ctp.rawClass())) { return optProfile.get(); } } throw new IllegalStateException( "Cannot inject a Pac4J profile into a parameter of type " + parameter.getRawType().getName()); } return null; } }
@Override protected Function<ContainerRequest, ?> createValueProvider(Parameter parameter) { if (parameter.isAnnotationPresent(Pac4JProfileManager.class)) { if (ProfileManager.class.isAssignableFrom(parameter.getRawType())) { return manager.get(); } throw new IllegalStateException("Cannot inject a Pac4J profile manager into a parameter of type " + parameter.getRawType().getName()); } if (parameter.isAnnotationPresent(Pac4JProfile.class)) { if (CommonProfile.class.isAssignableFrom(parameter.getRawType())) { return profile.get(); } if (Optional.class.isAssignableFrom(parameter.getRawType())) { List<ClassTypePair> ctps = ReflectionHelper.getTypeArgumentAndClass(parameter.getRawType()); ClassTypePair ctp = (ctps.size() == 1) ? ctps.get(0) : null; if (ctp == null || CommonProfile.class.isAssignableFrom(ctp.rawClass())) { return optProfile.get(); } } throw new IllegalStateException( "Cannot inject a Pac4J profile into a parameter of type " + parameter.getRawType().getName()); } return null; } }
if (p.isAnnotationPresent(FormParam.class)) { Errors.fatal(method, LocalizationMessages.GET_CONSUMES_FORM_PARAM(invocable.getHandlingMethod())); break;