All Projects → ibaca → Autorest Nominatim Example

ibaca / Autorest Nominatim Example

Licence: apache-2.0
AutoREST Nominatim [jre, gwt, android, jee] example

Programming Languages

java
68154 projects - #9 most used programming language

Labels

Projects that are alternatives of or similar to Autorest Nominatim Example

mvp4g
A framework to build a gwt application the right way
Stars: ✭ 29 (+222.22%)
Mutual labels:  gwt
gwt-time
Backport of functionality based on JSR-310 to GWT. This is NOT an implementation of JSR-310.
Stars: ✭ 17 (+88.89%)
Mutual labels:  gwt
Joml
A Java math library for OpenGL rendering calculations
Stars: ✭ 479 (+5222.22%)
Mutual labels:  gwt
gwt-material-table
A complex table component designed for the material design specifications
Stars: ✭ 28 (+211.11%)
Mutual labels:  gwt
react4j
An opinionated react java binding
Stars: ✭ 33 (+266.67%)
Mutual labels:  gwt
gwtdo
GWTdo is a .NET library that helps developers write readable tests. It's a DSL based on the Given-When-Then style which could be used in your test projects.GWTdo
Stars: ✭ 23 (+155.56%)
Mutual labels:  gwt
elemento
Builder API and other goodies for Elemental2
Stars: ✭ 90 (+900%)
Mutual labels:  gwt
Jts
JTS Topology Suite
Stars: ✭ 26 (+188.89%)
Mutual labels:  gwt
reactive-wizard
Reactive non-blocking web applications made really easy with JAX-RS and RxJava.
Stars: ✭ 25 (+177.78%)
Mutual labels:  jax-rs
Gwt Material
A Google Material Design wrapper for GWT
Stars: ✭ 386 (+4188.89%)
Mutual labels:  gwt
helloworld-web
Hello World web application in 39 different ways in Java
Stars: ✭ 18 (+100%)
Mutual labels:  gwt
membership
Membership service (to demonstrate graphQL)
Stars: ✭ 19 (+111.11%)
Mutual labels:  jax-rs
Jeddict
Jakarta EE 8 (Java EE) & MicroProfile 3.2 application generator and modeler
Stars: ✭ 358 (+3877.78%)
Mutual labels:  jax-rs
console
HAL management console
Stars: ✭ 41 (+355.56%)
Mutual labels:  gwt
Typescript Generator
Generates TypeScript from Java - JSON declarations, REST service client
Stars: ✭ 729 (+8000%)
Mutual labels:  jax-rs
migrate-Java-EE-app-to-azure
Migrate an existing Java EE workload to Azure
Stars: ✭ 12 (+33.33%)
Mutual labels:  jax-rs
gwty-leaflet
A GWT JsInterop wrapper for Leaflet.
Stars: ✭ 29 (+222.22%)
Mutual labels:  gwt
Feign
Feign makes writing java http clients easier
Stars: ✭ 7,681 (+85244.44%)
Mutual labels:  jax-rs
J2cl
Java to Closure JavaScript transpiler
Stars: ✭ 773 (+8488.89%)
Mutual labels:  gwt
Document Management System
OpenKM is a Open Source Document Management System
Stars: ✭ 373 (+4044.44%)
Mutual labels:  gwt

AutoREST Nominatim Example

AutoREST generates utility code which should help you extract the request data on each endpoint call and use it to populate a request. So in simplified example you define…

@AutoRestGwt @Path("search") interface Nominatim {
  @GET Observable<SearchResult> search(@QueryParam("q") String query);
}

AutoREST generates a Nominatim_RestServiceModel, and you should implement a ResourceVisitor provided as factory to the model, this makes your services instantiations similar to…

Nominatim nominatim = new Nominatim_RestServiceModel(DummyResourceVisitor::new);
nominatim.search("málaga").subscribe(n -> out.println("received " + n));

…on each call to the model (like the previous .search("málaga")) a new visitor (like next one) is evaluated…

class DummyResourceVisitor {
  public ResourceVisitor path(Object... paths) { out.println("path " + Arrays.toString(paths)); return this; }
  public ResourceVisitor param(String key, @Nullable Object value) { out.println("param " + key + "=" + value); return this; }
  public ResourceVisitor method(String method) { out.println("method " + method); return this; }
  public <T> T as(Class<? super T> container, Class<?> type) { return null; }
}

…producing this output "method GET" ⏎ "path [search]" ⏎ "param q=málaga".

Ok, this dummy visitor makes nothing, just print Request configuration, do not even generate a request. Gathering the request data, creating a request and handling the response into the expected type is now your responsibility. BUT this project try to demonstrate how moving the responsibility out of the library and giving to you the full control of the request building, request encoding and response decoding is not only much easier, simpler and clear as you may expect, but also make it almost trivial to extend and customize your services.

AutoREST separates services handling in three responsibilities

  • schema defines the REST service interface and models using JAX-RS standard
  • request the goal of client side services is to create a request to transfer the payload
  • codec the url, headers and request payload should be encoded/decoded

You should note that AutoREST should not build the request (althought include a basic implementation), do not implement codecs, and schema definition uses the standard JAX-RS, so not AutoREST involved neither. For all this, AutoREST should be considered a blueprint which help you organize this responsabilities giving a common template and best practices to keep service implementation clean and simple.

Modules

Client modules of this project shows how to implement the request and codec responsibilities for various environments, API module shows how to define the service schema in one place and share this schema not only between the different client but also with the server implementation.

  • api module contains the Nominatim scheme definition (models as inner classes), and is shared between the other modules
  • client implementations: uses the API to build a request
  • server implementations: uses the API to expose a service
    • server module implements the Nominatim service definition as ResourceNominatim, and exposes it using a jetty + jersey + jackson server. Configuration of this libraries are all here and you can run the server as an plain java using the Main.main.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].