com.github.kevinsawicki.http.HttpRequest.header()方法的使用及代码示例

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

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

HttpRequest.header介绍

[英]Get a response header
[中]获取响应头

代码示例

代码示例来源:origin: com.github.kevinsawicki/http-request

/**
 * Set the 'User-Agent' header to given value
 *
 * @param userAgent
 * @return this request
 */
public HttpRequest userAgent(final String userAgent) {
 return header(HEADER_USER_AGENT, userAgent);
}

代码示例来源:origin: com.github.kevinsawicki/http-request

/**
 * Get the 'Cache-Control' header from the response
 *
 * @return cache control
 */
public String cacheControl() {
 return header(HEADER_CACHE_CONTROL);
}

代码示例来源:origin: com.github.kevinsawicki/http-request

/**
 * Set the 'Accept' header to given value
 *
 * @param accept
 * @return this request
 */
public HttpRequest accept(final String accept) {
 return header(HEADER_ACCEPT, accept);
}

代码示例来源:origin: com.restfuse/com.eclipsesource.restfuse

/**
 * Get the 'Cache-Control' header from the response
 *
 * @return cache control
 */
public String cacheControl() {
 return header(HEADER_CACHE_CONTROL);
}

代码示例来源:origin: com.restfuse/com.eclipsesource.restfuse

/**
 * Set the 'Accept' header to given value
 *
 * @param value
 * @return this request
 */
public HttpRequest accept(final String value) {
 return header(HEADER_ACCEPT, value);
}

代码示例来源:origin: com.github.kevinsawicki/http-request

/**
 * Get the 'Content-Encoding' header from the response
 *
 * @return this request
 */
public String contentEncoding() {
 return header(HEADER_CONTENT_ENCODING);
}

代码示例来源:origin: com.github.kevinsawicki/http-request

/**
 * Get the 'Location' header from the response
 *
 * @return location
 */
public String location() {
 return header(HEADER_LOCATION);
}

代码示例来源:origin: tcking/GiraffePlayer2

/**
 * Set the 'Accept-Charset' header to given value
 *
 * @param acceptCharset
 * @return this request
 */
public HttpRequest acceptCharset(final String acceptCharset) {
  return header(HEADER_ACCEPT_CHARSET, acceptCharset);
}

代码示例来源:origin: tcking/GiraffePlayer2

/**
 * Get the 'Server' header from the response
 *
 * @return server
 */
public String server() {
  return header(HEADER_SERVER);
}

代码示例来源:origin: com.restfuse/com.eclipsesource.restfuse

/**
 * Set the 'Accept-Encoding' header to given value
 *
 * @param value
 * @return this request
 */
public HttpRequest acceptEncoding(final String value) {
 return header(HEADER_ACCEPT_ENCODING, value);
}

代码示例来源:origin: com.restfuse/com.eclipsesource.restfuse

/**
 * Set the 'Accept-Charset' header to given value
 *
 * @param value
 * @return this request
 */
public HttpRequest acceptCharset(final String value) {
 return header(HEADER_ACCEPT_CHARSET, value);
}

代码示例来源:origin: lkorth/httpebble-android

/**
 * Set the 'User-Agent' header to given value
 *
 * @param value
 * @return this request
 */
public HttpRequest userAgent(final String value) {
  return header(HEADER_USER_AGENT, value);
}

代码示例来源:origin: lkorth/httpebble-android

/**
 * Get the 'Cache-Control' header from the response
 *
 * @return cache control
 */
public String cacheControl() {
  return header(HEADER_CACHE_CONTROL);
}

代码示例来源:origin: lkorth/httpebble-android

/**
 * Set the 'Authorization' header to given value
 *
 * @param value
 * @return this request
 */
public HttpRequest authorization(final String value) {
  return header(HEADER_AUTHORIZATION, value);
}

代码示例来源:origin: lkorth/httpebble-android

/**
 * Set the 'Accept' header to given value
 *
 * @param value
 * @return this request
 */
public HttpRequest accept(final String value) {
  return header(HEADER_ACCEPT, value);
}

代码示例来源:origin: com.github.kevinsawicki/http-request

/**
 * Set header to have given entry's key as the name and value as the value
 *
 * @param header
 * @return this request
 */
public HttpRequest header(final Entry<String, String> header) {
 return header(header.getKey(), header.getValue());
}

代码示例来源:origin: tcking/GiraffePlayer2

/**
 * Set header to have given entry's key as the name and value as the value
 *
 * @param header
 * @return this request
 */
public HttpRequest header(final Entry<String, String> header) {
  return header(header.getKey(), header.getValue());
}

代码示例来源:origin: tcking/GiraffePlayer2

/**
 * Get all parameters from header value in response
 * <p>
 * This will be all key=value pairs after the first ';' that are separated by
 * a ';'
 *
 * @param headerName
 * @return non-null but possibly empty map of parameter headers
 */
public Map<String, String> parameters(final String headerName) {
  return getParams(header(headerName));
}

代码示例来源:origin: com.github.kevinsawicki/http-request

/**
 * Get parameter with given name from header value in response
 *
 * @param headerName
 * @param paramName
 * @return parameter value or null if missing
 */
public String parameter(final String headerName, final String paramName) {
 return getParam(header(headerName), paramName);
}

代码示例来源:origin: com.github.kevinsawicki/http-request

/**
 * Get all parameters from header value in response
 * <p>
 * This will be all key=value pairs after the first ';' that are separated by
 * a ';'
 *
 * @param headerName
 * @return non-null but possibly empty map of parameter headers
 */
public Map<String, String> parameters(final String headerName) {
 return getParams(header(headerName));
}

相关文章

HttpRequest类方法