本文整理了Java中ro.pippo.core.Response.text
方法的一些代码示例,展示了Response.text
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Response.text
方法的具体详情如下:
包路径:ro.pippo.core.Response
类名称:Response
方法名:text
[英]Sets the Response content-type to text/plain.
[中]将响应内容类型设置为文本/普通。
代码示例来源:origin: pippo-java/pippo
@Override
public RouteContext text() {
response.text();
return this;
}
代码示例来源:origin: pippo-java/pippo
@Override
public void handle(RouteContext routeContext) {
Response response = routeContext.getResponse().noCache().text();
Map<String, String> props = new HashMap<>();
for (String name : System.getProperties().stringPropertyNames()) {
props.put(name, System.getProperty(name));
}
try (BufferedWriter writer = new BufferedWriter(response.getWriter())) {
writeSystemProperties(props, writer);
writer.newLine();
writeEnv(System.getenv(), writer);
writer.flush();
} catch (IOException e) {
log.error(e.getMessage(), e);
}
}
代码示例来源:origin: pippo-java/pippo
@Override
public void handle(RouteContext routeContext) {
Map<String, String> settingsMap = settingsToMap(routeContext.getSettings());
Response response = routeContext.getResponse().noCache().text();
try (BufferedWriter writer = new BufferedWriter(response.getWriter())) {
writeSettings(settingsMap, writer);
writer.flush();
} catch (IOException e) {
log.error(e.getMessage(), e);
}
}
代码示例来源:origin: pippo-java/pippo
@Override
public void handle(RouteContext routeContext) {
routeContext.getResponse().noCache().text().send("pong");
}
代码示例来源:origin: pippo-java/pippo
@Override
public void handle(RouteContext routeContext) {
Response response = routeContext.getResponse().noCache().text();
代码示例来源:origin: pippo-java/pippo
@Override
public void handle(RouteContext routeContext) {
Response response = routeContext.getResponse().noCache().text();
SortedMap<String, HealthCheck.Result> healthChecks = healthCheckRegistry.runHealthChecks();
if (healthChecks.isEmpty()) {
response.notImplemented().send("The health checks are empty");
} else {
boolean notHealthy = healthChecks.values().stream().anyMatch(hc -> !hc.isHealthy());
if (notHealthy) {
response.internalError().send("The health is bad");
} else {
response.ok().send("The health is good");
}
}
}
代码示例来源:origin: pippo-java/pippo
@Override
public void handle(RouteContext routeContext) {
Response response = routeContext.getResponse().noCache().text();
if (threadDump != null) {
threadDump.dump(response.getOutputStream());
} else {
response.internalError().send("Sorry your runtime environment does not allow to dump threads");
}
}
代码示例来源:origin: ro.pippo/pippo-metrics
@Override
public void handle(RouteContext routeContext) {
Response response = routeContext.getResponse().noCache().text();
代码示例来源:origin: ro.pippo/pippo-metrics
@Override
public void handle(RouteContext routeContext) {
Response response = routeContext.getResponse().noCache().text();
SortedMap<String, HealthCheck.Result> healthChecks = healthCheckRegistry.runHealthChecks();
if (healthChecks.isEmpty()) {
response.notImplemented().send("The health checks are empty");
} else {
boolean notHealthy = healthChecks.values().stream().anyMatch(hc -> !hc.isHealthy());
if (notHealthy) {
response.internalError().send("The health is bad");
} else {
response.ok().send("The health is good");
}
}
}
代码示例来源:origin: ro.pippo/pippo-metrics
@Override
public void handle(RouteContext routeContext) {
Response response = routeContext.getResponse().noCache().text();
if (threadDump != null) {
threadDump.dump(response.getOutputStream());
} else {
response.internalError().send("Sorry your runtime environment does not allow to dump threads");
}
}
内容来源于网络,如有侵权,请联系作者删除!