Do you have something in mind for HTTP responses?
At the
moment, the only support for responses is taking what is
returned from the target method, and depending on what the value of
'produces' is and what the client requested, that type will be
returned.
This is what one of the RESTful routes looks like in aerogear-controller-demo:
route()
.from("/hello2")
.consumes("*/*")
.on(RequestMethod.GET)
.produces("application/json")
.to(HelloRest.class).hello(queryParam(String.class,
"firstname"), queryParam(String.class, "lastname"));
So, this produces a JSON response and RestEasy will to this mapping:
curl -i
"http://localhost:8080/aerogear-controller-demo/hello2?firstname=Daniel&lastname=Bevenius"
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: application/json
Transfer-Encoding: chunked
Date: Mon, 22 Oct 2012 13:19:15 GMT
{"msg":"Hello Daniel Bevenius"}
We can certainly add other things and if you let me know what you'd
like to see I'll take a stab at it.
Perhaps we could have something like this:
route()
.from("/hello2")
.consumes("*/*")
.on(RequestMethod.GET)
.produces("application/json")
.response(statusCodeMethodName(msg))
.to(HelloRest.class).hello(queryParam(String.class,
"firstname"), queryParam(String.class, "lastname"));
What do you think?
On 22 October 2012 15:06, Bruno Oliveira <bruno(a)abstractj.org> wrote:
> Awesome Daniel,
>
Do you have something in mind for HTTP responses?
>
>
> --
> "The measure of a man is what he does with power" - Plato
> -
> @abstractj
> -
> Volenti Nihil Difficile
>
> On Friday, October 19, 2012 at 9:24 AM, Daniel Bevenius wrote:
>
> Hi everyone,
>
> I've updated the section "Programmatic endpoint configuration in
> RestEasy" in the gist (
https://gist.github.com/3871798) with progress
> made the last few days. Hopefully this will explain how the current
> configuration works and what options it supports.
>
> If this looks alright, I'll shift focus back to aerogear-controller,
> and look into adding support for things like query/form/header
> parameters etc. This will enable us to update aerogear-controller demo
> with more examples and that way get a better feel for how using the
> programmatic configuration works in real life as opposed to tests.
>
> cheers,
>
> /Dan
> _______________________________________________
> aerogear-dev mailing list
> aerogear-dev(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/aerogear-dev
>
>
>
> _______________________________________________
> aerogear-dev mailing list
> aerogear-dev(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/aerogear-dev
>