当前位置: 首页>>代码示例>>Java>>正文


Java Response.getHeader方法代码示例

本文整理汇总了Java中org.scribe.model.Response.getHeader方法的典型用法代码示例。如果您正苦于以下问题:Java Response.getHeader方法的具体用法?Java Response.getHeader怎么用?Java Response.getHeader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.scribe.model.Response的用法示例。


在下文中一共展示了Response.getHeader方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: TKResponse

import org.scribe.model.Response; //导入方法依赖的package包/类
public TKResponse(Request req) {
	Response response = req.send();
	String limitUsed = response.getHeader("X-RateLimit-Used");
	String limitExpire = response.getHeader("X-RateLimit-Expire");
	String limitTotal = response.getHeader("X-RateLimit-Limit");
	String limitRemain = response.getHeader("X-RateLimit-Remaining");
	if (limitUsed != null) {
		rateLimitUsed = Integer.parseInt(limitUsed);
	}
	if (limitExpire != null) {
		rateLimitExpire = Long.parseLong(limitExpire);
	}
	if (limitTotal != null) {
		rateLimitTotal = Integer.parseInt(limitTotal);
	}
	if (limitRemain != null) {
		rateLimitRemaining = Integer.parseInt(limitRemain);
	}
	this.response = response.getBody();
}
 
开发者ID:Ccook,项目名称:conniption,代码行数:21,代码来源:TKResponse.java

示例2: verifyUpload

import org.scribe.model.Response; //导入方法依赖的package包/类
/**
 * Verifies the upload and returns whether it's successful
 *
 * @param endpoint to verify upload to
 * @return the last byte on the server
 */
private static long verifyUpload(String endpoint) {
    // Verify the upload
    OAuthRequest request = new OAuthRequest(Verb.PUT, endpoint);
    request.addHeader("Content-Length", "0");
    request.addHeader("Content-Range", "bytes */*");
    Response response = request.send();
    //printResponse(response, "Verify Upload to " + endpoint);      //DEBUG
    if (response.getCode() != 308 || !response.isSuccessful()) {
        return -1;
    }
    String range = response.getHeader("Range");
    return Long.parseLong(range.substring(range.lastIndexOf("-") + 1)) + 1;
    //The + 1 at the end is because Vimeo gives you 0-whatever byte where 0 = the first byte
}
 
开发者ID:nicksteele,项目名称:JavaVimeoUpload,代码行数:21,代码来源:UploadVimeoService.java

示例3: getRedirectUrl

import org.scribe.model.Response; //导入方法依赖的package包/类
public String getRedirectUrl(String path) {
    OAuthRequest request = this.constructGet(path, null);
    sign(request);
    boolean presetVal = HttpURLConnection.getFollowRedirects();
    HttpURLConnection.setFollowRedirects(false);
    Response response = request.send();
    HttpURLConnection.setFollowRedirects(presetVal);
    if (response.getCode() == 301 || response.getCode() == 302) {
        return response.getHeader("Location");
    } else {
        throw new JumblrException(response);
    }
}
 
开发者ID:tumblr,项目名称:jumblr,代码行数:14,代码来源:RequestBuilder.java


注:本文中的org.scribe.model.Response.getHeader方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。