HTTP POST: Reads the contents from the specified reader and sends them to the URL.

@return
the location, as an URI, where the resource is created.
@throws  HttpException
when an exceptional condition occurred during the HTTP method execution.
179516
public String postByRead(
                    final String url,
                    final Reader input,
                    final String media_type
                    )
    {
        String  location = _execute( url, HttpMethod.POST,
                        new ReaderRequestCallback( input, MediaType.parseMediaType( media_type ) ),
                        new LocationHeaderResponseExtractor() );

        return location;
    }
128066
@Override
    public InputStream getInputStream() {
        try {
            LOGGER.debug("getInputStream getExternalIdentifier: {} {} ", property().getName(), getExternalIdentifier());
            return URI.create(getExternalIdentifier()).toURL().openStream();
        } catch (final MalformedURLException e) {
            throw new RepositoryRuntimeException("Malformed URL: " + getExternalIdentifier(), e);
        } catch (final Exception e) {
            throw new RepositoryRuntimeException(e);
        }
    }
409890
public Reader openReader() throws FetchException {
        try {
            return getInternalClobForFetch().getCharacterStream();
        } catch (SQLException e) {
            throw mRepo.toFetchException(e);
        }
    }
1315496
public void readExternal(PofReader reader)
            throws IOException {
        super.readExternal(reader);
        numInc = (Number) reader.readObject(10);
        fPostInc = reader.readBoolean(11);
    }
1317791
@SuppressWarnings("resource")
    @Override
    public InputStream retrieveExternalContent(final URI sourceUri) throws IOException {
        final HttpGet httpGet = new HttpGet(sourceUri);
        final CloseableHttpClient client = getCloseableHttpClient();
        final HttpResponse response = client.execute(httpGet);
        return response.getEntity().getContent();
    }
1047707
public URI getURI() {
        final URI locationURI = getClasspathElementURI();
        final String resourcePath = getPathRelativeToClasspathElement();
        final String locationURIStr = locationURI.toString();
        // Check if this is a directory-based module (location URI will end in "/")
        final boolean isDir = locationURIStr.endsWith("/");
        try {
            return new URI((isDir || locationURIStr.startsWith("jar:") ? "" : "jar:") + locationURIStr
                    + (isDir ? "" : "!/") + resourcePath);
        } catch (final URISyntaxException e) {
            throw new IllegalArgumentException("Could not form URL for classpath element: " + locationURIStr
                    + " ; path: " + resourcePath + " : " + e);
        }
    }
81279
public Reader asReader() {
        Reader r = getReader();
        if (r != null) return r;
        String s = getString();
        if (s != null) return new StringReader(s);
        InputStream is = fromStreamOrBufferOrUrl();
        if (is != null) return readerFrom(is);
        throw resourceUnaccessible();
    }
1108327
private Response followPostRedirect(Response response) throws IOException {
    String location = response.header("Location");
    if (location == null) {
      throw new IllegalStateException(format("Missing HTTP header 'Location' in redirect of %s", response.request().url()));
    }
    HttpUrl url = response.request().url().resolve(location);

    // Don't follow redirects to unsupported protocols.
    if (url == null) {
      throw new IllegalStateException(format("Unsupported protocol in redirect of %s to %s", response.request().url(), location));
    }

    Request.Builder redirectRequest = response.request().newBuilder();
    redirectRequest.post(response.request().body());
    response.body().close();
    return okHttpClient.newCall(redirectRequest.url(url).build()).execute();
  }
1351462
public static Response get(String url) throws HttpException {
		return get(url, null, null, DEFAULT_CONNECT_TIMEOUT, DEFAULT_READ_TIMEOUT);
	}
471291
public int read() throws IOException {
    if (this.bytesRead == this.length) {
      // All chunks and final additional chunk are read.
      // This means we have reached EOF.
      return -1;
    }

    try {
      // Read a chunk from given input stream when
      // it is first chunk or all bytes in chunk body is read
      if (this.streamBytesRead == 0 || this.chunkPos == this.chunkBody.length) {
        // Check if there are data available to read from given input stream.
        if (this.streamBytesRead != this.streamSize) {
          // Send all data chunks.
          int chunkSize = CHUNK_SIZE;
          if (this.streamBytesRead + chunkSize > this.streamSize) {
            chunkSize = this.streamSize - this.streamBytesRead;
          }

          if (readChunk(chunkSize) < 0) {
            return -1;
          }

          this.streamBytesRead += chunkSize;
        } else {
          // Send final additional chunk to complete chunk upload.
          byte[] chunk = new byte[0];
          createChunkBody(chunk);
        }
      }

      this.bytesRead++;
      // Value must be between 0 to 255.
      int value = this.chunkBody[this.chunkPos] & 0xFF;
      this.chunkPos++;
      return value;
    } catch (NoSuchAlgorithmException | InvalidKeyException | InsufficientDataException | InternalException e) {
      throw new IOException(e.getCause());
    }
  }
