Home

John Heintz edited this page Jul 30, 2014 · 16 revisions

Welcome to mechanize for java.

Mechanize is a stateful REST client with support for HTML and also JSON interactions. Mechanize has a long history, from perl to python and ruby. See Other Implementations for links.

The Fundamental Hypermedia Pattern: GET-then-POST

Hypermedia is based on having client state and stateless servers. What does a stateful-client and stateless-server look like?

  • If you are reading a book, it's your job to remember what page you are on.
  • You are the client, and your state is the page number you're on.
  • The book is the server, and in a digital world many, many clients can be reading the same book at different pages.

The most basic and fundamental RESTful interaction style is:

  1. First, GET one or more resources.
  2. Then POST

Specifically, the clients to a RESTful service should never be hard coded to a specific URI and parameter set. This is brittle and prevents evolutionary change and upgrade.

The Rails CSRF forgery countermeasures are a good example of why GET-then-POST is needed. Another example is the server changes to allow new parameters and then new GET responses can include default values for these new parameters. See the GET-then-POST page for more details.

JSON and XML Support

Most RESTful Web Services use either JSON or XML for the data format. This is great, but neither of these has functional hypermedia support. (XML does have some standard in this area, but none that are popular.) See the JSON Hypermedia page for a description of how Mechanize is supporting this space.

Implementation Details and Guides

Other details

Here are the directions I use to PublishToMavenRepository, so I don't forget.

Here are some References to getting this project setup.