Search in sources :

Example 1 with WebEndpointHttpMethod

use of org.springframework.boot.actuate.endpoint.web.WebEndpointHttpMethod 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

Method (java.lang.reflect.Method)1 Parameter (java.lang.reflect.Parameter)1 DiscoveredOperationMethod (org.springframework.boot.actuate.endpoint.annotation.DiscoveredOperationMethod)1 WebEndpointHttpMethod (org.springframework.boot.actuate.endpoint.web.WebEndpointHttpMethod)1 WebOperationRequestPredicate (org.springframework.boot.actuate.endpoint.web.WebOperationRequestPredicate)1