Ejemplo n.º 1
0
  private void execute() throws IOException, ClientProtocolException {
    if (resp != null) {
      return;
    }

    if (entity == null) {
      resp = getClient().execute(req);
      return;
    }

    try {
      if (req instanceof HttpEntityEnclosingRequest) {
        HttpEntityEnclosingRequest eReq = (HttpEntityEnclosingRequest) req;
        eReq.setEntity(entity);
      }
      resp = getClient().execute(req);
    } finally {
      entity.close();
      entity = null;
    }
  }
Ejemplo n.º 2
0
 public void setChunkedStreamingMode(int chunklen) {
   if (entity == null) entity = new TemporaryBufferEntity(new LocalFile(null));
   entity.setChunked(true);
 }
Ejemplo n.º 3
0
 public OutputStream getOutputStream() throws IOException {
   if (entity == null) entity = new TemporaryBufferEntity(new LocalFile(null));
   return entity.getBuffer();
 }
Ejemplo n.º 4
0
 public void setFixedLengthStreamingMode(int contentLength) {
   if (entity != null) throw new IllegalArgumentException();
   entity = new TemporaryBufferEntity(new LocalFile(null));
   entity.setContentLength(contentLength);
 }