当前位置: 首页>>代码示例>>Java>>正文


Java HypermediaDisabled类代码示例

本文整理汇总了Java中org.springframework.boot.actuate.endpoint.mvc.HypermediaDisabled的典型用法代码示例。如果您正苦于以下问题:Java HypermediaDisabled类的具体用法?Java HypermediaDisabled怎么用?Java HypermediaDisabled使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


HypermediaDisabled类属于org.springframework.boot.actuate.endpoint.mvc包,在下文中一共展示了HypermediaDisabled类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: invoke

import org.springframework.boot.actuate.endpoint.mvc.HypermediaDisabled; //导入依赖的package包/类
@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;
}
 
开发者ID:akaGelo,项目名称:spring-boot-starter-prometheus,代码行数:21,代码来源:PrometheusMvcEndpoint.java

示例2: handle

import org.springframework.boot.actuate.endpoint.mvc.HypermediaDisabled; //导入依赖的package包/类
@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);
}
 
开发者ID:drtrang,项目名称:druid-spring-boot,代码行数:13,代码来源:DruidDataSourceMvcEndpoint.java

示例3: createSnapshot

import org.springframework.boot.actuate.endpoint.mvc.HypermediaDisabled; //导入依赖的package包/类
@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();
}
 
开发者ID:zalando-nakadi,项目名称:nakadi-producer-spring-boot-starter,代码行数:15,代码来源:SnapshotEventCreationMvcEndpoint.java

示例4: isHypermediaDisabled

import org.springframework.boot.actuate.endpoint.mvc.HypermediaDisabled; //导入依赖的package包/类
private boolean isHypermediaDisabled(MethodParameter returnType) {
	return AnnotationUtils.findAnnotation(returnType.getMethod(),
			HypermediaDisabled.class) != null
			|| AnnotationUtils.findAnnotation(
					returnType.getMethod().getDeclaringClass(),
					HypermediaDisabled.class) != null;
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:8,代码来源:EndpointWebMvcHypermediaManagementContextConfiguration.java

示例5: invoke

import org.springframework.boot.actuate.endpoint.mvc.HypermediaDisabled; //导入依赖的package包/类
@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();
}
 
开发者ID:microservices-demo,项目名称:queue-master,代码行数:12,代码来源:PrometheusMvcEndpoint.java


注:本文中的org.springframework.boot.actuate.endpoint.mvc.HypermediaDisabled类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。