Java 类org.springframework.boot.actuate.endpoint.mvc.HypermediaDisabled 实例源码

项目:spring-boot-starter-prometheus    文件:PrometheusMvcEndpoint.java   
@Override
@GetMapping(produces = TextFormat.CONTENT_TYPE_004)
@HypermediaDisabled
@ResponseBody
public ResponseEntity<String> invoke() {
    PrometheusMetrics prometheusMetrics = (PrometheusMetrics) super.invoke();

    Writer writer = new StringWriter();
    try {
        TextFormat.write004(writer, Collections.enumeration(prometheusMetrics.getMetricFamilySamples()));
    } catch (IOException e) {
        log.error("metric write error", e);
    }

    HttpStatus status = prometheusMetrics.isUp() ? HttpStatus.OK : HttpStatus.INTERNAL_SERVER_ERROR;

    String body = writer.toString();
    ResponseEntity<String> response = new ResponseEntity<>(body, status);
    return response;
}
项目:druid-spring-boot    文件:DruidDataSourceMvcEndpoint.java   
@GetMapping(value = "/{name:.*}", produces = {ActuatorMediaTypes.APPLICATION_ACTUATOR_V1_JSON_VALUE,
        MediaType.APPLICATION_JSON_VALUE})
@ResponseBody
@HypermediaDisabled
public String handle(@PathVariable String name) {
    String temp = name;
    if (name.contains(".")) {
        temp = name.substring(0, name.indexOf("."));
    }
    name = "/" + temp + ".json";
    return statService.service(name);
}
项目:nakadi-producer-spring-boot-starter    文件:SnapshotEventCreationMvcEndpoint.java   
@RequestMapping(value = "/{eventType:.*}", method = RequestMethod.POST)
@ResponseBody
@HypermediaDisabled
public ResponseEntity<?> createSnapshot(@PathVariable String eventType,
        @RequestBody(required = false) String filter) {
    if (!this.delegate.isEnabled()) {
        // Shouldn't happen - MVC endpoint shouldn't be registered when delegate's
        // disabled
        return getDisabledResponse();
    }

    delegate.invoke(eventType, filter);
    return ResponseEntity.ok().build();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:EndpointWebMvcHypermediaManagementContextConfiguration.java   
private boolean isHypermediaDisabled(MethodParameter returnType) {
    return AnnotationUtils.findAnnotation(returnType.getMethod(),
            HypermediaDisabled.class) != null
            || AnnotationUtils.findAnnotation(
                    returnType.getMethod().getDeclaringClass(),
                    HypermediaDisabled.class) != null;
}
项目:queue-master    文件:PrometheusMvcEndpoint.java   
@RequestMapping(method = RequestMethod.GET, produces = TextFormat.CONTENT_TYPE_004)
@ResponseBody
@HypermediaDisabled
protected Object invoke() {
    if (!getDelegate().isEnabled()) {
        return new ResponseEntity<>(
                Collections.singletonMap("message", "This endpoint is disabled"),
                HttpStatus.NOT_FOUND);
    }
    return super.invoke();
}
项目:spring-boot-concourse    文件:EndpointWebMvcHypermediaManagementContextConfiguration.java   
private boolean isHypermediaDisabled(MethodParameter returnType) {
    return AnnotationUtils.findAnnotation(returnType.getMethod(),
            HypermediaDisabled.class) != null
            || AnnotationUtils.findAnnotation(
                    returnType.getMethod().getDeclaringClass(),
                    HypermediaDisabled.class) != null;
}
项目:contestparser    文件:EndpointWebMvcHypermediaManagementContextConfiguration.java   
private boolean isHypermediaDisabled(MethodParameter returnType) {
    return AnnotationUtils.findAnnotation(returnType.getMethod(),
            HypermediaDisabled.class) != null
            || AnnotationUtils.findAnnotation(
                    returnType.getMethod().getDeclaringClass(),
                    HypermediaDisabled.class) != null;
}