users@jersey.java.net

[Jersey] Re: Server: Bypassing the WebServer

From: Jakub Podlesak <jakub.podlesak_at_oracle.com>
Date: Wed, 01 Jun 2011 16:19:06 +0200

Hi Stefan,

If the abc/1 abc/2 and join/1-2 are part of the very same
JAX-RS application, then you should be able to do this quite easily:

@Path("abc")
public class AbcResource {
   @Path("{id}")
   @GET
   public String getAbc(@PathParam("id") String id) {
     return MyAppData.get(id);
   }
}

@Path("join")
public class JoinResource {
   @Path("{ids}")
   @GET
   public String getJoin(@PathParam("ids") String ids) {
     JoinData result = new JoinData();

     for (String id : MyUtility.parseIds(ids)) {
       result.add(new AbcResource().getAbc(id));
     }

     return result.toString();
   }
}

But maybe i am missing something?

~Jakub

On 05/31/2011 08:19 PM, Stefan Kaufmann wrote:
> Hello,
>
> I'm using Jersey Server in the main for it's main purpose, a REST Server.
>
> However, I like to add Rest-function which accumulates the output of
> several URL-Paths.
> basically I want to join the output http://server/abc/1 and
> http://server/abc/2 by calling http://server/join/1-2 .
>
> The most obvious way would be, calling both urls - Jersey Server
> internally, by avoiding http (and so the Webserver).
>
> Is this possible?
>
> Thanks in advance,
> Stefan
>