> -----Original Message----- > From: Sergey Beryozkin [mailto:[email protected]] > Sent: Thursday, August 11, 2011 11:32 AM > To: [email protected] > Subject: Re: Use WebClient to get raw text of response? > > Hi David > > On Thu, Aug 11, 2011 at 6:49 PM, KARR, DAVID (ATTSI) <[email protected]> > wrote: > > I have a situation where I need to validate the content of a page at > a URL, where I've gotten the URL from a property in a JAX-RS response. > I tried using HTMLUnit for this, but it looks like their proxy > interface doesn't allow setting a proxy user and password, and it > doesn't appear to read the "http.proxy*" system variables. > Fortunately, WebClient appears to transparently use these (I'm > guessing this is because WebClient uses HTTPUrlConnection under the > covers, whereas HTMLUnit is using a hidden HttpClient under the > covers). > > > > What I can't figure out, however, is how to make WebClient just > return the entire text content of the page. I thought perhaps that > "client.get(String.class)" would do it, but it does not. > > > What happens when you do client.get(String.class) ? That should work... > If you expect XML back then using StreamSource can do as well... > Also, simply client.get() will return Response and its getEntity() can > be used to get to response InputStream.
Hmm, I had tried "get(String.class)" before, and it didn't work. Perhaps that was before I had my proxy settings working. Anyway, it's working now. Never mind.
