Thanks Lincoln, great ideas! The RESTEasy Client Framework also
allows reusing of JAX-RS annotated interfaces, so we can have an interface
@Path("/users")
public interface UserService
{
@GET
List<User> searchUsers(@QueryParam("search") String
query,@QueryParam("start") int start, @QueryParam("limit") int
limit);
}
which is implemented by the server. Then on the client, we can reuse it an simply do:
@Inject @RestService(url="http://example.com/users")
private UserService users;
...
List<User> jozefs = users.searchUsers("Jozef", 0, 20);
which gets translated to the following and sent to the server:
GET
http://example.com/users?search=Jozef&start=0&show=20
The response is unmarshalled automatically.
I've opened
https://jira.jboss.org/browse/SEAMREST-5 Feel free to add.
On 10/29/2010 03:43 PM, Lincoln Baxter, III wrote:
> Yes, exactly! Though I suppose if they are using RestEasy they will have
> this functionality by default, as you suggest. I wasn't thinking clearly
> when I wrote this, however. You are very correct. If RestEasy is already
> on the classpath, it should probably provide injection for web-service
> endpoints (via @Qualifer) annotations.
>
> @Inject @RestEndpoint
> private Endpoint<DataService> endpoint;
>
> The endpoint could then provide access to things like the HttpClient,
> the Request object, methods to invoke:
>
> endpoint.sendRequest();
> endpoint.getResponse();
>
> And would take care of the bootstrap / typing / (un)marshalling, etc...
>
> Pretty much a super-quick way of specifying a web-service endpoint and
> invoking it via RestEasy Client Framework (under the covers of course)
> If there's an easier way, then this wouldn't be needed, but that's my
> thought!
>
> --Lincoln
>
> On Fri, Oct 29, 2010 at 4:09 AM, Jozef Hartinger <jharting(a)redhat.com
> <mailto:jharting@redhat.com>> wrote:
>
> Do you mean making a fork of the client framework in seam-rest or
> providing an integration with it (available when RESTEasy is on
> classpath)? I'll add it to the project ideas page.
>
>
> On 10/27/2010 04:06 PM, Lincoln Baxter, III wrote:
>
> Excellent! I think that's a good call, and will help people adopt!
>
> Have we considered moving the RestEast Client Framework into Seam
> RestEasy, or at least pulling it in if we are not already? That
> might be
> another sweet feature to help wet people's appetite.
>
> Since we're no longer directly targeting RESTEasy, having a client
> consumer framework available to them would no longer be a
> "standard,"
> but it certainly would be nice.
>
> I think we should consider this if not already done.
> --Lincoln
>
> On Wed, Oct 27, 2010 at 6:29 AM, Pete Muir
> <pmuir(a)bleepbleep.org.uk <mailto:pmuir@bleepbleep.org.uk>
> <mailto:pmuir@bleepbleep.org.uk
> <mailto:pmuir@bleepbleep.org.uk>>> wrote:
>
> Jozef has decided to target this module at the JAX-RS
> standard only,
> therefore the module name has changed slightly. We renamed
> the repo
> on github accordingly.
> _______________________________________________
> seam-dev mailing list
> seam-dev(a)lists.jboss.org <mailto:seam-dev@lists.jboss.org>
> <mailto:seam-dev@lists.jboss.org
<mailto:seam-dev@lists.jboss.org>>
>
>
https://lists.jboss.org/mailman/listinfo/seam-dev
>
>
>
>
> --
> Lincoln Baxter, III
>
http://ocpsoft.com
>
http://scrumshark.com
> "Keep it Simple"
>
>
>
> _______________________________________________
> seam-dev mailing list
> seam-dev(a)lists.jboss.org <mailto:seam-dev@lists.jboss.org>
>
https://lists.jboss.org/mailman/listinfo/seam-dev
>
>
>
>
> --
> Lincoln Baxter, III
>
http://ocpsoft.com
>
http://scrumshark.com
> "Keep it Simple"