You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Ketan Kaushikbhai Patel <kk...@drexel.edu> on 2003/09/27 21:09:17 UTC
capturing http post response parameters.
I have a java application that makes an http post request to an
external web application using the HttpClient. The external web
application returns back the result as an XML document in the main
body. In addition to this, the external web application also returns
some information via URL query string. How can I capture the query
string values?
Will httpPostMethod.getParameters() return the query string parameters.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org
Re: capturing http post response parameters.
Posted by Michael Becke <be...@u.washington.edu>.
Hello,
The response to a HTTP post contains a status line, headers, and
usually a body.
The status line basically just contains a code indicating the status of
the request. This can be retrieved via getStatusCode().
The headers contain a variety of meta-information about the request.
For example whether or not the connection should be closed, the content
type and length of the body. The headers can be accessed using
getResponseHeaders().
The final part is the body, which it seems you have already discovered.
I am unsure of what the returned query string is that you mention. My
only guess is that the post is returning a redirect (one of the 3XX
status codes). Redirects are generally accompanied by a Location
header that contains the URI to redirect to. Please take a look at the
redirects documentation
<http://jakarta.apache.org/commons/httpclient/redirects.html> for some
more detail.
Mike
On Saturday, September 27, 2003, at 03:09 PM, Ketan Kaushikbhai Patel
wrote:
> I have a java application that makes an http post request to an
> external web application using the HttpClient. The external web
> application returns back the result as an XML document in the main
> body. In addition to this, the external web application also returns
> some information via URL query string. How can I capture the query
> string values?
> Will httpPostMethod.getParameters() return the query string parameters.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> commons-httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> commons-httpclient-dev-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org