com.seanshubin.http.values:http-values-client-apache

HTTP as a pure function

Лицензия

Лицензия

Категории

Категории

CLI Взаимодействие с пользователем
Группа

Группа

com.seanshubin.http.values
Идентификатор

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

http-values-client-apache
Последняя версия

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

1.0.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

com.seanshubin.http.values:http-values-client-apache
HTTP as a pure function

Скачать http-values-client-apache

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

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

Зависимости

compile (3)

Идентификатор библиотеки Тип Версия
com.seanshubin.http.values : http-values-domain jar 1.0.1
org.scala-lang : scala-library jar 2.12.3
org.apache.httpcomponents : httpclient jar 4.5.3

test (1)

Идентификатор библиотеки Тип Версия
org.scalatest : scalatest_2.12 jar 3.0.4

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

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

Http Values

Http without mutable state

Rationale

Java's servlet api is designed around side effects on the response. It has a signature like this:

javax.servlet.Servlet
public void service(ServletRequest req,
                    ServletResponse res)
             throws ServletException,
                    java.io.IOException

I wanted to treat the http request/response process as a function, like so

// Client
trait Sender {
  def send(request: RequestValue): ResponseValue
}

// Server
trait Receiver {
  def receive(request: RequestValue): ResponseValue
}

This allows implementors to test pure functions rather than dealing with streams.

There is also a good bit of support for handling dispatch in a testable way. A server can compose a bunch of named receivers together, an be confident that any path collisions will fail immediately with a sensible error message, rather than having an arbitrary receiver pick up the request.

Limitations

  • The request and response values are reified immediately. This is usually not a problem unless your application typically ignores large portions of the request or response and thus could be optimized by waiting until they needed to be reified.
  • By design, this library does not handle streaming. If you need streaming this is the wrong tool for the job.

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

Версия
1.0.1
1.0