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

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

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

HttpRequest.authorization介绍

[英]Set the 'Authorization' header to given value
[中]将“授权”标题设置为给定值

代码示例

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

/**
 * Set the 'Authorization' header to given values in Basic authentication
 * format
 *
 * @param name
 * @param password
 * @return this request
 */
public HttpRequest basic(final String name, final String password) {
 return authorization("Basic " + Base64.encode(name + ':' + password));
}

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

/**
 * Set the 'Authorization' header to given values in Basic authentication
 * format
 *
 * @param name
 * @param password
 * @return this request
 */
public HttpRequest basic(final String name, final String password) {
 return authorization("Basic " + Base64.encode(name + ':' + password));
}

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

/**
 * Set the 'Authorization' header to given values in Basic authentication
 * format
 *
 * @param name
 * @param password
 * @return this request
 */
public HttpRequest basic(final String name, final String password) {
  return authorization("Basic " + Base64.encode(name + ':' + password));
}

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

/**
 * Set the 'Authorization' header to given values in Basic authentication
 * format
 *
 * @param name
 * @param password
 * @return this request
 */
public HttpRequest basic(final String name, final String password) {
  return authorization("Basic " + Base64.encode(name + ':' + password));
}

代码示例来源:origin: stackoverflow.com

HttpRequest request = HttpRequest.post(url);
 request.authorization("Basic "+ah);
 request.part("file", fName+".png", "image/png", new File(file));
 request.part("title", "test");
 if(request.code()==201) {
  StringWriter sw = new StringWriter();
  request.receive(sw);
  onMedia(Media.parse(new  JsonParser().parse(sw.toString()).getAsJsonObject()));
 }

相关文章

HttpRequest类方法