public interface

INet

com.pnfsoftware.jeb.util.net.INet
Known Indirect Subclasses

Class Overview

Convenience network utility interface to issue common GET/POST (http or https) queries that return text contents. The primary network utility class in this package implements this interface.

See Also

Summary

Public Methods
abstract long downloadBinary(File dstfile, String url, Map<String, String> urlParams, Map<String, String> serverHeaders, IProgressCallback progressCallback)
Download a binary and dump it to disk.
abstract INet duplicate()
Duplicate this object to perform safe parameter update.
abstract int getConnectTimeout()
abstract int getReadTimeout()
abstract SecureSocketInfo getSecureSocketInfo()
abstract String getUserAgent()
abstract int getWriteTimeout()
abstract String post(String url, Map<String, String> urlParams, Map<String, String> bodyParams, Map<String, String> serverHeaders)
Perform an http POST request to send a simple form.
abstract String post(String url, Map<String, String> urlParams, Map<String, String> bodyParams)
@return
abstract String postMultipart(String url, Map<String, String> formParams, Map<String, FormFileEntry> formFiles, Map<String, String> serverHeaders)
Perform an http POST request to send a form using the multipart/form-data encoding.
abstract String postMultipart(String url, Map<String, String> formParams, Map<String, FormFileEntry> formFiles)
@return
abstract String query(String url, Map<String, String> parameters, Map<String, String> serverHeaders)
Perform an http GET request.
abstract String query(String url)
Perform an http GET request.
abstract String query(String url, Map<String, String> parameters)
@return
abstract byte[] queryBinary(String url, Map<String, String> parameters)
@return
abstract byte[] queryBinary(String url, Map<String, String> urlParams, Map<String, String> serverHeaders, IProgressCallback progressCallback)
Perform an http GET request.
abstract byte[] queryBinary(String url, Map<String, String> parameters, Map<String, String> serverHeaders)
Perform an http GET request.
abstract byte[] queryBinary(String url)
Perform an http GET request.
abstract void setConnectTimeout(int timeout)
abstract void setReadTimeout(int timeout)
abstract void setSecureSocketInfo(SecureSocketInfo info)
abstract void setUserAgent(String userAgent)
abstract void setWriteTimeout(int timeout)

Public Methods

public abstract long downloadBinary (File dstfile, String url, Map<String, String> urlParams, Map<String, String> serverHeaders, IProgressCallback progressCallback)

Download a binary and dump it to disk. Similar to queryBinary(String, Map, Map, IProgressCallback), but the downloaded data is not stored and returned, therefore making this method more suitable to download Large files.

Parameters
progressCallback optional listener
Returns
  • the server response
Throws
IOException

public abstract INet duplicate ()

Duplicate this object to perform safe parameter update.

Returns
  • a new net object with the same properties as this object (timeouts, user-agent, etc.)

public abstract int getConnectTimeout ()

Returns
  • timeout in milliseconds

public abstract int getReadTimeout ()

Returns
  • timeout in milliseconds

public abstract SecureSocketInfo getSecureSocketInfo ()

public abstract String getUserAgent ()

Returns
  • the user-agent

public abstract int getWriteTimeout ()

Returns
  • timeout in milliseconds

public abstract String post (String url, Map<String, String> urlParams, Map<String, String> bodyParams, Map<String, String> serverHeaders)

Perform an http POST request to send a simple form.

Parameters
url url with optional parameters
urlParams optional additional url parameters
bodyParams request content parameters
Returns
  • the server response
Throws
IOException on error

public abstract String post (String url, Map<String, String> urlParams, Map<String, String> bodyParams)

@return

Throws
IOException

public abstract String postMultipart (String url, Map<String, String> formParams, Map<String, FormFileEntry> formFiles, Map<String, String> serverHeaders)

Perform an http POST request to send a form using the multipart/form-data encoding.

Parameters
url url with optional parameters
formParams optional request content parameters
formFiles optional request content files
Returns
  • the server response
Throws
IOException on error

public abstract String postMultipart (String url, Map<String, String> formParams, Map<String, FormFileEntry> formFiles)

@return

Throws
IOException

public abstract String query (String url, Map<String, String> parameters, Map<String, String> serverHeaders)

Perform an http GET request.

Parameters
url url with optional parameters
parameters optional additional url parameters
Returns
  • the server response
Throws
IOException on error

public abstract String query (String url)

Perform an http GET request.

Parameters
url url with optional parameters
Returns
  • the server response
Throws
IOException on error

public abstract String query (String url, Map<String, String> parameters)

@return

Throws
IOException

public abstract byte[] queryBinary (String url, Map<String, String> parameters)

@return

Throws
IOException

public abstract byte[] queryBinary (String url, Map<String, String> urlParams, Map<String, String> serverHeaders, IProgressCallback progressCallback)

Perform an http GET request.

Parameters
progressCallback optional listener
Returns
  • the server response
Throws
IOException

public abstract byte[] queryBinary (String url, Map<String, String> parameters, Map<String, String> serverHeaders)

Perform an http GET request.

Parameters
url url with optional parameters
parameters optional additional url parameters
Returns
  • the server response
Throws
IOException on error

public abstract byte[] queryBinary (String url)

Perform an http GET request.

Parameters
url url with optional parameters
Returns
  • the server response
Throws
IOException on error

public abstract void setConnectTimeout (int timeout)

Parameters
timeout in milliseconds

public abstract void setReadTimeout (int timeout)

Parameters
timeout timeout in milliseconds

public abstract void setSecureSocketInfo (SecureSocketInfo info)

public abstract void setUserAgent (String userAgent)

Parameters
userAgent a user-agent

public abstract void setWriteTimeout (int timeout)

Parameters
timeout timeout in milliseconds