On Thu, 2008-09-04 at 00:40 -0700, Suladna wrote: > Hi > > I have used the following tutorial to bring html-code from websites to > my java program: > > http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/module-client/src/examples/org/apache/http/examples/client/ClientExecuteDirect.java > > The websites which I connect to all start with www.xxxxxxxxx.se * but > they have different endings. > > So I start by making one HttpHost and defining a HttpEntity and > HttpRespons > > final HttpHost target = new HttpHost("www.xxxxxxx.se", 80, "http"); > HttpEntity entity = null; > HttpResponse rsp = null; > > > After that I use a loop to connect to each subsite. This is what I > write in the loop: > > HttpRequest req = createRequest(urlEnding); > rsp = client.execute(target, req); > entity = rsp.getEntity(); > > String[] line = EntityUtils.toString(entity).split("\n"); //this info > is used by the program > > >
This is an exceptionally bad idea. You are buffering the entire response content in memory and then making yet another copy by splitting the string into individual lines. No wonder you are getting OM exceptions. This problem has nothing to do with HttpClient. Oleg --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]