I found some threads on this list on how to get the headers of a request, but as I am writing a client I am more interested in getting all the headers
of a response.

HTTPUrlConnection hconn = (HTTPUrlConnection) url.getURLConnection();

hconn.connect();
Bnode response = factory.createBNode();

graph.addStatement(response,RDFS.instanceOf,factory.createResource("http://www.w3.org/2007/ont/http#ResponseMessage "));

for(Map.Entry<String,List<String>> head: hconn.getHeaderFields().entrySet()) {
        graph.addStatement(response,
factory.createResource("http://www.w3.org/2007/ont/httph# "+head.getKey().toLowerCase()),
                          head.getValue());
}

Then I can log all the headers in every message I come across.

How would I do that with Restlets?

Henry

Home page: http://bblfish.net/
Sun Blog: http://blogs.sun.com/bblfish/
Foaf name: http://bblfish.net/people/henry/card#me



Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to