This project implements RxGORM for REST web services.
The snapshot documentation is available here:
An implementation of RxGORM as a REST Client
License: Apache License 2.0
This project implements RxGORM for REST web services.
The snapshot documentation is available here:
So I've started playing with RX Gorm(1.0.3) , which looks very promising, but I'm running into several issues. If I run a "get" the json gets populated into the object properly, with dynamic attributes, but if the status is 400, or 500 the onError method isn't called. Why is that?
When I call an "insert"/"save", the JSON I return seems to be ignored for a 200, and it doesn't populate any dynamic attributes, but onError is called for responses for statuses 400 or 500. Also it seems that both end up doing a POST, when the documentation, says that "save" should do a PUT. How do I get the JSON to populate properly, does it expect a status other than 200, 20X? 201 seems to work better for "insert"/"save", but the JSON still doesn't populate the attributes, and I don't get the dynamic attributes.
With Error handling how do I provide information to the onError method, from a server response, and then how do I access that information? It seems like with the RX Gorm I don't have access to the response, is that correct?
The war file deploys successfully without error
The war file does not deploy because the close()
method signature in RxHttpClientBuilder.groovy
throws an exception
Methods annotated with @PreDestroy should not throw a checked exception.
Taking into account that this is a javax.* annotations and checking the documentation https://docs.oracle.com/javaee/7/api/javax/annotation/PreDestroy.html we can see that methods in the Grails source code not fully following the signature according to the Javadoc, thus we may want to adjust the signatures of the the methods that use @PreDestroy
annotation by removing the checked exceptions from them.
Additional logging requested:
It is very difficult to debug problems with the current debug logging. In particular, I was having difficulty creating an interceptor, because the data being sent was being rejected by the REST API, but I could not see the data that was actually being sent. I haven't yet solved this problem.
Additionally, I was able to get another request to return successfully, but the response contained XML for some odd reason, and I got the following exception. I have no way of debugging this, since I can't see the rest of the response content.
20:33:39.993 ERROR - Error querying [Building] object for URI [/api/buildings/id/7]
org.bson.json.JsonParseException: Invalid JSON input. Position: 1. Character: '<'.
at org.grails.datastore.bson.json.JsonScanner.nextToken(JsonScanner.java:95)
...
An example of the data I'm after is what is displayed in web browsers' developer tools:
Feature request: Support JWTs when communicating with the backing REST service.
Currently, when executing an RxGORM for REST lookup, e.g.,
rx.Observable<Employee> observable = Employee.get(1)
Employee employee = observable.toBlocking().first()
a request is seamlessly sent to the backing REST service, e.g.,
http://localhost:3030/employees/1
Basic Authentication is already supported. However, if the REST service relies on JSON Web Tokens (JWTs) for authentication, the RxGORM lookup will fail. Since JWTs seem to the de facto standard for authenticating REST services, it would be really nice if RxGORM for REST would offer seamless support for JWTs.
Great work on this, @graemerocher!
Is it possible to configure RxRestDatastoreClient
for use with HTTPS?
I am attempting to get a POC working using my company's REST API. I got it working easily with HTTP, but HTTPS is failing with a ClosedChannelException
:
...
14:55:41.571 [rxnetty-nio-eventloop-1-1] DEBUG i.n.h.s.u.InsecureTrustManagerFactory - Accepting a server certificate: CN=*.jamf.build, OU=Domain Control Validated
14:55:41.609 [rxnetty-nio-eventloop-1-1] DEBUG io.netty.handler.ssl.SslHandler - [id: 0xf9c6fa76, L:/10.100.249.28:64697 - R:test.jamf.build/10.100.18.14:443] HANDSHAKEN: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
Exception in thread "main" java.lang.RuntimeException: java.nio.channels.ClosedChannelException
at rx.observables.BlockingObservable.blockForSingle(BlockingObservable.java:456)
at rx.observables.BlockingObservable.first(BlockingObservable.java:160)
at rx.observables.BlockingObservable$first.call(Unknown Source) <3 internal calls>
at com.jamf.rxjss.Main.listBuildings(Main.groovy:20)
at com.jamf.rxjss.Main.main(Main.groovy:8) <5 internal calls>
Caused by: java.nio.channels.ClosedChannelException
Process finished with exit code 1
Here is my application code:
// Main.groovy
import org.grails.datastore.mapping.core.*
import org.grails.datastore.rx.rest.*
class Main {
static void main(args) {
init()
listBuildings()
}
static init() {
def configuration = DatastoreUtils.createPropertyResolver(
'grails.gorm.rest.host': 'https://test.jamf.build/api',
'grails.gorm.rest.username': 'admin',
'grails.gorm.rest.password': 'password')
new RxRestDatastoreClient(configuration, Building)
}
static listBuildings() {
def buildings = Building.list().toBlocking().first()
buildings.each { println it.name }
}
}
// Building.groovy
import grails.gorm.annotation.*
import grails.gorm.rx.rest.*
@Entity
class Building implements RxRestEntity<Building> {
Long id
String name
static mapping = {
uri '/buildings/id/{id}'
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.