10 thoughts on “Mechanize for Java

  1. Pingback: Announcing mechanize for java | Gist Labs

  2. Hi, I use Mechanize with Perl and I’m looking for a similar library to use it in Android (Java) apps. Glad I found your project!

    Many times I use in my scripts in Perl:
    $mech->post (…);
    Is there a possibility to do it with your library?

    Thanks in advance!

    Cheers,
    mat

    • Hello Mat,

      Thanks for commenting, and the feature request.

      I’m sure we can expose post directly (and you are welcome to contribute a pull request on GitHub is you were inspired.)

      Are you thinking something like:

      agent.post(url, mapNameValueParams)

      Cheers,
      John

  3. Hi John,
    thanks for your answer.

    Exactly. In Perl it’s inherited from LWP::UserAgent. There we can do for example:

    my $response = $browser->post($url,
    [ 'value1'=>"2",
    'value2'=>"0",
    ## etc.etc.etc....
    ], @ns_headers);

    Would be great to see it in your Java implementation.

  4. Dear,

    I’m trying to use mechanize, but I’ve problem with dependencies. NetBeans cannot find the following symbols in MechanizeAgent.java

    import org.apache.http.Header;
    import org.apache.http.HttpException;
    import org.apache.http.HttpResponseInterceptor;
    import org.apache.http.entity.BufferedHttpEntity;
    import org.apache.http.params.HttpProtocolParams;
    import org.apache.http.protocol.BasicHttpContext;

    In Debug.java:
    import org.apache.http.Header;
    import org.apache.http.HttpMessage;

    In CacheEntry.java
    import org.apache.http.Header;
    import org.apache.http.HeaderElement;
    import org.apache.http.HttpMessage;
    import org.apache.http.HttpResponse;
    import org.apache.http.entity.ByteArrayEntity;
    import org.apache.http.message.BasicHttpResponse;

    and others….

    NetBeans add the following libraries like dependencies:
    ant-1.8.1
    commons-logging-1.0.4
    css-selector-1.0.4
    httpclient-4.0.1
    httpmime-4.0.1
    json-20090211
    jsoup-1.7.1
    ant-launcher-1.8.1

    Can you help me to solve the problem?
    Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>