use of org.springframework.boot.actuate.endpoint.web.WebOperationRequestPredicate 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);
}
use of org.springframework.boot.actuate.endpoint.web.WebOperationRequestPredicate in project spring-boot by spring-projects.
the class AdditionalHealthEndpointPathsWebFluxHandlerMapping method initHandlerMethods.
@Override
protected void initHandlerMethods() {
for (WebOperation operation : this.endpoint.getOperations()) {
WebOperationRequestPredicate predicate = operation.getRequestPredicate();
String matchAllRemainingPathSegmentsVariable = predicate.getMatchAllRemainingPathSegmentsVariable();
if (matchAllRemainingPathSegmentsVariable != null) {
for (HealthEndpointGroup group : this.groups) {
AdditionalHealthEndpointPath additionalPath = group.getAdditionalPath();
if (additionalPath != null) {
RequestMappingInfo requestMappingInfo = getRequestMappingInfo(operation, additionalPath.getValue());
registerReadMapping(requestMappingInfo, this.endpoint, operation);
}
}
}
}
}
use of org.springframework.boot.actuate.endpoint.web.WebOperationRequestPredicate in project spring-boot by spring-projects.
the class AdditionalHealthEndpointPathsWebFluxHandlerMapping method getRequestMappingInfo.
private RequestMappingInfo getRequestMappingInfo(WebOperation operation, String additionalPath) {
WebOperationRequestPredicate predicate = operation.getRequestPredicate();
String path = this.endpointMapping.createSubPath(additionalPath);
RequestMethod method = RequestMethod.valueOf(predicate.getHttpMethod().name());
String[] consumes = StringUtils.toStringArray(predicate.getConsumes());
String[] produces = StringUtils.toStringArray(predicate.getProduces());
return RequestMappingInfo.paths(path).methods(method).consumes(consumes).produces(produces).build();
}
use of org.springframework.boot.actuate.endpoint.web.WebOperationRequestPredicate in project spring-boot by spring-projects.
the class AbstractWebMvcEndpointHandlerMapping method registerMappingForOperation.
private void registerMappingForOperation(ExposableWebEndpoint endpoint, WebOperation operation) {
WebOperationRequestPredicate predicate = operation.getRequestPredicate();
String path = predicate.getPath();
String matchAllRemainingPathSegmentsVariable = predicate.getMatchAllRemainingPathSegmentsVariable();
if (matchAllRemainingPathSegmentsVariable != null) {
path = path.replace("{*" + matchAllRemainingPathSegmentsVariable + "}", "**");
}
registerMapping(endpoint, predicate, operation, path);
}
Aggregations