【发布时间】:2014-08-04 20:52:03
【问题描述】:
Java 堆空间错误。 我想从网页中获取大字符串结果,请查看下面的示例。 但是
String response = resource.get(String.class);
将始终返回“java.lang.OutOfMemoryError: Java heap space”错误。问题是网页太大。我可以使用流式解决方案或其他解决方案来代替“字符串响应”吗?
谢谢。
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.WebResource;
public class helloWorldClient {
public helloWorldClient() {
super();
}
public static void main(String[] args) {
Client c = Client.create();
WebResource resource = c.resource("http://localhost:7101/RESTfulService-Project1-context-root/jersey/helloWorld");
String response = resource.get(String.class);
}
}
【问题讨论】:
-
响应有多大大? :>
标签: java web-services rest response