use of org.springframework.boot.actuate.endpoint.web.WebOperationRequestPredicate in project spring-boot by spring-projects.
the class WebEndpointDiscoverer method createOperation.
@Override
protected WebOperation createOperation(EndpointId endpointId, DiscoveredOperationMethod operationMethod, OperationInvoker invoker) {
String rootPath = PathMapper.getRootPath(this.endpointPathMappers, endpointId);
WebOperationRequestPredicate requestPredicate = this.requestPredicateFactory.getRequestPredicate(rootPath, operationMethod);
return new DiscoveredWebOperation(endpointId, operationMethod, invoker, requestPredicate);
}
use of org.springframework.boot.actuate.endpoint.web.WebOperationRequestPredicate in project spring-boot by spring-projects.
the class AbstractWebFluxEndpointHandlerMapping method createRequestMappingInfo.
private RequestMappingInfo createRequestMappingInfo(WebOperation operation) {
WebOperationRequestPredicate predicate = operation.getRequestPredicate();
String path = this.endpointMapping.createSubPath(predicate.getPath());
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 AdditionalHealthEndpointPathsWebMvcHandlerMapping 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) {
registerMapping(this.endpoint, predicate, operation, additionalPath.getValue());
}
}
}
}
}
use of org.springframework.boot.actuate.endpoint.web.WebOperationRequestPredicate in project spring-boot by spring-projects.
the class RequestPredicateFactoryTests method getRequestPredicateReturnsPredicateWithPath.
@Test
void getRequestPredicateReturnsPredicateWithPath() {
DiscoveredOperationMethod operationMethod = getDiscoveredOperationMethod(ValidSelectors.class);
WebOperationRequestPredicate requestPredicate = this.factory.getRequestPredicate(this.rootPath, operationMethod);
assertThat(requestPredicate.getPath()).isEqualTo("/root/{one}/{*two}");
}
use of org.springframework.boot.actuate.endpoint.web.WebOperationRequestPredicate in project spring-boot by spring-projects.
the class WebEndpointDiscovererTests method getEndpointsWhenHasCustomPathShouldReturnCustomPath.
@Test
void getEndpointsWhenHasCustomPathShouldReturnCustomPath() {
load((id) -> null, (id) -> "custom/" + id, AdditionalOperationWebEndpointConfiguration.class, (discoverer) -> {
Map<EndpointId, ExposableWebEndpoint> endpoints = mapEndpoints(discoverer.getEndpoints());
assertThat(endpoints).containsOnlyKeys(EndpointId.of("test"));
ExposableWebEndpoint endpoint = endpoints.get(EndpointId.of("test"));
Condition<List<? extends WebOperationRequestPredicate>> expected = requestPredicates(path("custom/test").httpMethod(WebEndpointHttpMethod.GET).consumes().produces("application/json"), path("custom/test/{id}").httpMethod(WebEndpointHttpMethod.GET).consumes().produces("application/json"));
assertThat(requestPredicates(endpoint)).has(expected);
});
}
Aggregations