users@jersey.java.net

[Jersey] Re: GET request Redirect to POST

From: douguoqiang <douguoqiang_at_ejianlong.com>
Date: Thu, 28 Mar 2013 09:05:37 +0800

Hi Garrett,

    You can't send a post request in a Response of the Request/Response life cycle. Usually, a Response contain a HTTP 3xx code ,It means that the Browser has received http code command after, the Browser will send a request automatically. The auto request is a specified GET request.

    I do not why do you this requirement. I guess if you must get some result from other REST web service use a Post request, If right, I suggest that you can use HTTPClient APIs send a Post request in your Jersey's resouce class method inner, after HTTPClient request have responsed, You only need to show the result to a view used Jersey's Viewable instance.

Jack.




douguoqiang

From: Garrett Baird
Date: 2013-03-27 09:33
To: users_at_jersey.java.net
Subject: [Jersey] GET request Redirect to POST
Hello all,


How do I receive a GET request in Jersey and redirect to another URL but convert the query string values to a POST request with the former query string parameters as POST parameters?


The use case is a GET request from an email campaign management system (not POST friendly) where my server then needs to return a non-HTML file or redirect to a web page. For the web page redirect, I am just recreating the initial query string and using I want to POST to that URL instead.


Thanks in advance!


-Garrett