Search in sources :

Example 6 with DiscoveredOperationMethod

use of org.springframework.boot.actuate.endpoint.annotation.DiscoveredOperationMethod in project spring-boot by spring-projects.

the class RequestPredicateFactory method getRequestPredicate.

WebOperationRequestPredicate getRequestPredicate(String rootPath, DiscoveredOperationMethod operationMethod) {
    Method method = operationMethod.getMethod();
    Parameter[] selectorParameters = Arrays.stream(method.getParameters()).filter(this::hasSelector).toArray(Parameter[]::new);
    Parameter allRemainingPathSegmentsParameter = getAllRemainingPathSegmentsParameter(selectorParameters);
    String path = getPath(rootPath, selectorParameters, allRemainingPathSegmentsParameter != null);
    WebEndpointHttpMethod httpMethod = determineHttpMethod(operationMethod.getOperationType());
    Collection<String> consumes = getConsumes(httpMethod, method);
    Collection<String> produces = getProduces(operationMethod, method);
    return new WebOperationRequestPredicate(path, httpMethod, consumes, produces);
}
Also used : WebOperationRequestPredicate(org.springframework.boot.actuate.endpoint.web.WebOperationRequestPredicate) Parameter(java.lang.reflect.Parameter) DiscoveredOperationMethod(org.springframework.boot.actuate.endpoint.annotation.DiscoveredOperationMethod) WebEndpointHttpMethod(org.springframework.boot.actuate.endpoint.web.WebEndpointHttpMethod) Method(java.lang.reflect.Method) WebEndpointHttpMethod(org.springframework.boot.actuate.endpoint.web.WebEndpointHttpMethod)

Aggregations

DiscoveredOperationMethod (org.springframework.boot.actuate.endpoint.annotation.DiscoveredOperationMethod)6 Method (java.lang.reflect.Method)3 Test (org.junit.jupiter.api.Test)3 WebOperationRequestPredicate (org.springframework.boot.actuate.endpoint.web.WebOperationRequestPredicate)2 AnnotationAttributes (org.springframework.core.annotation.AnnotationAttributes)2 Parameter (java.lang.reflect.Parameter)1 OperationInvoker (org.springframework.boot.actuate.endpoint.invoke.OperationInvoker)1 WebEndpointHttpMethod (org.springframework.boot.actuate.endpoint.web.WebEndpointHttpMethod)1