users@jersey.java.net

[Jersey] Client not following redirects

From: Joe Mifsud <jmif96_at_gmail.com>
Date: Thu, 11 Jun 2015 13:01:19 -0700 (PDT)

Hi all,


I have a very simple implementation of a Jersey 2.18 client (pasted below).  I’m using the standard Jersey connector (not importing any others) but for a simple request (also pasted below) the response I’m receiving is a 302 redirect.  My understanding is the client should be transparently following these and I should receive the 200 back.  Am I misunderstanding something?  Implementing something wrong?


Thanks,
Joe Mifsud


JacksonJsonProvider jsonProvider = new JacksonJsonProvider(new ObjectMapper());

_client = ClientBuilder.newClient(new ClientConfig());
_client.register(jsonProvider);
_client.property(ClientProperties.FOLLOW_REDIRECTS, false);_baseTarget = _client.target(“..”)WebTarget target = _baseTarget
        .queryParam(“…”, “…”)Invocation.Builder builder = target.request(MediaType.APPLICATION_JSON_TYPE);
Response response = builder.get();



Sent from Mailbox