You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Ken Hausam <ka...@yahoo.com> on 2011/10/14 19:24:47 UTC

disable automatic reason phrase lookup

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

Re: disable automatic reason phrase lookup

Posted by Ken Hausam <ka...@yahoo.com>.
Yes. Thank you for the reply. Just realized that this wasn't the problem. The problem is between the chair and keyboard. :)



--- On Fri, 10/14/11, Oleg Kalnichevski <ol...@apache.org> wrote:

From: Oleg Kalnichevski <ol...@apache.org>
Subject: Re: disable automatic reason phrase lookup
To: kah_12831@yahoo.com
Cc: httpclient-users@hc.apache.org
Date: Friday, October 14, 2011, 3:23 PM

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


Re: disable automatic reason phrase lookup

Posted by Oleg Kalnichevski <ol...@apache.org>.
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: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org