I'm going to redirect http post request to another server (just changing url and some headers) and using a Servlet for this purpose. In Servlet, i'm using HttpClient to send request and get response. The question is: would these operations send the whole post request to the target? :
copy httpServletRequest headers into httpClient request
and then put httpServletRequest#inputStream in request entity like this:
HttpEntity entity = new InputStreamEntity(httpServletRequest.getInputStream(), someContentType);
I mean is the request = headers + input stream? if not, what else should be copied?
Just to be on same page regarding terminology:
if you want to add headers to the request, redirect is not an option afaik. if you want to forward to another external url, forwarding is not an option.
so, you need to do a new http request to the other site as part of your original request processing. but you must process that original request to extract whatever info you need (not trying to reuse inputstream).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.