views:

14

answers:

1

Is HttpURLConnection.HTTP_CLIENT_TIMEOUT is true, then does this mean session expired?

If yes,

Then, does this same as, cookie expiry ?

+1  A: 

From HTTP/1.1 Status Code Definitions:

10.4.9 408 Request Timeout

The client did not produce a request within the time that the server was prepared to wait. The client MAY repeat the request without modifications at any later time.

It has nothing to do with sessions or cookies. The client simply didn't complete a request within the expected time and the server gave up waiting for the client to finish. This can be caused when the client didn't write anything to the request body while the spec requires that (e.g. you're using POST, but not sending anything), or when the client didn't supply a Connection: Close header.

BalusC
Ok thanks, actually i need to use cookies so that every time user should not be asked for authentication. I've to write a program, Its not servlet program, it is a program where program itself is acting like client(browser).Plz help how to proceed with this, any hints will be very helpful.
udy
I've clarified the answer a bit more with several possible causes. Further, you may find this topic useful to learn more how to use `URLConnection` properly: http://stackoverflow.com/questions/2793150/how-to-use-java-net-urlconnection-to-fire-and-handle-http-requests
BalusC