net.i2p.util

## Class EepPost

- java.lang.Object
- - net.i2p.util.EepGet
  - - net.i2p.util.EepPost

-     public class EepPost
      extends EepGet

  Extends EepGet for POST. Adapted from old jrandom EepPost, removed 2012 as unused. Ref: RFC 7578

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class net.i2p.util.EepGet

      `EepGet.AUTH_MODE, EepGet.AuthState, EepGet.CLIStatusListener, EepGet.Gunzipper, EepGet.StatusListener`

  - ### Field Summary

    - ### Fields inherited from class net.i2p.util.EepGet

      `_aborted, _acceptRanges, _actualURL, _alreadyTransferred, _authState, _bytesRemaining, _bytesTransferred, _cacheControl, _contentEncoding, _contentLanguage, _contentType, _context, _cookie, _csp, _currentAttempt, _decompressException, _encodingChunked, _etag, _etagOrig, _expiryDate, _extraHeaders, _fetchHeaderTimeout, _fetchInactivityTimeout, _fetchTotalTimeout, _isGzippedResponse, _keepFetching, _lastModified, _lastModifiedOrig, _listeners, _log, _notModified, _numRetries, _out, _outputFile, _outputStream, _proxy, _proxyHost, _proxyIn, _proxyOut, _proxyPort, _redirectLocation, _redirects, _referrerPolicy, _responseCode, _responseText, _server, _shouldProxy, _shouldWriteErrorToOutput, _status, _transferEncoding, _transferFailed, _url, _vary, _xContentTypeOptions, _xframeOptions, _xPoweredBy, _xssProtection, CONNECT_TIMEOUT, INACTIVITY_TIMEOUT, MAX_COMPLETE_FAILS, USER_AGENT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `EepPost(I2PAppContext ctx, String proxyHost, int proxyPort, int numRetries, String outputFile, String url)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `fetch()` Blocking fetch, returning true if the URL was retrieved, false if all retries failed.
    `boolean` | `fetch(long fetchHeaderTimeout)` Blocking fetch, timing out individual attempts if the HTTP response headers don't come back in the time given.
    `boolean` | `fetch(long fetchHeaderTimeout, long totalTimeout, long inactivityTimeout)` Blocking fetch.
    `static void` | `main(String[] args)` EepPost [-p 127.0.0.1:4444] [-n #retries] url
    `boolean` | `post(Map<String,Object> fields, long headerTimeout, long totalTimeout, long inactivityTimeout)` Submit an HTTP POST to the given URL (using the proxy if specified), uploading the given fields.
    `boolean` | `post(String contentType, byte[] data, long headerTimeout, long totalTimeout, long inactivityTimeout)` In-memory, not for large POSTs
    `boolean` | `post(String contentType, File data, long headerTimeout, long totalTimeout, long inactivityTimeout)` For large POSTs
    `boolean` | `post(String contentType, String data, long headerTimeout, long totalTimeout, long inactivityTimeout)` In-memory, not for large POSTs

    - ### Methods inherited from class net.i2p.util.EepGet

      `addAuthorization, addHeader, addStatusListener, doFetch, getAcceptRanges, getCacheControl, getContentEncoding, getContentLanguage, getContentType, getCookie, getCSP, getEtag, getExpiryDate, getLastModified, getNotModified, getReferrerPolicy, getRequest, getServer, getStatus, getStatusCode, getStatusText, getTransferEncoding, getVary, getXContentTypeOptions, getXframeOptions, getXPoweredBy, getXSSProtection, parseAuthArgs, readChunkLength, readHeaders, sendRequest, setPostData, setPostData, setPostData, setWriteErrorToOutput, shouldReadBody, stopFetching, suggestName`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### EepPost

          public EepPost(I2PAppContext ctx,
                         String proxyHost,
                         int proxyPort,
                         int numRetries,
                         String outputFile,
                         String url)

  - ### Method Detail

    - #### fetch

          public boolean fetch()

      Description copied from class: `EepGet`
      Blocking fetch, returning true if the URL was retrieved, false if all retries failed. Header timeout default 45 sec, total timeout default none, inactivity timeout default 60 sec.
      Overrides:
        `fetch` in class `EepGet`
      Returns:
        success
      Throws:
        `UnsupportedOperationException` - always

    - #### fetch

          public boolean fetch(long fetchHeaderTimeout)

      Description copied from class: `EepGet`
      Blocking fetch, timing out individual attempts if the HTTP response headers don't come back in the time given. If the timeout is zero or less, this will wait indefinitely. Total timeout default none, inactivity timeout default 60 sec.
      Overrides:
        `fetch` in class `EepGet`
      Returns:
        success
      Throws:
        `UnsupportedOperationException` - always

    - #### fetch

          public boolean fetch(long fetchHeaderTimeout,
                               long totalTimeout,
                               long inactivityTimeout)

      Description copied from class: `EepGet`
      Blocking fetch.
      Overrides:
        `fetch` in class `EepGet`
      Parameters:
        `fetchHeaderTimeout` - <= 0 for none (proxy will timeout if none, none isn't recommended if no proxy)
        `totalTimeout` - <= 0 for default none
        `inactivityTimeout` - <= 0 for default 60 sec
      Returns:
        success
      Throws:
        `UnsupportedOperationException` - always

    - #### main

          public static void main(String[] args)

      EepPost [-p 127.0.0.1:4444] [-n #retries] url

    - #### post

          public boolean post(Map<String,Object> fields,
                              long headerTimeout,
                              long totalTimeout,
                              long inactivityTimeout)

      Submit an HTTP POST to the given URL (using the proxy if specified), uploading the given fields. If the field's value is a File object, then that file is uploaded, and if the field's value is a String object, the value is posted for that particular field. Multiple values for one field name is not currently supported. Large files will be copied to a temp file. For large String content, consider the post(File) method. Note: param field values must be String or File.

    - #### post

          public boolean post(String contentType,
                              byte[] data,
                              long headerTimeout,
                              long totalTimeout,
                              long inactivityTimeout)

      In-memory, not for large POSTs

    - #### post

          public boolean post(String contentType,
                              File data,
                              long headerTimeout,
                              long totalTimeout,
                              long inactivityTimeout)

      For large POSTs

    - #### post

          public boolean post(String contentType,
                              String data,
                              long headerTimeout,
                              long totalTimeout,
                              long inactivityTimeout)

      In-memory, not for large POSTs