rxnetty-rest-router

null

Лицензия

Лицензия

Категории

Категории

Сеть Netty Networking
Группа

Группа

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

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

rxnetty-rest-router
Последняя версия

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

0.2
Дата

Дата

Тип

Тип

jar
Описание

Описание

rxnetty-rest-router
null
Ссылка на сайт

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

https://github.com/diegopacheco/rxnetty-rest-router
Система контроля версий

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

https://github.com/diegopacheco/rxnetty-rest-router.git

Скачать rxnetty-rest-router

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

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

Зависимости

compile (6)

Идентификатор библиотеки Тип Версия
io.reactivex : rxnetty jar 0.5.1
com.google.inject : guice jar 4.1.0
org.glassfish.jersey.core : jersey-server jar 2.7
org.glassfish.jersey.containers : jersey-container-servlet-core jar 2.7
org.glassfish.jersey.containers : jersey-container-jetty-http jar 2.7
org.slf4j : slf4j-log4j12 jar 1.7.25

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12

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

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

rxnetty-rest-router

This project is a simple sample of a JAX-RS Jesery router for RxNetty Server.

Features

  • RxNetty Builder
  • Jersey Router
  • Support for @PathParam annotation in class and method level.
  • Converts results to observables if they are not Observables.
  • Guice 4 Integration and Support
  • Inject Request and Response parameters if method signature present.

Future Work(Pending)

  • Add Suport for @QueryParam
  • Add Support other typez like Long, Double and Boolean

Usage

You can find the jar at sonatype central repository https://oss.sonatype.org/service/local/repositories/releases/content/com/github/diegopacheco/rxnetty-rest-router/0.2/

Maven

<dependency>
  <groupId>com.github.diegopacheco</groupId>
  <artifactId>rxnetty-rest-router</artifactId>
  <version>0.2</version>
</dependency>

Gradle

dependencies {
	compile([
	       'com.github.diegopacheco:rxnetty-rest-router:0.2'
        ])
}

Sample

ServerApp.java

public class ServerApp{
   public static void main(String[] args){
       new RxNettyServerBuilder()
        .withPort(9090)
        .withPackages("com.github.diegopacheco.rxnetty.builder.test")
        .withModules(new Module[]{new GuiceModule()})
        .start();
   }
}

GuiceModule

import com.google.inject.AbstractModule;

public class GuiceModule extends AbstractModule{

	@Override
	protected void configure() {
		bind(RestInfo.class).asEagerSingleton();
	}

}

RestInfo.java

import javax.ws.rs.GET;
import javax.ws.rs.Path;

import io.netty.buffer.ByteBuf;
import io.reactivex.netty.protocol.http.server.HttpServerRequest;
import io.reactivex.netty.protocol.http.server.HttpServerResponse;
import rx.Observable;

@Path("/info")
public class RestInfo {

   @GET
   @Path("rr")
   public Observable<String> workObRes(HttpServerRequest<ByteBuf> req,HttpServerResponse<ByteBuf> resp){
	resp.setHeader("CREATED_BY", "DIEGO");
	return Observable.just("OKReqResp");
   }

   @GET
   @Path("now")
   public String work(){
	return "OK";
   }

  @GET
  @Path("path/{a}/{b}")
  public String query(@PathParam("a") String a, @PathParam("b") String b){
       return "Path: " +  a + " - " + b;
  }

}

Testing

curl -v http://127.0.0.1:9090/info/now
curl -v http://127.0.0.1:9090/info/rr
curl -v http://127.0.0.1:9090/info/path/10/6

Release

0.2

  • Support for @PathParam annotation in class and method level.

0.1

  • RxNetty Builder
  • Jersey Router
  • Converts results to observables if they are not Observables.
  • Guice 4 Integration and Support
  • Inject Request and Response parameters if method signature present.

Cheers,
Diego Pacheco

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

Версия
0.2
0.1