1

I have a REST webservice with some methods.

I'm sending requests to the rest with Apache HttpClient 4.

When I make a connection to this rest, in a method that is bigger and slower, it throws a NoHttpResponseException.

After googling, I discovered that the server is cutting down the connection with my client app.

So, I tried to disable the timeout this way :

DefaultHttpClient httpclient = null;
HttpParams params = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(params, 0);
HttpConnectionParams.setSoTimeout(params, 0);
HttpConnectionParams.setStaleCheckingEnabled(params, true);

httpclient = new DefaultHttpClient(params);
httpclient.execute(httpRequest, httpContext);

But it failed. The request dies in 15 seconds (possible default timeout?) Does anyone know the best way to do this?

1 Answer 1

1

I would suggest that you return data to the client before the timeout can occur. This may just be some bytes that says "working" to the client. By trickling the data out, you should be able to keep the client alive.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.