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)))))
                ]
      (let [content (line-seq rdr)]
        (.shutdown (.getConnectionManager client))
        content
        )
      )
    )
  )


Executing that function with (request "http://www.google.com/";) I get
a stream closed exception. Obviously "content" is not executed in the
let command (at least I think so) but after the stream is closed. Can
somebody help me please?

-- 
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