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


Java ResponseTooLargeException类代码示例

本文整理汇总了Java中com.google.appengine.api.urlfetch.ResponseTooLargeException的典型用法代码示例。如果您正苦于以下问题:Java ResponseTooLargeException类的具体用法?Java ResponseTooLargeException怎么用?Java ResponseTooLargeException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ResponseTooLargeException类属于com.google.appengine.api.urlfetch包,在下文中一共展示了ResponseTooLargeException类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fetch

import com.google.appengine.api.urlfetch.ResponseTooLargeException; //导入依赖的package包/类
private HttpResponse fetch(String url, HttpRequestOptions requestOptions,
    HTTPMethod method, String content) throws IOException {

  final FetchOptions options = getFetchOptions(requestOptions);

  String currentUrl = url;

  for (int i = 0; i <= requestOptions.getMaxRedirects(); i++) {

    HTTPRequest httpRequest = new HTTPRequest(new URL(currentUrl),
        method, options);

    addHeaders(httpRequest, requestOptions);

    if (method == HTTPMethod.POST && content != null) {
      httpRequest.setPayload(content.getBytes());
    }

    HTTPResponse httpResponse;
    try {
      httpResponse = fetchService.fetch(httpRequest);
    } catch (ResponseTooLargeException e) {
      return new TooLargeResponse(currentUrl);
    }

    if (!isRedirect(httpResponse.getResponseCode())) {
      boolean isResponseTooLarge =
        (getContentLength(httpResponse) > requestOptions.getMaxBodySize());
      return new AppEngineFetchResponse(httpResponse,
          isResponseTooLarge, currentUrl);
    } else {
      currentUrl = getResponseHeader(httpResponse, "Location").getValue();
    }
  }
  throw new IOException("exceeded maximum number of redirects");
}
 
开发者ID:jbufu,项目名称:openid4java,代码行数:37,代码来源:AppEngineHttpFetcher.java

示例2: getBody

import com.google.appengine.api.urlfetch.ResponseTooLargeException; //导入依赖的package包/类
public String getBody() {
  throw new ResponseTooLargeException(finalUri);
}
 
开发者ID:jbufu,项目名称:openid4java,代码行数:4,代码来源:AppEngineHttpFetcher.java

示例3: getResponseHeader

import com.google.appengine.api.urlfetch.ResponseTooLargeException; //导入依赖的package包/类
public Header getResponseHeader(String headerName) {
  throw new ResponseTooLargeException(finalUri);
}
 
开发者ID:jbufu,项目名称:openid4java,代码行数:4,代码来源:AppEngineHttpFetcher.java

示例4: getResponseHeaders

import com.google.appengine.api.urlfetch.ResponseTooLargeException; //导入依赖的package包/类
public Header[] getResponseHeaders(String headerName) {
  throw new ResponseTooLargeException(finalUri);
}
 
开发者ID:jbufu,项目名称:openid4java,代码行数:4,代码来源:AppEngineHttpFetcher.java

示例5: getStatusCode

import com.google.appengine.api.urlfetch.ResponseTooLargeException; //导入依赖的package包/类
public int getStatusCode() {
  throw new ResponseTooLargeException(finalUri);
}
 
开发者ID:jbufu,项目名称:openid4java,代码行数:4,代码来源:AppEngineHttpFetcher.java


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