0

If a Http server is not reachable, and Http client is trying to send a POST request to the server, will the Post content ever have the opportunity to be sent or no (say error code come back and the code will not be executed)?

More specifically, I have special logic in writeTo function, I would like to know if it is executed or not if Http server is not reachable.

public interface HttpEntity {
  boolean isRepeatable();

  boolean isChunked();

  long getContentLength();

  Header getContentType();

  Header getContentEncoding();

  InputStream getContent() throws IOException, IllegalStateException;

  void writeTo(OutputStream var1) throws IOException;

  boolean isStreaming();

  void consumeContent() throws IOException;
}
shirley
  • 1,640
  • 4
  • 12
  • 19
  • 1
    if the server is not reachable, what could possibly handle the request ? :) – ValLeNain Nov 17 '17 at 18:56
  • But the server could return error code after POST content is sent. I understand the unreachable server can't handle the request. My question is will HttpEntity.writeTo ever be executed. – shirley Nov 17 '17 at 21:40
  • There is a difference between an unreachable server and a server that return an error. In the second case, yes, your POST request can be handled by the server, the payload read and maybe 90% of the work done before the error is thrown. – ValLeNain Nov 17 '17 at 22:14

0 Answers0