Menu

accessing HttpClient

Jeff
2007-05-03
2012-09-04
  • Jeff

    Jeff - 2007-05-03

    I made a small modification to my local copy of webharvest05 to get access to HttpClient's client object after the processor runs. I need to get the cookies, but other people might want to check other params. Is there a way to check this into the main trunk?

    in HttpClientManager.java add:

    public HttpClient getClient() {
        return this.client;
    }
    

    we could also add a convenience method returning just the cookies if you think people would want it:

    public Map getCookies() {
    Cookie[] cookies = this.client.getState().getCookies();
    Map res =
    ...convert org.apache.commons.httpclient.Cookie[] into hashmap...
    return res;
    }

     
    • Vladimir Nikic

      Vladimir Nikic - 2007-05-04

      Yes, there were several issues for this feature. I'm going to somehow add it for the following release. I'm thinking about supplying functions like: sys.getCookie(...), sys.getHeader(...) etc. that would be available from the evaluation context, like ....${...sys.getCookie()...}....

       

Log in to post a comment.