![]() |
Qore jni Module 2.3.1
|
Java wrapper for the Qore::HTTPClient class in Qore. More...
Public Member Methods | |
HTTPClient (QoreObject ds) | |
creates the object | |
HTTPClient (Map< String, Object > opts) throws Throwable | |
Creates the HTTPClient object based on the option parameter passed. More... | |
void | setHTTPVersion (String ver) throws Throwable |
Sets the HTTP protocol version string for headers in outgoing messages, allowed values are "1.0" and "1.1". More... | |
String | getHTTPVersion () throws Throwable |
Returns the HTTP protocol version string used in outgoing messages. More... | |
void | setSecure (boolean secure) throws Throwable |
Sets the object to make a secure SSL/TLS connection on the next connect if the passed argument is true, or an unencrypted cleartext connection if it is false. More... | |
boolean | isSecure () throws Throwable |
Returns true if the current connection is encrypted, false if not. More... | |
void | connect () throws Throwable |
Connects to the remote socket; SSL/TLS negotiation is performed if required. More... | |
void | disconnect () throws Throwable |
Disconnects from the remote socket if a connection is established (otherwise does nothing) More... | |
HashMap< String, Object > | send (String body, String method, String path, Map< String, Object > headers, boolean getbody) throws Throwable |
Sends an HTTP request with the specified method and optional message body and returns headers and any body received as a response in a hash format. More... | |
HashMap< String, Object > | send (String body, String method, String path, Map< String, Object > headers) throws Throwable |
Sends an HTTP request with the specified method and optional message body and returns headers and any body received as a response in a hash format. More... | |
HashMap< String, Object > | send (String body, String method, String path) throws Throwable |
Sends an HTTP request with the specified method and optional message body and returns headers and any body received as a response in a hash format. More... | |
HashMap< String, Object > | send (String body, String method) throws Throwable |
Sends an HTTP request with the specified method and optional message body and returns headers and any body received as a response in a hash format. More... | |
HashMap< String, Object > | send (byte[] body, String method, String path, Map< String, Object > headers, boolean getbody) throws Throwable |
Sends an HTTP request with the specified method and optional message body and returns headers and any body received as a response in a hash format. More... | |
HashMap< String, Object > | send (byte[] body, String method, String path, Map< String, Object > headers) throws Throwable |
Sends an HTTP request with the specified method and optional message body and returns headers and any body received as a response in a hash format. More... | |
HashMap< String, Object > | send (byte[] body, String method, String path) throws Throwable |
Sends an HTTP request with the specified method and optional message body and returns headers and any body received as a response in a hash format. More... | |
HashMap< String, Object > | send (byte[] body, String method) throws Throwable |
Sends an HTTP request with the specified method and optional message body and returns headers and any body received as a response in a hash format. More... | |
String | get (String path, Map< String, Object > headers) throws Throwable |
Sends an HTTP GET request and returns the message body received as a string or null if no message body is received. More... | |
String | get (String path) throws Throwable |
Sends an HTTP GET request and returns the message body received as a string or null if no message body is received. More... | |
String | head (String path, Map< String, Object > headers) throws Throwable |
Sends an HTTP HEAD request and returns as hash of the headers received. More... | |
String | head (String path) throws Throwable |
Sends an HTTP HEAD request and returns as hash of the headers received. More... | |
String | post (String path, String body, Map< String, Object > headers) throws Throwable |
Sends an HTTP POST request with a message body and returns the message body received as a string or null if no message body is received. More... | |
String | post (String path, String body) throws Throwable |
Sends an HTTP POST request with a message body and returns the message body received as a string or null if no message body is received. More... | |
String | post (String path) throws Throwable |
Sends an HTTP POST request without a message body and returns the response message body received as a string or null if no message body is received. More... | |
String | post (String path, byte[] body, Map< String, Object > headers) throws Throwable |
Sends an HTTP POST request with a message body and returns the message body received as a string or null if no message body is received. More... | |
String | post (String path, byte[] body) throws Throwable |
Sends an HTTP POST request with a message body and returns the message body received as a string or null if no message body is received. More... | |
void | setTimeout (int timeout_ms) throws Throwable |
Sets the default I/O timeout value in milliseconds. More... | |
int | getTimeout () throws Throwable |
Returns the default I/O timeout as an integer in milliseconds. More... | |
void | setEncoding (String encoding) throws Throwable |
Sets the string encoding for the object; any strings deserialized with this object will be tagged with this character encoding. More... | |
String | getEncoding () throws Throwable |
Returns the character encoding used for the object. More... | |
void | setURL (String url) throws Throwable |
Sets a new URL value for the next connection. More... | |
String | getURL () throws Throwable |
Returns the current URL. More... | |
void | setProxyURL () throws Throwable |
Clears the new proxy URL value for the next connection. More... | |
void | setProxyURL (String url) throws Throwable |
Sets a new proxy URL value for the next connection. More... | |
String | getProxyURL () throws Throwable |
Returns the current proxy URL as a string or null if no proxy URL is set. More... | |
void | clearProxyURL () throws Throwable |
Clears the new proxy URL value for the next connection. More... | |
void | setProxySecure (boolean b) throws Throwable |
Sets the SSL/TLS flag for the next connection to the proxy. More... | |
boolean | isProxySecure () throws Throwable |
Returns the SSL/TLS flag for the next proxy connection. More... | |
void | setMaxRedirects (int mr) throws Throwable |
Updates the setting for the max_redirects value for the object (maximum number of HTTP redirects that will be processed before an exception is raised) More... | |
int | getMaxRedirects () throws Throwable |
Returns the current max_redirects value for the object (the maximum number of HTTP redirects that will be processed before an exception is raised) More... | |
void | setConnectTimeout (int timeout_ms) throws Throwable |
Sets the connect timeout in milliseconds. More... | |
int | getConnectTimeout () throws Throwable |
Returns the connect timeout as an integer in milliseconds. More... | |
int | setNoDelay (boolean b) throws Throwable |
Sets the TCP_NODELAY setting for the object. More... | |
boolean | getNoDelay () throws Throwable |
Returns the TCP_NODELAY setting for the HTTPClient object. More... | |
boolean | isConnected () throws Throwable |
Returns true or false giving the current connection state. More... | |
void | setUserPassword (String user, String pass) throws Throwable |
Sets the username and password for the connection; call after HTTPClient::setURL() More... | |
void | setUserPassword () throws Throwable |
Clears the username and password for the connection. More... | |
void | clearUserPassword () throws Throwable |
Clears the username and password for the connection. More... | |
void | setProxyUserPassword (String user, String pass) throws Throwable |
Sets the username and password for the connection to the proxy; call after HTTPClient::setProxyURL() More... | |
void | setProxyUserPassword () throws Throwable |
Clears the username and password for the next proxy connection. More... | |
void | clearProxyUserPassword () throws Throwable |
Clears the username and password for the next proxy connection. More... | |
void | setDefaultPath (String path) throws Throwable |
Sets the default path used by the object if no path is set in the URL. More... | |
String | getDefaultPath () throws Throwable |
Returns the default path used by the object if no path is set in the URL. More... | |
String | getConnectionPath () throws Throwable |
Returns the current connection path set in the URL. More... | |
void | setConnectionPath (String uri_path) throws Throwable |
Overrides any connection path set in the URL. More... | |
void | setConnectionPath () throws Throwable |
Overrides any connection path set in the URL. More... | |
HashMap< String, Object > | getUsageInfo () throws Throwable |
Returns performance statistics for the socket. More... | |
void | clearStats () throws Throwable |
Clears performance statistics. More... | |
void | setPersistent () throws Throwable |
temporarily disables implicit reconnections; must be called when the server is already connected More... | |
boolean | setErrorPassthru (boolean set) throws Throwable |
set the error passthru status More... | |
boolean | setErrorPassthru () throws Throwable |
set the error passthru status More... | |
boolean | getErrorPassthru () throws Throwable |
get the error passthru status More... | |
boolean | setRedirectPassthru (boolean set) throws Throwable |
set the redirect passthru status More... | |
boolean | setRedirectPassthru () throws Throwable |
set the redirect passthru status More... | |
boolean | getRedirectPassthru () throws Throwable |
get the redirect passthru status More... | |
boolean | setEncodingPassthru (boolean set) throws Throwable |
set the encoding passthru status More... | |
boolean | setEncodingPassthru () throws Throwable |
set the encoding passthru status More... | |
boolean | getEncodingPassthru () throws Throwable |
get the encoding passthru status More... | |
String | getHostHeaderValue () throws Throwable |
returns the Host header value for this object More... | |
![]() | |
QoreObjectWrapper (QoreObject obj) | |
creates the wrapper object with the Qore object | |
void | release () |
releases the Qore object; do not call any further methods on the object after this call | |
QoreObject | getQoreObject () |
returns the Qore object | |
String | className () |
returns the class name for the Qore object | |
boolean | instanceOf (String class_name) |
returns true if the object is an instance of the given class | |
Additional Inherited Members | |
![]() | |
QoreObject | obj |
the wrapper Qore object | |
Java wrapper for the Qore::HTTPClient class in Qore.
import qore.Qore.HTTPClient;
|
inline |
Creates the HTTPClient object based on the option parameter passed.
To connect, call any method that requires a connection and an implicit connection is established, or call HTTPClient::connect().
opts | sets options and changes default behaviour for the object, etc; key names are case-sensitive and therefore must all be in lower-case:
|
HTTP-CLIENT-OPTION-ERROR | invalid or unknown option passed in option hash |
HTTP-CLIENT-URL-ERROR | invalid URL string |
HTTP-CLIENT-UNKNOWN-PROTOCOL | unknown protocol passed in URL |
ILLEGAL-FILESYSTEM-ACCESS | if the calling context is restricted with the Qore::PO_NO_FILESYSTEM sandboxing restriction and one of the following options is used: ssl_cert_path or ssl_key_path |
scheme://socket=
url_encoded_path/path
, where url_encoded_path is a path with URL-encoding as performed by encode_url(string, True); for example: "http://socket=%2ftmp%socket-dir%2fsocket-file-1/url/path"
; this allows a filesystem path to be used in the host portion of the URL and for the URL to include a URL path as well.ssl_cert_path
or ssl_key_path
options are usedssl_cert_path
or ssl_key_path
ssl_cert_path
ssl_key_path
ssl_key_password
ssl_verify_cert
|
inline |
Clears the new proxy URL value for the next connection.
|
inline |
Clears the username and password for the next proxy connection.
Call this method after calling HTTPClient::setProxyURL() to clear any proxy authentication information present in the URL used in HTTPClient::setProxyURL()
|
inline |
Clears performance statistics.
|
inline |
Clears the username and password for the connection.
Call this method after calling HTTPClient::setURL() to clear any authentication information present in the URL used in HTTPClient::setURL()
|
inline |
Connects to the remote socket; SSL/TLS negotiation is performed if required.
If the protocol indicates that a secure connection should be established (or HTTPClient::setSecure() was called previsouly), SSL/TLS negotiation will be attempted.
If the TCP_NODELAY
flag has been set (see HTTPClient::setNoDelay()), then after a successful connection to the remote socket, this option will be set on the socket. If an error occurs setting the TCP_NODELAY
option, the internal flag is set to false (use HTTPClient::getNoDelay() to check the flag's state) and the error code can be retrieved with errno().
|
inline |
Disconnects from the remote socket if a connection is established (otherwise does nothing)
|
inline |
Sends an HTTP GET
request and returns the message body received as a string or null if no message body is received.
In order to get the headers and the body, use the HTTPClient::send() method instead (although note that sending an HTTP message bosdy with a GET
request is not standards compliant; see httpclient_get_with_body for more information).
If no connection has already been established, an internal call to HTTPClient::connect() will be made before sending the request.
If any content encoding is used for the message body in the reply, the content is decoded and returned as a string; if the content encoding uses an unknown method, then an exception is thrown.
path | the path for the message (i.e. "/path/resource?method¶m=value" ) |
HTTP-CLIENT-REDIRECT-ERROR | invalid redirect location given by remote |
HTTP-CLIENT-MAXIMUM-REDIRECTS-EXCEEDED | maximum redirect count exceeded |
HTTP-CLIENT-RECEIVE-ERROR | unknown content encoding received or status error communicating with HTTP server (status code < 100 or > 299); in case of a status error the "arg" key of the exception hash will be set to a hash equal to the return value of the send() method including a "status_code" key (giving the status code) and a "body" key (giving the message body returned by the server) |
SOCKET-SEND-ERROR | There was an error sending the data |
SOCKET-CLOSED | The remote end closed the connection |
SOCKET-RECV-ERROR | There was an error receiving the data |
SOCKET-TIMEOUT | Data transmission or reception for a single send() or recv() action exceeded the timeout period |
SOCKET-SSL-ERROR | There was an SSL error while reading data from the socket |
SOCKET-HTTP-ERROR | Invalid HTTP data was received |
|
inline |
Sends an HTTP GET
request and returns the message body received as a string or null if no message body is received.
In order to get the headers and the body, use the HTTPClient::send() method instead (although note that sending an HTTP message bosdy with a GET
request is not standards compliant; see httpclient_get_with_body for more information).
If no connection has already been established, an internal call to HTTPClient::connect() will be made before sending the request.
If any content encoding is used for the message body in the reply, the content is decoded and returned as a string; if the content encoding uses an unknown method, then an exception is thrown.
path | the path for the message (i.e. "/path/resource?method¶m=value" ) |
headers | An optional hash of headers to include in the message; values are converted to strings; a list is converted to a string of comma-separated values; headers that differ only in case will be overwritten by the last header in the hash with a matching name with a case-insensitive search |
HTTP-CLIENT-REDIRECT-ERROR | invalid redirect location given by remote |
HTTP-CLIENT-MAXIMUM-REDIRECTS-EXCEEDED | maximum redirect count exceeded |
HTTP-CLIENT-RECEIVE-ERROR | unknown content encoding received or status error communicating with HTTP server (status code < 100 or > 299); in case of a status error the "arg" key of the exception hash will be set to a hash equal to the return value of the send() method including a "status_code" key (giving the status code) and a "body" key (giving the message body returned by the server) |
SOCKET-SEND-ERROR | There was an error sending the data |
SOCKET-CLOSED | The remote end closed the connection |
SOCKET-RECV-ERROR | There was an error receiving the data |
SOCKET-TIMEOUT | Data transmission or reception for a single send() or recv() action exceeded the timeout period |
SOCKET-SSL-ERROR | There was an SSL error while reading data from the socket |
SOCKET-HTTP-ERROR | Invalid HTTP data was received |
|
inline |
Returns the current connection path set in the URL.
|
inline |
Returns the connect timeout as an integer in milliseconds.
|
inline |
Returns the default path used by the object if no path is set in the URL.
|
inline |
Returns the character encoding used for the object.
|
inline |
get the encoding passthru status
encoding_passthru
valueIf true then message bodies received with known content encodings are not decoded but rather passed through as-is
|
inline |
get the error passthru status
error_passthru
valueIf true then HTTP status codes indicating errors will not cause an HTTP-CLIENT-RECEIVE-ERROR
exception to be raised, rather such responses will be passed through to the caller like any other response.
|
inline |
returns the Host
header value for this object
Host
header value for this object
|
inline |
Returns the HTTP protocol version string used in outgoing messages.
|
inline |
Returns the current max_redirects
value for the object (the maximum number of HTTP redirects that will be processed before an exception is raised)
max_redirects
value for the object (the maximum number of HTTP redirects that will be processed before an exception is raised)
|
inline |
Returns the TCP_NODELAY
setting for the HTTPClient object.
|
inline |
Returns the current proxy URL as a string or null if no proxy URL is set.
|
inline |
get the redirect passthru status
redirect_passthru
valueIf true then redirect messages will be passed to the caller instead of proceessed
|
inline |
Returns the default I/O timeout as an integer in milliseconds.
|
inline |
Returns the current URL.
|
inline |
Returns performance statistics for the socket.
"bytes_sent"
: an integer giving the total amount of bytes sent"bytes_recv"
: an integer giving the total amount of bytes received"us_sent"
: an integer giving the total number of microseconds spent sending data"us_recv"
: an integer giving the total number of microseconds spent receiving data"arg"
: (only if warning values have been set with HTTPClient::setWarningQueue()) the optional argument for warning hashes"timeout"
: (only if warning values have been set with HTTPClient::setWarningQueue()) the warning timeout in microseconds"min_throughput"
: (only if warning values have been set with HTTPClient::setWarningQueue()) the minimum warning throughput in bytes/sec
|
inline |
Sends an HTTP HEAD
request and returns as hash of the headers received.
If no connection is established, an internal call to HTTPClient::connect() will be made before sending the message.
path | the path for the message (i.e. "/path/resource?method¶m=value" ) |
HTTP-CLIENT-REDIRECT-ERROR | invalid redirect location given by remote |
HTTP-CLIENT-MAXIMUM-REDIRECTS-EXCEEDED | maximum redirect count exceeded |
HTTP-CLIENT-RECEIVE-ERROR | unknown content encoding received or status error communicating with HTTP server (status code < 100 or > 299); in case of a status error the "arg" key of the exception hash will be set to a hash equal to the return value of the send() method including a "status_code" key (giving the status code) and a "body" key (giving the message body returned by the server) |
SOCKET-SEND-ERROR | There was an error sending the data |
SOCKET-CLOSED | The remote end closed the connection |
SOCKET-RECV-ERROR | There was an error receiving the data |
SOCKET-TIMEOUT | Data transmission or reception for a single send() or recv() action exceeded the timeout period |
SOCKET-SSL-ERROR | There was an SSL error while reading data from the socket |
SOCKET-HTTP-ERROR | Invalid HTTP data was received |
|
inline |
Sends an HTTP HEAD
request and returns as hash of the headers received.
If no connection is established, an internal call to HTTPClient::connect() will be made before sending the message.
path | the path for the message (i.e. "/path/resource?method¶m=value" ) |
headers | An optional hash of headers to include in the message; values are converted to strings; a list is converted to a string of comma-separated values; headers that differ only in case will be overwritten by the last header in the hash with a matching name with a case-insensitive search |
HTTP-CLIENT-REDIRECT-ERROR | invalid redirect location given by remote |
HTTP-CLIENT-MAXIMUM-REDIRECTS-EXCEEDED | maximum redirect count exceeded |
HTTP-CLIENT-RECEIVE-ERROR | unknown content encoding received or status error communicating with HTTP server (status code < 100 or > 299); in case of a status error the "arg" key of the exception hash will be set to a hash equal to the return value of the send() method including a "status_code" key (giving the status code) and a "body" key (giving the message body returned by the server) |
SOCKET-SEND-ERROR | There was an error sending the data |
SOCKET-CLOSED | The remote end closed the connection |
SOCKET-RECV-ERROR | There was an error receiving the data |
SOCKET-TIMEOUT | Data transmission or reception for a single send() or recv() action exceeded the timeout period |
SOCKET-SSL-ERROR | There was an SSL error while reading data from the socket |
SOCKET-HTTP-ERROR | Invalid HTTP data was received |
|
inline |
Returns true or false giving the current connection state.
|
inline |
Returns the SSL/TLS flag for the next proxy connection.
|
inline |
Returns true if the current connection is encrypted, false if not.
|
inline |
Sends an HTTP POST
request without a message body and returns the response message body received as a string or null if no message body is received.
In order to get the headers and the body in the response, use the HTTPClient::send() method instead.
If no connection is established, an internal call to HTTPClient::connect() will be made before sending the message.
path | the path for the message (i.e. "/path/resource?method¶m=value" ) |
HTTP-CLIENT-REDIRECT-ERROR | invalid redirect location given by remote |
HTTP-CLIENT-MAXIMUM-REDIRECTS-EXCEEDED | maximum redirect count exceeded |
HTTP-CLIENT-RECEIVE-ERROR | unknown content encoding received or status error communicating with HTTP server (status code < 100 or > 299); in case of a status error the "arg" key of the exception hash will be set to a hash equal to the return value of the send() method including a "status_code" key (giving the status code) and a "body" key (giving the message body returned by the server) |
ENCODING-CONVERSION-ERROR | the given string could not be converted to the socket's character encoding |
SOCKET-SEND-ERROR | There was an error sending the data |
SOCKET-CLOSED | The remote end closed the connection |
SOCKET-RECV-ERROR | There was an error receiving the data |
SOCKET-TIMEOUT | Data transmission or reception for a single send() or recv() action exceeded the timeout period |
SOCKET-SSL-ERROR | There was an SSL error while reading data from the socket |
SOCKET-HTTP-ERROR | Invalid HTTP data was received |
|
inline |
Sends an HTTP POST
request with a message body and returns the message body received as a string or null if no message body is received.
In order to get the headers and the body in the response, use the HTTPClient::send() method instead.
If no connection is established, an internal call to HTTPClient::connect() will be made before sending the message.
path | the path for the message (i.e. "/path/resource?method¶m=value" ) |
body | the optional data to use as the message body |
HTTP-CLIENT-REDIRECT-ERROR | invalid redirect location given by remote |
HTTP-CLIENT-MAXIMUM-REDIRECTS-EXCEEDED | maximum redirect count exceeded |
HTTP-CLIENT-RECEIVE-ERROR | unknown content encoding received or status error communicating with HTTP server (status code < 100 or > 299); in case of a status error the "arg" key of the exception hash will be set to a hash equal to the return value of the send() method including a "status_code" key (giving the status code) and a "body" key (giving the message body returned by the server) |
SOCKET-SEND-ERROR | There was an error sending the data |
SOCKET-CLOSED | The remote end closed the connection |
SOCKET-RECV-ERROR | There was an error receiving the data |
SOCKET-TIMEOUT | Data transmission or reception for a single send() or recv() action exceeded the timeout period |
SOCKET-SSL-ERROR | There was an SSL error while reading data from the socket |
SOCKET-HTTP-ERROR | Invalid HTTP data was received |
|
inline |
Sends an HTTP POST
request with a message body and returns the message body received as a string or null if no message body is received.
In order to get the headers and the body in the response, use the HTTPClient::send() method instead.
If no connection is established, an internal call to HTTPClient::connect() will be made before sending the message.
path | the path for the message (i.e. "/path/resource?method¶m=value" ) |
body | the optional data to use as the message body |
headers | An optional hash of headers to include in the message; values are converted to strings; a list is converted to a string of comma-separated values; headers that differ only in case will be overwritten by the last header in the hash with a matching name with a case-insensitive search |
HTTP-CLIENT-REDIRECT-ERROR | invalid redirect location given by remote |
HTTP-CLIENT-MAXIMUM-REDIRECTS-EXCEEDED | maximum redirect count exceeded |
HTTP-CLIENT-RECEIVE-ERROR | unknown content encoding received or status error communicating with HTTP server (status code < 100 or > 299); in case of a status error the "arg" key of the exception hash will be set to a hash equal to the return value of the send() method including a "status_code" key (giving the status code) and a "body" key (giving the message body returned by the server) |
SOCKET-SEND-ERROR | There was an error sending the data |
SOCKET-CLOSED | The remote end closed the connection |
SOCKET-RECV-ERROR | There was an error receiving the data |
SOCKET-TIMEOUT | Data transmission or reception for a single send() or recv() action exceeded the timeout period |
SOCKET-SSL-ERROR | There was an SSL error while reading data from the socket |
SOCKET-HTTP-ERROR | Invalid HTTP data was received |
|
inline |
Sends an HTTP POST
request with a message body and returns the message body received as a string or null if no message body is received.
In order to get the headers and the body in the response, use the HTTPClient::send() method instead.
If no connection is established, an internal call to HTTPClient::connect() will be made before sending the message.
path | the path for the message (i.e. "/path/resource?method¶m=value" ) |
body | the string to use as the message body |
HTTP-CLIENT-REDIRECT-ERROR | invalid redirect location given by remote |
HTTP-CLIENT-MAXIMUM-REDIRECTS-EXCEEDED | maximum redirect count exceeded |
HTTP-CLIENT-RECEIVE-ERROR | unknown content encoding received or status error communicating with HTTP server (status code < 100 or > 299); in case of a status error the "arg" key of the exception hash will be set to a hash equal to the return value of the send() method including a "status_code" key (giving the status code) and a "body" key (giving the message body returned by the server) |
ENCODING-CONVERSION-ERROR | the given string could not be converted to the socket's character encoding |
SOCKET-SEND-ERROR | There was an error sending the data |
SOCKET-CLOSED | The remote end closed the connection |
SOCKET-RECV-ERROR | There was an error receiving the data |
SOCKET-TIMEOUT | Data transmission or reception for a single send() or recv() action exceeded the timeout period |
SOCKET-SSL-ERROR | There was an SSL error while reading data from the socket |
SOCKET-HTTP-ERROR | Invalid HTTP data was received |
|
inline |
Sends an HTTP POST
request with a message body and returns the message body received as a string or null if no message body is received.
In order to get the headers and the body in the response, use the HTTPClient::send() method instead.
If no connection is established, an internal call to HTTPClient::connect() will be made before sending the message.
path | the path for the message (i.e. "/path/resource?method¶m=value" ) |
body | the string to use as the message body |
headers | An optional hash of headers to include in the message; values are converted to strings; a list is converted to a string of comma-separated values; headers that differ only in case will be overwritten by the last header in the hash with a matching name with a case-insensitive search |
HTTP-CLIENT-REDIRECT-ERROR | invalid redirect location given by remote |
HTTP-CLIENT-MAXIMUM-REDIRECTS-EXCEEDED | maximum redirect count exceeded |
HTTP-CLIENT-RECEIVE-ERROR | unknown content encoding received or status error communicating with HTTP server (status code < 100 or > 299); in case of a status error the "arg" key of the exception hash will be set to a hash equal to the return value of the send() method including a "status_code" key (giving the status code) and a "body" key (giving the message body returned by the server) |
ENCODING-CONVERSION-ERROR | the given string could not be converted to the socket's character encoding |
SOCKET-SEND-ERROR | There was an error sending the data |
SOCKET-CLOSED | The remote end closed the connection |
SOCKET-RECV-ERROR | There was an error receiving the data |
SOCKET-TIMEOUT | Data transmission or reception for a single send() or recv() action exceeded the timeout period |
SOCKET-SSL-ERROR | There was an SSL error while reading data from the socket |
SOCKET-HTTP-ERROR | Invalid HTTP data was received |
|
inline |
Sends an HTTP request with the specified method and optional message body and returns headers and any body received as a response in a hash format.
If a connection has not already been established, an internal call to HTTPClient::connect() will be made before sending the message
body | The message body to send; pass null (no value) to send no body |
method | The name of the HTTP method ("GET" , "POST" , "HEAD" , "OPTIONS" , "PUT" , "DELETE" , "TRACE" , "CONNECT" , or "PATCH" ). Additional methods can be added in the constructor with the a additional_methods option. |
"body"
key and the HTTP status will be assigned to the "status_code"
key.HTTP-CLIENT-METHOD-ERROR | invalid/unknown HTTP method passed |
HTTP-CLIENT-REDIRECT-ERROR | invalid redirect location given by remote |
HTTP-CLIENT-MAXIMUM-REDIRECTS-EXCEEDED | maximum redirect count exceeded |
HTTP-CLIENT-RECEIVE-ERROR | unknown content encoding received or status error communicating with HTTP server (status code < 100 or > 299); in case of a status error the "arg" key of the exception hash will be set to a hash equal to the normal return value of this method including a "status_code" key (giving the status code) and a "body" key (giving the message body returned by the server) |
SOCKET-SEND-ERROR | There was an error sending the data |
SOCKET-CLOSED | The remote end closed the connection |
SOCKET-RECV-ERROR | There was an error receiving the data |
SOCKET-TIMEOUT | Data transmission or reception for a single send() or recv() action exceeded the timeout period |
SOCKET-SSL-ERROR | There was an SSL error while reading data from the socket |
SOCKET-HTTP-ERROR | Invalid HTTP data was received |
|
inline |
Sends an HTTP request with the specified method and optional message body and returns headers and any body received as a response in a hash format.
If a connection has not already been established, an internal call to HTTPClient::connect() will be made before sending the message
body | The message body to send; pass null (no value) to send no body |
method | The name of the HTTP method ("GET" , "POST" , "HEAD" , "OPTIONS" , "PUT" , "DELETE" , "TRACE" , "CONNECT" , or "PATCH" ). Additional methods can be added in the constructor with the a additional_methods option. |
path | The path for the message (i.e. "/path/resource?method¶m=value" ) |
"body"
key and the HTTP status will be assigned to the "status_code"
key.HTTP-CLIENT-METHOD-ERROR | invalid/unknown HTTP method passed |
HTTP-CLIENT-REDIRECT-ERROR | invalid redirect location given by remote |
HTTP-CLIENT-MAXIMUM-REDIRECTS-EXCEEDED | maximum redirect count exceeded |
HTTP-CLIENT-RECEIVE-ERROR | unknown content encoding received or status error communicating with HTTP server (status code < 100 or > 299); in case of a status error the "arg" key of the exception hash will be set to a hash equal to the normal return value of this method including a "status_code" key (giving the status code) and a "body" key (giving the message body returned by the server) |
SOCKET-SEND-ERROR | There was an error sending the data |
SOCKET-CLOSED | The remote end closed the connection |
SOCKET-RECV-ERROR | There was an error receiving the data |
SOCKET-TIMEOUT | Data transmission or reception for a single send() or recv() action exceeded the timeout period |
SOCKET-SSL-ERROR | There was an SSL error while reading data from the socket |
SOCKET-HTTP-ERROR | Invalid HTTP data was received |
|
inline |
Sends an HTTP request with the specified method and optional message body and returns headers and any body received as a response in a hash format.
If a connection has not already been established, an internal call to HTTPClient::connect() will be made before sending the message
body | The message body to send; pass null (no value) to send no body |
method | The name of the HTTP method ("GET" , "POST" , "HEAD" , "OPTIONS" , "PUT" , "DELETE" , "TRACE" , "CONNECT" , or "PATCH" ). Additional methods can be added in the constructor with the a additional_methods option. |
path | The path for the message (i.e. "/path/resource?method¶m=value" ) |
headers | An optional hash of headers to include in the message; values are converted to strings; a list is converted to a string of comma-separated values; headers that differ only in case will be overwritten by the last header in the hash with a matching name with a case-insensitive search |
"body"
key and the HTTP status will be assigned to the "status_code"
key.HTTP-CLIENT-METHOD-ERROR | invalid/unknown HTTP method passed |
HTTP-CLIENT-REDIRECT-ERROR | invalid redirect location given by remote |
HTTP-CLIENT-MAXIMUM-REDIRECTS-EXCEEDED | maximum redirect count exceeded |
HTTP-CLIENT-RECEIVE-ERROR | unknown content encoding received or status error communicating with HTTP server (status code < 100 or > 299); in case of a status error the "arg" key of the exception hash will be set to a hash equal to the normal return value of this method including a "status_code" key (giving the status code) and a "body" key (giving the message body returned by the server) |
SOCKET-SEND-ERROR | There was an error sending the data |
SOCKET-CLOSED | The remote end closed the connection |
SOCKET-RECV-ERROR | There was an error receiving the data |
SOCKET-TIMEOUT | Data transmission or reception for a single send() or recv() action exceeded the timeout period |
SOCKET-SSL-ERROR | There was an SSL error while reading data from the socket |
SOCKET-HTTP-ERROR | Invalid HTTP data was received |
|
inline |
Sends an HTTP request with the specified method and optional message body and returns headers and any body received as a response in a hash format.
If a connection has not already been established, an internal call to HTTPClient::connect() will be made before sending the message
body | The message body to send; pass null (no value) to send no body |
method | The name of the HTTP method ("GET" , "POST" , "HEAD" , "OPTIONS" , "PUT" , "DELETE" , "TRACE" , "CONNECT" , or "PATCH" ). Additional methods can be added in the constructor with the a additional_methods option. |
path | The path for the message (i.e. "/path/resource?method¶m=value" ) |
headers | An optional hash of headers to include in the message; values are converted to strings; a list is converted to a string of comma-separated values; headers that differ only in case will be overwritten by the last header in the hash with a matching name with a case-insensitive search |
getbody | If this argument is true, then the object will try to receive a message body even if no "Content-Length" header is present in the response. Use this only with broken servers that send message bodies without a "Content-Length" header. |
"body"
key and the HTTP status will be assigned to the "status_code"
key.HTTP-CLIENT-METHOD-ERROR | invalid/unknown HTTP method passed |
HTTP-CLIENT-REDIRECT-ERROR | invalid redirect location given by remote |
HTTP-CLIENT-MAXIMUM-REDIRECTS-EXCEEDED | maximum redirect count exceeded |
HTTP-CLIENT-RECEIVE-ERROR | unknown content encoding received or status error communicating with HTTP server (status code < 100 or > 299); in case of a status error the "arg" key of the exception hash will be set to a hash equal to the normal return value of this method including a "status_code" key (giving the status code) and a "body" key (giving the message body returned by the server) |
SOCKET-SEND-ERROR | There was an error sending the data |
SOCKET-CLOSED | The remote end closed the connection |
SOCKET-RECV-ERROR | There was an error receiving the data |
SOCKET-TIMEOUT | Data transmission or reception for a single send() or recv() action exceeded the timeout period |
SOCKET-SSL-ERROR | There was an SSL error while reading data from the socket |
SOCKET-HTTP-ERROR | Invalid HTTP data was received |
|
inline |
Sends an HTTP request with the specified method and optional message body and returns headers and any body received as a response in a hash format.
If a connection has not already been established, an internal call to HTTPClient::connect() will be made before sending the message
body | The message body to send; note that sending an HTTP message bosdy with a GET request is not standards compliant; see httpclient_get_with_body for more information |
method | The name of the HTTP method ("GET" , "POST" , "HEAD" , "OPTIONS" , "PUT" , "DELETE" , "TRACE" , "CONNECT" , or "PATCH" ). Additional methods can be added in the constructor with the a additional_methods option. |
"body"
key and the HTTP status will be assigned to the "status_code"
key.HTTP-CLIENT-METHOD-ERROR | invalid/unknown HTTP method passed |
HTTP-CLIENT-REDIRECT-ERROR | invalid redirect location given by remote |
HTTP-CLIENT-MAXIMUM-REDIRECTS-EXCEEDED | maximum redirect count exceeded |
HTTP-CLIENT-RECEIVE-ERROR | unknown content encoding received or status error communicating with HTTP server (status code < 100 or > 299); in case of a status error the "arg" key of the exception hash will be set to a hash equal to the normal return value of this method including a "status_code" key (giving the status code) and a "body" key (giving the message body returned by the server) |
ENCODING-CONVERSION-ERROR | the given string could not be converted to the socket's character encoding |
SOCKET-SEND-ERROR | There was an error sending the data |
SOCKET-CLOSED | The remote end closed the connection |
SOCKET-RECV-ERROR | There was an error receiving the data |
SOCKET-TIMEOUT | Data transmission or reception for a single send() or recv() action exceeded the timeout period |
SOCKET-SSL-ERROR | There was an SSL error while reading data from the socket |
SOCKET-HTTP-ERROR | Invalid HTTP data was received |
|
inline |
Sends an HTTP request with the specified method and optional message body and returns headers and any body received as a response in a hash format.
If a connection has not already been established, an internal call to HTTPClient::connect() will be made before sending the message
body | The message body to send; note that sending an HTTP message bosdy with a GET request is not standards compliant; see httpclient_get_with_body for more information |
method | The name of the HTTP method ("GET" , "POST" , "HEAD" , "OPTIONS" , "PUT" , "DELETE" , "TRACE" , "CONNECT" , or "PATCH" ). Additional methods can be added in the constructor with the a additional_methods option. |
path | The path for the message (i.e. "/path/resource?method¶m=value" ) |
"body"
key and the HTTP status will be assigned to the "status_code"
key.HTTP-CLIENT-METHOD-ERROR | invalid/unknown HTTP method passed |
HTTP-CLIENT-REDIRECT-ERROR | invalid redirect location given by remote |
HTTP-CLIENT-MAXIMUM-REDIRECTS-EXCEEDED | maximum redirect count exceeded |
HTTP-CLIENT-RECEIVE-ERROR | unknown content encoding received or status error communicating with HTTP server (status code < 100 or > 299); in case of a status error the "arg" key of the exception hash will be set to a hash equal to the normal return value of this method including a "status_code" key (giving the status code) and a "body" key (giving the message body returned by the server) |
ENCODING-CONVERSION-ERROR | the given string could not be converted to the socket's character encoding |
SOCKET-SEND-ERROR | There was an error sending the data |
SOCKET-CLOSED | The remote end closed the connection |
SOCKET-RECV-ERROR | There was an error receiving the data |
SOCKET-TIMEOUT | Data transmission or reception for a single send() or recv() action exceeded the timeout period |
SOCKET-SSL-ERROR | There was an SSL error while reading data from the socket |
SOCKET-HTTP-ERROR | Invalid HTTP data was received |
|
inline |
Sends an HTTP request with the specified method and optional message body and returns headers and any body received as a response in a hash format.
If a connection has not already been established, an internal call to HTTPClient::connect() will be made before sending the message
body | The message body to send; note that sending an HTTP message bosdy with a GET request is not standards compliant; see httpclient_get_with_body for more information |
method | The name of the HTTP method ("GET" , "POST" , "HEAD" , "OPTIONS" , "PUT" , "DELETE" , "TRACE" , "CONNECT" , or "PATCH" ). Additional methods can be added in the constructor with the a additional_methods option. |
path | The path for the message (i.e. "/path/resource?method¶m=value" ) |
headers | An optional hash of headers to include in the message; values are converted to strings; a list is converted to a string of comma-separated values; headers that differ only in case will be overwritten by the last header in the hash with a matching name with a case-insensitive search |
"body"
key and the HTTP status will be assigned to the "status_code"
key.HTTP-CLIENT-METHOD-ERROR | invalid/unknown HTTP method passed |
HTTP-CLIENT-REDIRECT-ERROR | invalid redirect location given by remote |
HTTP-CLIENT-MAXIMUM-REDIRECTS-EXCEEDED | maximum redirect count exceeded |
HTTP-CLIENT-RECEIVE-ERROR | unknown content encoding received or status error communicating with HTTP server (status code < 100 or > 299); in case of a status error the "arg" key of the exception hash will be set to a hash equal to the normal return value of this method including a "status_code" key (giving the status code) and a "body" key (giving the message body returned by the server) |
ENCODING-CONVERSION-ERROR | the given string could not be converted to the socket's character encoding |
SOCKET-SEND-ERROR | There was an error sending the data |
SOCKET-CLOSED | The remote end closed the connection |
SOCKET-RECV-ERROR | There was an error receiving the data |
SOCKET-TIMEOUT | Data transmission or reception for a single send() or recv() action exceeded the timeout period |
SOCKET-SSL-ERROR | There was an SSL error while reading data from the socket |
SOCKET-HTTP-ERROR | Invalid HTTP data was received |
|
inline |
Sends an HTTP request with the specified method and optional message body and returns headers and any body received as a response in a hash format.
If a connection has not already been established, an internal call to HTTPClient::connect() will be made before sending the message
body | The message body to send; note that sending an HTTP message bosdy with a GET request is not standards compliant; see httpclient_get_with_body for more information |
method | The name of the HTTP method ("GET" , "POST" , "HEAD" , "OPTIONS" , "PUT" , "DELETE" , "TRACE" , "CONNECT" , or "PATCH" ). Additional methods can be added in the constructor with the a additional_methods option. |
path | The path for the message (i.e. "/path/resource?method¶m=value" ) |
headers | An optional hash of headers to include in the message; values are converted to strings; a list is converted to a string of comma-separated values; headers that differ only in case will be overwritten by the last header in the hash with a matching name with a case-insensitive search |
getbody | If this argument is true, then the object will try to receive a message body even if no "Content-Length" header is present in the response. Use this only with broken servers that send message bodies without a "Content-Length" header. |
"body"
key and the HTTP status will be assigned to the "status_code"
key.HTTP-CLIENT-METHOD-ERROR | invalid/unknown HTTP method passed |
HTTP-CLIENT-REDIRECT-ERROR | invalid redirect location given by remote |
HTTP-CLIENT-MAXIMUM-REDIRECTS-EXCEEDED | maximum redirect count exceeded |
HTTP-CLIENT-RECEIVE-ERROR | unknown content encoding received or status error communicating with HTTP server (status code < 100 or > 299); in case of a status error the "arg" key of the exception hash will be set to a hash equal to the normal return value of this method including a "status_code" key (giving the status code) and a "body" key (giving the message body returned by the server) |
ENCODING-CONVERSION-ERROR | the given string could not be converted to the socket's character encoding |
SOCKET-SEND-ERROR | There was an error sending the data |
SOCKET-CLOSED | The remote end closed the connection |
SOCKET-RECV-ERROR | There was an error receiving the data |
SOCKET-TIMEOUT | Data transmission or reception for a single send() or recv() action exceeded the timeout period |
SOCKET-SSL-ERROR | There was an SSL error while reading data from the socket |
SOCKET-HTTP-ERROR | Invalid HTTP data was received |
|
inline |
Overrides any connection path set in the URL.
|
inline |
Overrides any connection path set in the URL.
|
inline |
Sets the connect timeout in milliseconds.
timeout_ms | the connect timeout in milliseconds; negative numbers mean use the default system connect timeout. Note that like all Qore functions and methods taking timeout values, a relative date/time value can be used to make the units clear (i.e. 30s = 30 seconds, etc.). |
|
inline |
Sets the default path used by the object if no path is set in the URL.
path | the default path value to set or if null then clears the path |
|
inline |
Sets the string encoding for the object; any strings deserialized with this object will be tagged with this character encoding.
encoding | the string encoding for the object; any strings deserialized with this object will be tagged with this character encoding |
|
inline |
set the encoding passthru status
encoding_passthru
valueIf true then message bodies received with known content encodings are not decoded but rather passed through as-is
|
inline |
set the encoding passthru status
set | if true then message bodies received with known content encodings are not decoded but rather passed through as-is |
encoding_passthru
valueIf true then message bodies received with known content encodings are not decoded but rather passed through as-is
|
inline |
set the error passthru status
error_passthru
valueIf true then HTTP status codes indicating errors will not cause an HTTP-CLIENT-RECEIVE-ERROR
exception to be raised, rather such responses will be passed through to the caller like any other response.
|
inline |
set the error passthru status
set | if true then HTTP status codes indicating errors will not cause an HTTP-CLIENT-RECEIVE-ERROR exception to be raised, rather such responses will be passed through to the caller like any other response |
error_passthru
valueIf true then HTTP status codes indicating errors will not cause an HTTP-CLIENT-RECEIVE-ERROR
exception to be raised, rather such responses will be passed through to the caller like any other response.
|
inline |
Sets the HTTP protocol version string for headers in outgoing messages, allowed values are "1.0"
and "1.1".
ver | "1.0" or "1.1" for the HTTP protocol compliance version |
HTTP-VERSION-ERROR | invalid HTTP version passed (allowed values: "1.0" and "1.1") |
|
inline |
Updates the setting for the max_redirects
value for the object (maximum number of HTTP redirects that will be processed before an exception is raised)
mr | the setting for the maximum number of HTTP redirects that will be processed before an exception is raised |
|
inline |
Sets the TCP_NODELAY
setting for the object.
When this setting is True, then data will be immediately sent out over the HTTPClient object's socket, when it is false, then data transmission may be delayed to be packaged with other data for the same target.
Delayed data transmissions may cause problems when the sender immediately closes the socket after sending data; in this case the receiver may not get the data even though the send succeeded.
Note that if no value is given to the method, the argument will be assumed to be true, and output buffering will be turned off for the HTTPClient object.
If the socket is not connected when this call is made, then an internal flag is set and the TCP_NODELAY
option is enabled when the next connection is established. If the socket is connected, then if an error occurs setting the TCP_NODELAY
option on the socket, this method will return a non-zero error code; the actual error can be checked with the errno() function.
b | the TCP_NODELAY setting for the object |
|
inline |
temporarily disables implicit reconnections; must be called when the server is already connected
The persistent flag is automatically reset to false whenever the connection is closed; it must be called manually for every connection to turn off implicit reconnections.
To turn off the persistent flag manually, call HTTPClient.disconnect()
|
inline |
Sets the SSL/TLS flag for the next connection to the proxy.
|
inline |
Clears the new proxy URL value for the next connection.
This variant of the method is equivalent to HTTPClient::clearProxyURL()
|
inline |
Sets a new proxy URL value for the next connection.
url | the new proxy URL value for the next connection |
HTTP-CLIENT-URL-ERROR | invalid proxy URL string; invalid authorization credentials in proxy URL (username without password or vice-versa) |
HTTP-CLIENT-PROXY-PROTOCOL-ERROR | unknown protocol passed in URL |
scheme://socket=
url_encoded_path/path
, where url_encoded_path is a path with URL-encoding as performed by encode_url(string, True); for example: "http://socket=%2ftmp%socket-dir%2fsocket-file-1/url/path"
; this allows a filesystem path to be used in the host portion of the URL and for the URL to include a URL path as well.
|
inline |
Clears the username and password for the next proxy connection.
Call this method after calling HTTPClient::setProxyURL() to clear any proxy authentication information present in the URL used in HTTPClient::setProxyURL()
This variant of the method is equivalent to HTTPClient::clearProxyUserPassword()
|
inline |
Sets the username and password for the connection to the proxy; call after HTTPClient::setProxyURL()
Call this method after calling HTTPClient::setProxyURL() to set proxy authentication information when not present in the URL used in HTTPClient::setProxyURL()
user | the username to use for proxy authentication in the next HTTP connection |
pass | the password to use for proxy authentication in the next HTTP connection |
|
inline |
set the redirect passthru status
reddirect_passthru
valueIf true then redirect messages will be passed to the callers instead of proceessed
|
inline |
set the redirect passthru status
set | if true then redirect messages will be passed to the caller instead of proceessed |
reddirect_passthru
valueIf true then redirect messages will be passed to the callers instead of proceessed
|
inline |
Sets the object to make a secure SSL/TLS connection on the next connect if the passed argument is true, or an unencrypted cleartext connection if it is false.
This method overrides the default behaviour for the protocol set for the object
Note that the behavior of this method when called with no argument changed in version 0.8.0; prior to version 0.8.0 calling this method with no argument would turn off secure mode; the behavior was changed to the current functionality in order to make the usage of this method consistent with other methods of the same name and to make it more logical.
secure | if true, a SSL/TLS connection will be attempted on the next connection. If false, an unencrypted cleartext connection will be established |
|
inline |
Sets the default I/O timeout value in milliseconds.
timeout_ms | 0 means immediate timeout (when reading will return data only if it is already available), and negative numbers mean never timeout |
|
inline |
Sets a new URL value for the next connection.
To retrieve the current URL value, use the HTTPClient::getURL() method
url | the new URL for the object |
HTTP-CLIENT-URL-ERROR | invalid URL string; invalid authorization credentials in URL (username without password or vice-versa) |
HTTP-CLIENT-UNKNOWN-PROTOCOL | unknown protocol (scheme) passed in URL |
scheme://socket=
url_encoded_path/path
, where url_encoded_path is a path with URL-encoding as performed by encode_url(string, True); for example: "http://socket=%2ftmp%socket-dir%2fsocket-file-1/url/path"
; this allows a filesystem path to be used in the host portion of the URL and for the URL to include a URL path as well.
|
inline |
Clears the username and password for the connection.
Call this method after calling HTTPClient::setURL() to clear any authentication information present in the URL used in HTTPClient::setURL()
This variant of the method is equivalent to HTTPClient::clearUserPassword()
|
inline |
Sets the username and password for the connection; call after HTTPClient::setURL()
Call this method after calling HTTPClient::setURL() to set authentication information when not present in the URL used in HTTPClient::setURL()
user | the username to use for authentication in the next HTTP connection |
pass | the password to use for authentication in the next HTTP connection |