jodd.http.HttpResponse.headers()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(1.6k)|赞(0)|评价(0)|浏览(114)

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

HttpResponse.headers介绍

暂无

代码示例

代码示例来源:origin: oblac/jodd

/**
 * Returns list of valid cookies sent from server.
 * If no cookie found, returns an empty array. Invalid cookies are ignored.
 */
public Cookie[] cookies() {
  List<String> newCookies = headers("set-cookie");
  if (newCookies == null) {
    return new Cookie[0];
  }
  List<Cookie> cookieList = new ArrayList<>(newCookies.size());
  for (String cookieValue : newCookies) {
    try {
      Cookie cookie = new Cookie(cookieValue);
      cookieList.add(cookie);
    }
    catch (Exception ex) {
      // ignore
    }
  }
  return cookieList.toArray(new Cookie[0]);
}

代码示例来源:origin: org.jodd/jodd-http

/**
 * Returns list of valid cookies sent from server.
 * If no cookie found, returns an empty array. Invalid cookies are ignored.
 */
public Cookie[] cookies() {
  List<String> newCookies = headers("set-cookie");
  if (newCookies == null) {
    return new Cookie[0];
  }
  List<Cookie> cookieList = new ArrayList<>(newCookies.size());
  for (String cookieValue : newCookies) {
    try {
      Cookie cookie = new Cookie(cookieValue);
      cookieList.add(cookie);
    }
    catch (Exception ex) {
      // ignore
    }
  }
  return cookieList.toArray(new Cookie[0]);
}

代码示例来源:origin: com.liferay.launchpad/api-client

clientResponse.body(response.bodyText());
response.headers().forEach(
  header -> clientResponse.headers().add(
    header.getKey(), header.getValue()));

代码示例来源:origin: com.liferay.launchpad/api-transport-jodd

clientResponse.body(response.body());
Map<String, String[]> responseHeaders = response.headers();

相关文章