Discussion:
[dart-misc] Is it possible to have a dart adapter to GWT's request factory 'protocol' ?
Zied Hamdi OneView
2016-10-18 10:35:44 UTC
Permalink
Hi all,

I just learned dart for a new project, and I wanted to evaluate the time
needed to progressively migrate an existing GWT huge project to dart. One
of the bloquing steps is the ability to rapidly build method calls from the
client on the server (as GWT's request factory does). This implies huge
tiem writing routines of JSON encoding and decoding of the return value,
the parameters, the exceptions...

I thought a code generator could do this job, and while doing it, make the
payload compatible with GWT's one to allow light transition.

I also searched for a scaffolding template for dart on Spring roo, that
doesn't exist neither. This could also be a great idea to gain dart users
following dart's best practices from their first app.

Naturally I could develop those ideas, but I have to pay my bills, so I'm
throwing the message publicly if anyone could be interested in doing it.


Best regards,
Zied
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Jan Mostert
2016-10-18 16:23:51 UTC
Permalink
IMO Spring ROO generates clunky code with lots of unnecessary dependencies
and if you want anything REST,
chances are Spring ROO will give you Spring MVC with a boatload of other
dependencies that eventually spits out a 20MB war file that needs to be
dropped in a container.

If you want to setup communication between your dart application and your
Java backend, have a look at Vert.X, very little boilerplate needed to get
plenty done, I hardly notice it when having to write a new endpoint.

This is Kotlin code, but you can do the same things in Java - with a few
lines of code I can run a complete REST server that compiles to a tiny JAR
file and that I can run anywhere without the need for a container. If I
need more endpoints, I simply add another router.handleJsonGet /
router.handleJsonPost

fun Router.handleJsonGet(path: String, method: (any: Any) -> Any) {
this.get(path).handler {
val map: MultiMap = it.request().params() ?:
MultiMap.caseInsensitiveMultiMap()
it.response().putHeader("Content-Type",
"application/json").end((gson.toJson(method(map))))
}
}


Main Method:

val vertx = Vertx.vertx()

val router = Router.router(vertx)

router.handleJsonGet("/business/list", method = {
BusinessService.listBusinesses(it as MultiMap) })
router.handleJsonGet("/autocomplete/industrygroup", method = {
AutocompleteService.listIndustryGroups(it as MultiMap) })

If you don't like the JSON, there are other alternatives like Protobuf It's
been years since I've used GWT, can't remember the dataformat it was using.
The GWT RPC protocol looks a lot like some of the other protobuf-like
things Google created
https://docs.google.com/document/d/1eG0YocsYYbNAtivkLtcaiEE5IOF5u4LUol8-LL0TIKU/edit


Keep us posted if you build some sort of generator, I'm considering doing
it, but haven't had the time to do so yet.
Post by Zied Hamdi OneView
Hi all,
I just learned dart for a new project, and I wanted to evaluate the time
needed to progressively migrate an existing GWT huge project to dart. One
of the bloquing steps is the ability to rapidly build method calls from the
client on the server (as GWT's request factory does). This implies huge
tiem writing routines of JSON encoding and decoding of the return value,
the parameters, the exceptions...
I thought a code generator could do this job, and while doing it, make the
payload compatible with GWT's one to allow light transition.
I also searched for a scaffolding template for dart on Spring roo, that
doesn't exist neither. This could also be a great idea to gain dart users
following dart's best practices from their first app.
Naturally I could develop those ideas, but I have to pay my bills, so I'm
throwing the message publicly if anyone could be interested in doing it.
Best regards,
Zied
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Jan Mostert
2016-10-18 17:11:51 UTC
Permalink
PS, don't forget to look at Angular2 Dart, the little bit of time you'll
lose writing your own communication layer on top of VertX,
you'll make up 10-fold by using Angular2 Dart
Post by Jan Mostert
IMO Spring ROO generates clunky code with lots of unnecessary dependencies
and if you want anything REST,
chances are Spring ROO will give you Spring MVC with a boatload of other
dependencies that eventually spits out a 20MB war file that needs to be
dropped in a container.
If you want to setup communication between your dart application and your
Java backend, have a look at Vert.X, very little boilerplate needed to get
plenty done, I hardly notice it when having to write a new endpoint.
This is Kotlin code, but you can do the same things in Java - with a few
lines of code I can run a complete REST server that compiles to a tiny JAR
file and that I can run anywhere without the need for a container. If I
need more endpoints, I simply add another router.handleJsonGet /
router.handleJsonPost
fun Router.handleJsonGet(path: String, method: (any: Any) -> Any) {
this.get(path).handler {
val map: MultiMap = it.request().params() ?: MultiMap.caseInsensitiveMultiMap()
it.response().putHeader("Content-Type", "application/json").end((gson.toJson(method(map))))
}
}
val vertx = Vertx.vertx()
val router = Router.router(vertx)
router.handleJsonGet("/business/list", method = { BusinessService.listBusinesses(it as MultiMap) })
router.handleJsonGet("/autocomplete/industrygroup", method = { AutocompleteService.listIndustryGroups(it as MultiMap) })
If you don't like the JSON, there are other alternatives like Protobuf
It's been years since I've used GWT, can't remember the dataformat it was
using. The GWT RPC protocol looks a lot like some of the other
protobuf-like things Google created
https://docs.google.com/document/d/1eG0YocsYYbNAtivkLtcaiEE5IOF5u4LUol8-LL0TIKU/edit
Keep us posted if you build some sort of generator, I'm considering doing
it, but haven't had the time to do so yet.
Hi all,
I just learned dart for a new project, and I wanted to evaluate the time
needed to progressively migrate an existing GWT huge project to dart. One
of the bloquing steps is the ability to rapidly build method calls from the
client on the server (as GWT's request factory does). This implies huge
tiem writing routines of JSON encoding and decoding of the return value,
the parameters, the exceptions...
I thought a code generator could do this job, and while doing it, make the
payload compatible with GWT's one to allow light transition.
I also searched for a scaffolding template for dart on Spring roo, that
doesn't exist neither. This could also be a great idea to gain dart users
following dart's best practices from their first app.
Naturally I could develop those ideas, but I have to pay my bills, so I'm
throwing the message publicly if anyone could be interested in doing it.
Best regards,
Zied
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Loading...