ro.pippo.core.Response.text()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(151)

本文整理了Java中ro.pippo.core.Response.text方法的一些代码示例,展示了Response.text的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Response.text方法的具体详情如下:
包路径:ro.pippo.core.Response
类名称:Response
方法名:text

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");
  }
}

相关文章