HttpGet seems to be cached - Response do not change

View: New views
2 Messages — Rating Filter:   Alert me  

HttpGet seems to be cached - Response do not change

by mz8lenvp05gyb78 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello everyone,

i got a problem with the HttpClient Component. I poll a website every 5
minutes to track the changes of it. But when it changes the reponse
string does not change. I'm using a class which implements the runnable
interface and use ScheduledThreadPoolExecutor for executing the thread
every specified time. I'm ignoring all cookies with a self written
CookieSpecFactory.

client = new DefaultHttpClient();
((DefaultHttpClient)
client).getCookieSpecs().register(IgnoringSpecFactory.IGNORE, new
IgnoringSpecFactory());
client.getParams().setParameter("http.protocol.cookie-policy",
IgnoringSpecFactory.IGNORE);

Due a debug session i know:

    * The Runnable instance is the same at every pass.
    * The HttpClient instnace is the same ar every pass.

The only problem is, that the content do not change, although the
website changes. The rest of the code in the run-Mehthod:

HttpGet get = new HttpGet(url);
ResponseHandler<String> handle = new BasicResponseHandler();
String response = client.execute(get, handle);
client.getConnectionManager().closeExpiredConnections();

I'm looking forward for some hints.

Regards,
Benjamin

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@...
For additional commands, e-mail: httpclient-users-help@...


Re: HttpGet seems to be cached - Response do not change

by olegk :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sun, 2009-09-20 at 23:05 +0200, mz8lenvp05gyb78 wrote:

> Hello everyone,
>
> i got a problem with the HttpClient Component. I poll a website every 5
> minutes to track the changes of it. But when it changes the reponse
> string does not change. I'm using a class which implements the runnable
> interface and use ScheduledThreadPoolExecutor for executing the thread
> every specified time. I'm ignoring all cookies with a self written
> CookieSpecFactory.
>
> client = new DefaultHttpClient();
> ((DefaultHttpClient)
> client).getCookieSpecs().register(IgnoringSpecFactory.IGNORE, new
> IgnoringSpecFactory());
> client.getParams().setParameter("http.protocol.cookie-policy",
> IgnoringSpecFactory.IGNORE);
>
> Due a debug session i know:
>
>     * The Runnable instance is the same at every pass.
>     * The HttpClient instnace is the same ar every pass.
>
> The only problem is, that the content do not change, although the
> website changes. The rest of the code in the run-Mehthod:
>
> HttpGet get = new HttpGet(url);
> ResponseHandler<String> handle = new BasicResponseHandler();
> String response = client.execute(get, handle);
> client.getConnectionManager().closeExpiredConnections();
>
> I'm looking forward for some hints.
>
> Regards,
> Benjamin
>

Benjamin,

HttpClient does not cache content. Please turn on the wire logging in
order to see the content of HTTP messages that get sent across the wire,
as described in this document:

http://hc.apache.org/httpcomponents-client/logging.html

Oleg


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@...
For additional commands, e-mail: httpclient-users-help@...