Jersey - Redirecting using Get Not Put causes a redirect loop

I am working on a web application that uses jersey. I am trying to implement things obtained after publication using URIBuilder and seeOther. The goal is to redirect to the same URI in which the browser is already on, but to force a GET. It works something like this:

  • The request comes through PUT
  • PUT request processed
  • See the Returned Answer.

What should happen is that the browser takes 303 See Other and performs a GET in the URI that it receives. Unfortunately, it happens that it does PUT on a URI instead (as far as I can tell), and PUT sends it back to Step 1. above, causing a redirect loop.

Any ideas what is going wrong here?

   private Response giveSeeOther(){
  /*Get the base URI builder*/
  final UriBuilder uriBuilder = m_uriInfo.getBaseUriBuilder();

  /* Some stuff to create the URI */
  final Map<String, Object> parameterMap = new HashMap<String, Object>();
  parameterMap.put("uid", getUid());

  final URI redirectUri = uriBuilder.path(SomeObject.class).
                                     path(SomeObject.class, "get").
                                     buildFromMap(parameterMap);

  /* See Other (303) */
  return Response.seeOther(redirectUri).build();}

. , , .

+5
1

HTTP 301.

303, POST . 301, " " GET.

, , - , POST , "" - ( " " ) do), "" , .

. , cookie, "" , , GET. , - 82838, "" , :

http://www.example.com/order/thank-you.pl?orderid=82838

, , "" , , ( , "" - "" { }, , , ).

, .

+8

All Articles