On Fri, 2011-10-14 at 10:24 -0700, Ken Hausam wrote:
> I would like instructions on how to setup a custom reason phrase catalog.
> Specifically, I would like to disable use of the reason phrase lookup catalog
> and have the actual reason phrase returned from the server available to me
> via the API.
>
> I found some documentation on BasicHttpResponse constructor that says if I
> pass null for the catalog parameter, I will disable automatic
> reason phrase lookup. Problem is, I don't know how
> to construct my own HttpResponse. It is being constructed for me by the
> DefaultHttpClient.execute() method. Also looked at the
> DefaultHttpResponseFactory javadoc, but could not figure out how to register
> my own factory.
>
> Here is my relevant code. If someone could reply back with the code changes
> needed to disable automatic use of the reason phrase catalog, I'd appreciate
> it.
>
> HttpGet httpGet = new HttpGet("http://localhost:8080/myendpoint");
> HttpResponse httpResponse = new
> DefaultHttpClient().execute(httpGet);
> HttpEntity responseEntity = httpResponse.getEntity();
> EntityUtils.consume(responseEntity);
>
> StatusLine statusLine = httpResponse.getStatusLine();
> String reasonPhrase = statusLine.getReasonPhrase();
>
>
> Thanks,
> Ken
Ken
HttpClient returns all properties of the response status line _exactly_
as they were generated by the server. Please see code of BasicLineParser
in HttpCore and DefaultResponseParser in HttpClient in case you want to
double-check.
Oleg
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]