On Wed, Jan 5, 2011 at 5:13 PM, Ken Wesson <kwess...@gmail.com> wrote:
> On Wed, Jan 5, 2011 at 4:40 PM, rainerh <rainer.hahnek...@gmail.com> wrote:
>> Hello everybody,
>>
>> I'm trying to use clojure to parse web sites. Unfortunately there is
>> some problem with following code (used library is Apache Commons HTTP
>> Client):
>>
>> (defn request [url]
>>  (let [client (new org.apache.http.impl.client.DefaultHttpClient)]
>>    (with-open [rdr (reader
>>                     (.getContent
>>                      (.getEntity
>>                       (.execute client (new
>> org.apache.http.client.methods.HttpGet url)))))
>>                ]
>

As an aside, the following is an alternate way of writing that intializer:

(-> client
     (.execute (org.apache.http.client.methods.HttpGet. url))
    .getEntity .getContent reader)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to