mechanize

mechanize for java: stateful HTTP/HTML client

Лицензия

Лицензия

Группа

Группа

com.gistlabs
Идентификатор

Идентификатор

mechanize
Последняя версия

Последняя версия

2.0.0-RC1
Дата

Дата

Тип

Тип

jar
Описание

Описание

mechanize
mechanize for java: stateful HTTP/HTML client
Ссылка на сайт

Ссылка на сайт

http://gistlabs.com/software/mechanize
Организация-разработчик

Организация-разработчик

Gist Labs
Система контроля версий

Система контроля версий

https://github.com/GistLabs/mechanize

Скачать mechanize

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.gistlabs/mechanize/ -->
<dependency>
    <groupId>com.gistlabs</groupId>
    <artifactId>mechanize</artifactId>
    <version>2.0.0-RC1</version>
</dependency>
// https://jarcasting.com/artifacts/com.gistlabs/mechanize/
implementation 'com.gistlabs:mechanize:2.0.0-RC1'
// https://jarcasting.com/artifacts/com.gistlabs/mechanize/
implementation ("com.gistlabs:mechanize:2.0.0-RC1")
'com.gistlabs:mechanize:jar:2.0.0-RC1'
<dependency org="com.gistlabs" name="mechanize" rev="2.0.0-RC1">
  <artifact name="mechanize" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.gistlabs', module='mechanize', version='2.0.0-RC1')
)
libraryDependencies += "com.gistlabs" % "mechanize" % "2.0.0-RC1"
[com.gistlabs/mechanize "2.0.0-RC1"]

Зависимости

compile (6)

Идентификатор библиотеки Тип Версия
org.jsoup : jsoup jar 1.7.1
org.json : json jar 20090211
se.fishtank : css-selectors jar 1.0.5
org.apache.httpcomponents : httpclient jar 4.0.1
org.apache.httpcomponents : httpmime jar 4.0.1
com.damnhandy : handy-uri-templates jar 2.0.1

test (2)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.11
org.mockito : mockito-core jar 1.9.5

Модули Проекта

Данный проект не имеет модулей.

mechanize for java

mechanize is a stateful HTTP web services client library (RESTful) with support for HTML, JSON, and XML services. Because mechanize is stateful and allow inspection of web resources, it naturally support GET-then-POST semantics and helps avoid hard-coding clients.

See the Mechanize Wiki for more details and opinions on how RESTful clients should behave.

====== Releases:

  • 1.x is the original port of mechanize to java. This will be maintained for bug fixes and possibly other enhancements.
  • 2.x is the modularized version to separate HTML, JSON, and XML into separate a la carte packages. Also the JSON linking dev will be here.

========

Here is a testcase showing mechanize at work with HTML:

	@Test public void testGooglePageSearchForm() {
		MechanizeAgent agent = new MechanizeAgent();
		Document page = agent.get("http://www.google.com");
		Form form = page.form("f");
		form.get("q").set("mechanize java");
		Resource response = form.submit();
		assertTrue(response.getTitle().startsWith("mechanize java"));
	}

Here is a testcase showing mechanize using a Google JSON web service:

	@Test
	public void testGoogleApi() throws JSONException {
		MechanizeAgent agent = new MechanizeAgent();
		JsonDocument json = agent.doRequest(googleUrl).add("shortUrl", shortUrl).add("projection", "FULL").get();

		assertEquals(longUrl, json.getRoot().find("longUrl").getValue());

		String value = json.getRoot().find("analytics month countries#US count").getValue();
		assertTrue(value, Integer.valueOf(value)>=1);
	}

=========

Include this library (or download) from the Maven repository: http://search.maven.org/#browse%7C687823805

com.gistlabs

Gist Labs

Версии библиотеки

Версия
2.0.0-RC1
1.0.0-RC1
0.13.1
0.11.2
0.11.0
0.10.0
0.9.2
0.9.1
0.9.0
0.8.0