Thanks Marc. It works.
I was using the example just for illustration.
-Arul
Marc Hadley wrote:
> Take a look at the UriInfo interface and UriBuilder. Those allow you
> to construct URIs to resource classes without having to hard code
> anything. E.g.:
>
> @Context UriInfo ui;
> URI bURI = ui.getBaseUriBuilder().path(B.class).build();
>
> BTW, try to avoid method names in URIs. URIs should be used to
> identify resources, not methods.
>
> Marc.
>
> On Jul 1, 2008, at 11:57 AM, Arul Dhesiaseelan wrote:
>
>> Hello,
>>
>> I have 2 resources: A & B
>>
>> I would like to invoke A.m1() from B.m1().
>>
>> I am currently using Jersey Client API in resource B to achieve this.
>>
>> Client c = Client.create();
>> WebResource r =
>> c.resource("http://localhost:8080/rest/A/m1");//c.resource("/rest/A/m1")
>> ?
>> String result = r.accept("text/plain").get(String.class);
>>
>> Is it possible to invoke the method using relative URI than using
>> absolute URI?
>>
>> Thank you,
>> Arul
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>
> ---
> Marc Hadley <marc.hadley at sun.com>
> CTO Office, Sun Microsystems.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>
> ________________________________
> Scanned by MessageLabs for Flux
> ________________________________