838720
public <T> HttpClientRequest.Builder<T> post(final URI uri, final HttpClientResponseHandler<T> httpHandler)
    {
        return new HttpClientRequest.Builder<T>(httpClientFactory, HttpClientMethod.POST, uri, httpHandler);
    }
669365
async def _read(self, reader):
        
        start_line = await self._readline(reader)
        self.method, self.location, self.version = start_line.decode().split()
        path_query = urllib.parse.unquote(self.location).split('?', 1)
        self.path = path_query[0]
        self.query = {}
        if len(path_query) > 1:
            for q in path_query[1].split('&'):
                try:
                    k, v = q.split('=', 1)
                    self.query[k] = v
                except ValueError:
                    self.query[q] = None
        self.headers = {}
        while True:
            header_raw = await self._readline(reader)
            if header_raw.strip() == b'':
                break
            header = header_raw.decode().split(':', 1)
            self.headers[header[0]] = header[1].strip()

        # TODO implement chunked handling
        self.data = b''
        await self._buffer_body(reader)
916779
public Object read() throws IOException {
    char[] buffer = new char[BUFFER_LENGTH];
    reader.mark(BUFFER_LENGTH);
    int count = 0;
    int textEnd;

    while (true) {
      int r = reader.read(buffer, count, buffer.length - count);

      if (r == -1) {
        // the input is exhausted; return the remaining characters
        textEnd = count;
        break;
      }

      count += r;
      int possibleMarker = findPossibleMarker(buffer, count);

      if (possibleMarker != 0) {
        // return the characters that precede the marker
        textEnd = possibleMarker;
        break;
      }

      if (count < marker.length()) {
        // the buffer contains only the prefix of a marker so we must read more
        continue;
      }

      // we've read a marker so return the value that follows
      reader.reset();
      String json = reader.readLine().substring(marker.length());
      return jsonParser.parse(json);
    }

    if (count == 0) {
      return null;
    }

    // return characters
    reader.reset();
    count = reader.read(buffer, 0, textEnd);
    return new String(buffer, 0, count);
  }
1095307
@Override
    public InputStream getDocument(URI documentUri) throws DocumentException {

        if (!documentExists(documentUri)) {
            return null;
        }

        File dir = new File(this.getDocumentInternalUri(documentUri));
        for (File file : dir.listFiles()) {
            if (file.getName().matches("^index\\..*")) {
                InputStream result = null;
                try {
                    result = new FileInputStream(file);
                } catch (IOException e) {
                    throw new DocumentException(e);
                }
                return result;
            }
        }
        return null;
    }
121350
protected Reader toReader(Object input) throws IOException {
        if (input instanceof Reader) {
            return (Reader) input;
        }

        if (input instanceof InputStream) {
            return new InputStreamReader((InputStream) input);
        }

        if (input instanceof String) {
            return new StringReader((String) input);
        }

        if (input instanceof URL) {
            return new InputStreamReader(((URL) input).openStream());
        }

        if (input instanceof File) {
            return new FileReader((File) input);
        }

        throw new IllegalArgumentException("Unable to turn " + input + " into reader");
    }
34038
public String body() throws HttpException {
		try {
			return HttpUtil.getString(bodyBytes(), this.charset, null == this.charsetFromResponse);
		} catch (IOException e) {
			throw new HttpException(e);
		}
	}
1032386
public ReadStream openRead()
    throws IOException
  {
    if (_isDone)
      return null;
    else if (_readStream == null)
      _readStream = new ReadStream(this);
    else if (!_isPartDone) {
      int len;
      while ((len = read(_dummyBuffer, 0, _dummyBuffer.length)) >= 0) {
      }

      if (_isDone)
        return null;
    }

    _readStream.init(this);

    _isPartDone = false;

    if (scanHeaders()) {
      String contentType = (String) getAttribute("content-type");

      String charset = getAttributePart(contentType, "charset");

      // FIXME: 2016-05-14 
/*
      if (charset != null)
        _readStream.setEncoding(charset);
      else if (_defaultEncoding != null)
        _readStream.setEncoding(_defaultEncoding);
*/

      return _readStream;
    }
    else {
      _isDone = true;
      _readStream.close();
      return null;
    }
  }