REST Client

Java Proxy client for REST services.

Лицензия

Лицензия

The Apache License, Version 2.0
Категории

Категории

JavaScript Языки программирования CLI Взаимодействие с пользователем
Группа

Группа

com.js-lib
Идентификатор

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

js-rest-client
Последняя версия

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

1.0.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

REST Client
Java Proxy client for REST services.
Ссылка на сайт

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

https://github.com/js-lib-com/rest-client.git
Система контроля версий

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

https://github.com/js-lib-com/rest-client

Скачать js-rest-client

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

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

Зависимости

compile (3)

Идентификатор библиотеки Тип Версия
com.js-lib : js-commons jar 1.2.0
com.js-lib : js-json jar 1.0.2
javax.ws.rs : jsr311-api jar 1.1.1

test (2)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12
org.hamcrest : hamcrest-all jar 1.3

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

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

rest-client

Java Proxy client for REST services.

Here is a functional example for Wikipedia API. First need to create DTO (Data Transport Object) compatible with returned JSON from API. Next define Java interface for Wikipedia API; need to define only methods of interest not all existing on API interface.

Create REST client factory and use it to create Wikipedia client instance. Need to provide Wikipedia API base URL. Once client instance created use it as regular Java instance and call methods. Client instance is a Java Proxy that convert method invocation into REST call.

  public class WikipediaPageSummary {
    String title;
    String displaytitle;
    String extract;
  }

  public interface Wikipedia {
    @Path("page/summary/{title}")
    WikipediaPageSummary getPageSummary(@PathParam("title") String title);
  }

  RestClientFactory factory = new RestClientFactory();
  Wikipedia wikipedia = factory.getRemoteInstance("https://en.wikipedia.org/api/rest_v1/", Wikipedia.class);
  
  WikipediaPageSummary summary = wikipedia.getPageSummary("Lion");
  // summary instance with fields initialized from JSON response
com.js-lib

java(script) libraries

Set of APIs and libraries for Java and JavaScript.

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

Версия
1.0.0