本文整理汇总了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");
}
示例2: getBody
import com.google.appengine.api.urlfetch.ResponseTooLargeException; //导入依赖的package包/类
public String getBody() {
throw new ResponseTooLargeException(finalUri);
}
示例3: getResponseHeader
import com.google.appengine.api.urlfetch.ResponseTooLargeException; //导入依赖的package包/类
public Header getResponseHeader(String headerName) {
throw new ResponseTooLargeException(finalUri);
}
示例4: getResponseHeaders
import com.google.appengine.api.urlfetch.ResponseTooLargeException; //导入依赖的package包/类
public Header[] getResponseHeaders(String headerName) {
throw new ResponseTooLargeException(finalUri);
}
示例5: getStatusCode
import com.google.appengine.api.urlfetch.ResponseTooLargeException; //导入依赖的package包/类
public int getStatusCode() {
throw new ResponseTooLargeException(finalUri);
}