users@jersey.java.net

Re: [Jersey] Adding Header to Response

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 22 Oct 2009 11:45:47 +0200

On Oct 22, 2009, at 11:38 AM, Andy wrote:

> On 21.10.2009 18:57, Paul Sandoz wrote:
>> On Oct 21, 2009, at 6:40 PM, Andy wrote:
>>> Hi,
>>>
>>> how can I add an additional header to this call:
>>> Response.temporaryRedirect(uri).build()
>> Response.temporaryRedirect(uri).header("X-FOO", "foo").build()
> Somehow it doesn't work. I have set up a mock-up server that
> receives this message an prints out all header fields. The result
> looks like this "user-agent, host, accept, connection" but the
> header field "X-FOO" is missing.

What about the Location header?

Perhaps you are observing the response to the request made to the
redirected URI?

What client are you using? is it performing automatic redirection on
requests?

Paul.

> This is my code:
>
> @Path("mypath")
> @GET
> @Produces(MediaType.APPLICATION_JSON)
> public Response myMethod() {
> URI uri = UriBuilder.fromUri("http://localhost:9998/mockup/
> dummy").build();
> return Response.temporaryRedirect(uri).header("X-FOO",
> "foo").build();
> }
>
> Andy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>