本文整理汇总了Java中com.github.kevinsawicki.http.HttpRequest.userAgent方法的典型用法代码示例。如果您正苦于以下问题:Java HttpRequest.userAgent方法的具体用法?Java HttpRequest.userAgent怎么用?Java HttpRequest.userAgent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.kevinsawicki.http.HttpRequest
的用法示例。
在下文中一共展示了HttpRequest.userAgent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configure
import com.github.kevinsawicki.http.HttpRequest; //导入方法依赖的package包/类
private HttpRequest configure(final HttpRequest request) {
request.connectTimeout(TIMEOUT).readTimeout(TIMEOUT);
request.userAgent(System.getProperty("http.agent"));
if (isPostOrPut(request))
request.contentType(Constants.Http.CONTENT_TYPE_JSON); // All PUT & POST requests to Parse.com api must be in JSON - https://www.parse.com/docs/rest#general-requests
return addCredentialsTo(request);
}
示例2: configure
import com.github.kevinsawicki.http.HttpRequest; //导入方法依赖的package包/类
private HttpRequest configure(final HttpRequest request) {
request.connectTimeout(TIMEOUT).readTimeout(TIMEOUT);
request.userAgent(userAgentProvider.get());
if(isPostOrPut(request))
request.contentType(Constants.Http.CONTENT_TYPE_JSON); // All PUT & POST requests to Parse.com api must be in JSON - https://www.parse.com/docs/rest#general-requests
return request;
}