Refine search
private static Optional<UnitOfWork> registerUnitOfWorkAnnotations(ResourceMethod method) { UnitOfWork annotation = method.getInvocable().getDefinitionMethod().getAnnotation(UnitOfWork.class); if (annotation == null) { annotation = method.getInvocable().getHandlingMethod().getAnnotation(UnitOfWork.class); } return Optional.ofNullable(annotation); } }
@Override public String toString() { return method.getInvocable().getHandlingMethod().toString(); } }
@Override public String toString() { return method.getInvocable().getHandlingMethod().toString(); } }
@Override public String getDeclaringClassName() { return this.resourceMethod.getInvocable().getHandlingMethod().getDeclaringClass().getName(); }
@Override public String getDeclaringClassName() { return this.resourceMethod.getInvocable().getHandlingMethod().getDeclaringClass().getName(); }
@Override public void pushMatchedLocator(final ResourceMethod resourceLocator) { tracingLogger.log(ServerTraceEvent.MATCH_LOCATOR, resourceLocator.getInvocable().getHandlingMethod()); matchedLocators.push(resourceLocator); }
@Override public void pushMatchedLocator(final ResourceMethod resourceLocator) { tracingLogger.log(ServerTraceEvent.MATCH_LOCATOR, resourceLocator.getInvocable().getHandlingMethod()); matchedLocators.push(resourceLocator); }
@Override public void setMatchedResourceMethod(final ResourceMethod resourceMethod) { tracingLogger.log(ServerTraceEvent.MATCH_RESOURCE_METHOD, resourceMethod.getInvocable().getHandlingMethod()); this.matchedResourceMethod = resourceMethod; }
@Override public void setMatchedResourceMethod(final ResourceMethod resourceMethod) { tracingLogger.log(ServerTraceEvent.MATCH_RESOURCE_METHOD, resourceMethod.getInvocable().getHandlingMethod()); this.matchedResourceMethod = resourceMethod; }
private void checkValueProviders(ResourceMethod method) { List<? extends Function<ContainerRequest, ?>> valueProviders = ParameterValueHelper.createValueProviders(valueParamProviders, method.getInvocable()); if (valueProviders.contains(null)) { int index = valueProviders.indexOf(null); Errors.fatal(method, LocalizationMessages.ERROR_PARAMETER_MISSING_VALUE_PROVIDER(index, method.getInvocable() .getHandlingMethod())); } }
private void checkValueProviders(ResourceMethod method) { List<? extends Function<ContainerRequest, ?>> valueProviders = ParameterValueHelper.createValueProviders(valueParamProviders, method.getInvocable()); if (valueProviders.contains(null)) { int index = valueProviders.indexOf(null); Errors.fatal(method, LocalizationMessages.ERROR_PARAMETER_MISSING_VALUE_PROVIDER(index, method.getInvocable() .getHandlingMethod())); } }
private void checkUnexpectedAnnotations(ResourceMethod resourceMethod) { Invocable invocable = resourceMethod.getInvocable(); for (Annotation annotation : invocable.getHandlingMethod().getDeclaredAnnotations()) { if (PARAM_ANNOTATION_SET.contains(annotation.annotationType())) { Errors.fatal(resourceMethod, LocalizationMessages.METHOD_UNEXPECTED_ANNOTATION( invocable.getHandlingMethod().getName(), invocable.getHandler().getHandlerClass().getName(), annotation.annotationType().getName()) ); } } }
private void checkUnexpectedAnnotations(ResourceMethod resourceMethod) { Invocable invocable = resourceMethod.getInvocable(); for (Annotation annotation : invocable.getHandlingMethod().getDeclaredAnnotations()) { if (PARAM_ANNOTATION_SET.contains(annotation.annotationType())) { Errors.fatal(resourceMethod, LocalizationMessages.METHOD_UNEXPECTED_ANNOTATION( invocable.getHandlingMethod().getName(), invocable.getHandler().getHandlerClass().getName(), annotation.annotationType().getName()) ); } } }
private List<MediaType> getEffectiveOutputTypes(final ResourceMethod resourceMethod) { if (!resourceMethod.getProducedTypes().isEmpty()) { return resourceMethod.getProducedTypes(); } List<MediaType> result = new LinkedList<>(); if (workers != null) { final Invocable invocable = resourceMethod.getInvocable(); result.addAll(workers.getMessageBodyWriterMediaTypes( invocable.getRawResponseType(), invocable.getResponseType(), invocable.getHandlingMethod().getAnnotations())); } return result.isEmpty() ? StarTypeList : result; }
private List<MediaType> getEffectiveOutputTypes(final ResourceMethod resourceMethod) { if (!resourceMethod.getProducedTypes().isEmpty()) { return resourceMethod.getProducedTypes(); } List<MediaType> result = new LinkedList<>(); if (workers != null) { final Invocable invocable = resourceMethod.getInvocable(); result.addAll(workers.getMessageBodyWriterMediaTypes( invocable.getRawResponseType(), invocable.getResponseType(), invocable.getHandlingMethod().getAnnotations())); } return result.isEmpty() ? StarTypeList : result; }
private void visitSubResourceLocator(ResourceMethod locator) { checkParameters(locator); checkValueProviders(locator); final Invocable invocable = locator.getInvocable(); if (void.class == invocable.getRawResponseType()) { Errors.fatal(locator, LocalizationMessages.SUBRES_LOC_RETURNS_VOID(invocable.getHandlingMethod())); } // Prevent PARAM_ANNOTATION_SET annotations on a resource locator if (invocable.getHandlingMethod().getAnnotation(Path.class) != null) { checkUnexpectedAnnotations(locator); } }
private void visitSubResourceLocator(ResourceMethod locator) { checkParameters(locator); checkValueProviders(locator); final Invocable invocable = locator.getInvocable(); if (void.class == invocable.getRawResponseType()) { Errors.fatal(locator, LocalizationMessages.SUBRES_LOC_RETURNS_VOID(invocable.getHandlingMethod())); } // Prevent PARAM_ANNOTATION_SET annotations on a resource locator if (invocable.getHandlingMethod().getAnnotation(Path.class) != null) { checkUnexpectedAnnotations(locator); } }
/** * Get the method unique string ID. The ID is constructed from method attributes separated * by pipe '|'. The attributes are used in the following order: * method-produces|method-consumes|http-method|method-path|method-java-name * <p> * If any of the attributes is not defined, "null" is used for such an attribute. * <p/> * * @param method Resource method. * @return String constructed from resource method parameters. */ public static String getMethodUniqueId(final ResourceMethod method) { final String path = method.getParent() != null ? createPath(method.getParent()) : "null"; return method.getProducedTypes().toString() + "|" + method.getConsumedTypes().toString() + "|" + method.getHttpMethod() + "|" + path + "|" + method.getInvocable().getHandlingMethod().getName(); }
/** * Get the method unique string ID. The ID is constructed from method attributes separated * by pipe '|'. The attributes are used in the following order: * method-produces|method-consumes|http-method|method-path|method-java-name * <p> * If any of the attributes is not defined, "null" is used for such an attribute. * <p/> * * @param method Resource method. * @return String constructed from resource method parameters. */ public static String getMethodUniqueId(final ResourceMethod method) { final String path = method.getParent() != null ? createPath(method.getParent()) : "null"; return method.getProducedTypes().toString() + "|" + method.getConsumedTypes().toString() + "|" + method.getHttpMethod() + "|" + path + "|" + method.getInvocable().getHandlingMethod().getName(); }
private void checkParameters(ResourceMethod method) { final Invocable invocable = method.getInvocable(); final Method handlingMethod = invocable.getHandlingMethod(); int paramCount = 0; int nonAnnotatedParameters = 0; for (Parameter p : invocable.getParameters()) { validateParameter(p, handlingMethod, handlingMethod.toGenericString(), Integer.toString(++paramCount), false); if (method.getType() == ResourceMethod.JaxrsType.SUB_RESOURCE_LOCATOR && Parameter.Source.ENTITY == p.getSource()) { Errors.fatal(method, LocalizationMessages.SUBRES_LOC_HAS_ENTITY_PARAM(invocable.getHandlingMethod())); } else if (p.getAnnotations().length == 0) { nonAnnotatedParameters++; if (nonAnnotatedParameters > 1) { Errors.fatal(method, LocalizationMessages.AMBIGUOUS_NON_ANNOTATED_PARAMETER(invocable.getHandlingMethod(), invocable.getHandlingMethod().getDeclaringClass())); } } } }