RetrofitHtmlConverter

Converter implementation for retrofit 2 using jsoup

Лицензия

Лицензия

Категории

Категории

Retrofit Сеть HTTP Clients
Группа

Группа

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

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

retrofit-html-converter
Последняя версия

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

0.0.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

RetrofitHtmlConverter
Converter implementation for retrofit 2 using jsoup
Ссылка на сайт

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

https://github.com/slashrootv200/retrofit2-html-converter
Система контроля версий

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

https://github.com/slashrootv200/retrofit2-html-converter

Скачать retrofit-html-converter

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

<!-- https://jarcasting.com/artifacts/com.github.slashrootv200/retrofit-html-converter/ -->
<dependency>
    <groupId>com.github.slashrootv200</groupId>
    <artifactId>retrofit-html-converter</artifactId>
    <version>0.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.slashrootv200/retrofit-html-converter/
implementation 'com.github.slashrootv200:retrofit-html-converter:0.0.1'
// https://jarcasting.com/artifacts/com.github.slashrootv200/retrofit-html-converter/
implementation ("com.github.slashrootv200:retrofit-html-converter:0.0.1")
'com.github.slashrootv200:retrofit-html-converter:jar:0.0.1'
<dependency org="com.github.slashrootv200" name="retrofit-html-converter" rev="0.0.1">
  <artifact name="retrofit-html-converter" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.slashrootv200', module='retrofit-html-converter', version='0.0.1')
)
libraryDependencies += "com.github.slashrootv200" % "retrofit-html-converter" % "0.0.1"
[com.github.slashrootv200/retrofit-html-converter "0.0.1"]

Зависимости

compile (2)

Идентификатор библиотеки Тип Версия
com.squareup.retrofit2 : retrofit jar 2.3.0
org.jsoup : jsoup jar 1.10.3

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

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

retrofit2-html-converter

Download

Download

maven

<dependency>
  <groupId>com.github.slashrootv200</groupId>
  <artifactId>retrofit-html-converter</artifactId>
  <version>0.0.2</version>
  <type>pom</type>
</dependency>

gradle

compile 'com.github.slashrootv200:retrofit-html-converter:0.0.2'

Usage

Service

public interface CollectionsJavaDocWebPageService {
  @GET("javase/7/docs/api/java/util/Collections.html")
  Call<Document> fetch();
}

Add converter to the RetrofitBuilder

Retrofit retrofit = new Retrofit.Builder().baseUrl(baseUrl)
  .addConverterFactory(HtmlConverterFactory.create(baseUrl))
  .build();
CollectionsJavaDocWebPageService service
                      = retrofit.create(CollectionsJavaDocWebPageService.class);
Call<Document> call = service.fetch();

Get Document as a response object

import org.jsoup.nodes.Document;

call.enqueue(new Callback<Document>() {
  @Override
  public void onResponse(Call<Document> call, Response<Document> response) {
    Document document = response.body();
    document.setBaseUri(base);
    String html = document.html(); 
    // contains the html of https://docs.oracle.com/javase/7/docs/api/java/util/Collections.html
  }

  @Override
  public void onFailure(Call<Document> call, Throwable t) {
    t.printStackTrace();
   }
});

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

Версия
0.0.1