Class Http
- All Implemented Interfaces:
AutoCloseable
HTTPS client for REST API calls, GET/POST/PUT/DELETE/PATCH requests, uploads, and downloads.
Chilkat.Http is a comprehensive HTTP and HTTPS client class for
applications that need to call REST APIs, download files, upload data, submit
forms, send JSON or XML, stream large responses, manage cookies and redirects,
authenticate with modern or legacy schemes, use TLS client certificates, work
through proxies, and troubleshoot HTTP communication in detail.
REST and API requests
Send GET, POST, PUT, PATCH, DELETE, and custom HTTP requests with headers, query parameters, JSON, XML, form data, or raw request bodies.
Uploads and downloads
Download to memory, files, streams, BinData, or
StringBuilder, and upload files, forms, multipart content,
or application data.
Authentication
Use Basic, Digest, NTLM, Negotiate, Bearer tokens, OAuth2 access tokens, AWS signatures, and other service-specific authentication patterns.
TLS, proxies, and networking
Configure HTTPS, client certificates, TLS behavior, HTTP proxies, SOCKS proxies, proxy authentication, custom timeouts, and network interface preferences.
Cookies, redirects, and sessions
Manage cookies, follow redirects, preserve session state, control request headers, and inspect response headers and status codes.
S3-compatible storage
Use built-in helpers for Amazon S3 and S3-compatible object storage operations such as upload, download, delete, copy, and listing workflows.
Common pattern:
Configure authentication, headers, TLS, proxy, and timeout settings first;
send the request with the method that matches the desired input/output form;
then inspect the response status, headers, body, and LastErrorText
when troubleshooting server or network behavior.
For an extended overview, see Http Class Overview.
</section>
Event-capable: long-running methods report progress through a ProgressListener installed
with setProgressListener(ProgressListener), onAbortCheck(BooleanSupplier),
onPercentDone(IntPredicate) or onProgressInfo(BiConsumer).
Instances hold a native Chilkat object: close them with ChilkatObject.close() (try-with-resources) when
done; an unclosed instance is freed when it becomes unreachable.
- See Also:
- Online reference
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCacheRoot(String dir)Disk caching operates similarly to browser caching of web pages, but it focuses on downloading web pages rather than handling HTTP requests to a REST API.voidRemoves all headers set by themethod.setRequestHeader(String, String)voidClears all in-memory cookies accumulated while theproperty was set togetSaveCookies()trueand thewas set togetCookieDir()memory.voidRemoves all URL variable values previously set by.setUrlVar(String, String)voidCloses all remaining open HTTP connections.voidcreateOcspRequest(JsonObject requestDetails, BinData ocspRequest)Generates an OCSP request for one or more certificates using JSON (requestDetails) that specifies the request details.voidcreateTimestampRequest(String hashAlg, String hashVal, String reqPolicyOid, boolean addNonce, boolean reqTsaCert, BinData timestampToken)Creates an RFC 3161 time-stamp request and returns the binary request token intimestampToken.voidThis function clears the Chilkat in-memory DNS cache, which stores hostname-to-IP address mappings to avoid repeated DNS lookups.voidDownloads the content at the specifiedurland saves to a local file atlocalFilePath.voiddownloadAppend(String url, String appendToPath)Downloads the content at the specifiedurland appends to the local file atappendToPath.voiddownloadBd(String url, BinData binData)Downloads content fromurltobinData, clearingbinDatabeforehand.downloadHash(String url, String hashAlgorithm, String encoding)Fetches the content aturland returns the encoded hash using the specified algorithm (hashAlgorithm:sha1,sha256,sha384,sha512,md2,md5,haval,ripemd128,ripemd160,ripemd256, orripemd320), and returns the hash encoded in the specified encoding (encoding:Base64,modBase64,Base32,UU,QPfor quoted-printable,URLfor URL-encoding,Hex,Q,B,url_oath,url_rfc1738,url_rfc2396, orurl_rfc3986).voiddownloadSb(String url, String charset, StringBuilder sb)Downloads the content at theurlinto a Chilkat StringBuilder object.extractMetaRefreshUrl(String htmlContent)This is a convenience method for extracting the META refresh URL from HTML.Returns the current date and time in GMT (UTC) as a string formatted according to RFC 2616:Day, DD Mon YYYY HH:MM:SS GMT.booleanWhen set totrue, causes the currently running method to abort.This property sets theAcceptheader for all HTTP requests, except those sent by theandhttpReq(String, HttpRequest, HttpResponse)methods that use headers from anhttpSReq(String, int, boolean, HttpRequest, HttpResponse)HttpRequestobject.booleanIftruethen theAccept-Encoding: gzipis automatically added for all HTTP requests, except those made using theandhttpReq(String, HttpRequest, HttpResponse)methods that use headers from an HttpRequest object.httpSReq(String, int, boolean, HttpRequest, HttpResponse)booleanWhen set tofalse, MIME header folding is not applied to request headers automatically.This property can be set to a JSON string containing the required information to add anHTTP Signaturein the following format:Applications can set this property to theOAuth2access_tokenvalue to be sent in theAuthorization: Bearer {access_token}header for all requests.booleanWhen set totrue(the default), theHostheader is automatically added to all requests.The AWS Access Key to be used with the Amazon S3 methods listed below.Specify the regional endpoint (domain) forAmazon S3method calls.The AWS S3 region (e.g.,us-east-1,us-west-2,eu-west-1,eu-central-1) defaults tous-east-1.The AWS Secret Key to be used with the Amazon S3 methods listed below.This is the AWS session token for temporary security credentials.This property can be used to specify sub-resources to be included in the Amazon S3 methods listed below.intIf set to a non-zero value, this limits the download bandwidth to the specified maximum number of bytes per second.intIf set to a non-zero value, this property limits the upload bandwidth to the specified maximum number of bytes per second.booleanTo enable HTTP basic authentication, set this property totrue.getCacheRoot(int index)Returns the Nth cache root, with indexing starting at 0.A computer can have multiple network interfaces (e.g., Ethernet, Wi-Fi, VPN, virtual adapters).intThis property will be set to the status of the last HTTP connection made (or failed to be made) by any HTTP method.intDetermines the maximum time, in seconds, to wait for an HTTP server to accept a TCP connection before timing out.Designates a directory path for automatic cookie storage (such as"c:/myCookieDir"or"/Users/example/myCookieDir") when theproperty is set togetSaveCookies()true.getCookieXml(String domain)Returns cookies in XML format for a specified domain.intSets the default freshness period (in minutes) for cached documents when theproperty is set to 0.getFreshnessAlgorithm()booleanSetting this property totruecauses the HTTP component to use digest authentication.Utility method to extract the domain name from a URL.booleanThis property that automatic resolution of credentials from the operating system’s secure storage.booleanSet totrueto enable fetching pages from cache whenever possible.If theproperty indicates an HTTP GET was redirected, and thegetWasRedirected()property is set togetFollowRedirects()true, this property will hold the final redirect URL.booleanWhen set totrue,301,302,303,307, and308redirects are automatically followed.intTo determine the freshness of a cached HTTP GET response, the freshness algorithm is employed.intThe interval in milliseconds between eachevent callback, which enables an application to abort certain method calls before they complete.AbortCheckbooleanIf an HTTP response includes theCache-Control: must-revalidateheader, it indicates that the server requires the client to revalidate the page with the server rather than serving it directly from the cache.booleanSome HTTP responses include headers indicating the page should not be cached.booleanIf set totrue, the response body, if it is text, is stored in theproperty for methods not returning angetLastResponseBody()HttpResponseobject.TheContent-Typeheader value from the most recent HTTP response received.booleantrueif the last GET was fetched from cache.Contains the text of the last HTTP header sent by any method.voidgetLastJsonData(JsonObject json)Offers details about the most recent method called on this object instance, although some methods may not supply any information.TheLast-Modifiedheader value from the most recent HTTP response received.The response body from the last HTTP request is saved in this property only if theproperty is set to TRUE.getKeepResponseBody()Returns the most recent full response header for methods that do not use anHttpResponseobject.intContains the most recent response status code for methods that don't utilize anHttpResponseobject.Contains the latest response status text for methods that don't use anHttpResponseobject.intThe LMFactor is an integer between 1 and 100 that specifies the percentage of time from an HTTP page's last-modified date to be used as the freshness period.getLogin()This is the login string to be used with HTTPbasic,digest, orNTLMauthentication.The optional domain name to be used with NTLM authentication.intThis class automatically manages simultaneous open HTTP connections.intSets a time limit for how long a document can remain fresh in the cache, measured in minutes, with a default value of 525,600 minutes (equivalent to 1 year).longSpecify the maximum HTTP response size the program will accept.intLimit the length of URLs (including URL parameters) in HTTP requests by setting this property.intSets the minimum time a document stays fresh in the cache, with a default of 30 minutes.booleanSet this property equal totruefor Negotiate authentication.booleanSetting this property totruecauses the HTTP component to use NTLM authentication (also known as IWA -- or Integrated Windows Authentication) when authentication with an HTTP server.intThis setting determines the directory levels used under each cache root.intSpecifies the number of established cache roots used by the HTTP cache to distribute the disk cache across multiple directories.booleanIftruethen causes an OAuth Authorization header to be added to any request sent by the HTTP object.booleanWhen set totrue, theoauth_body_hash, which contains theSHA-256hash of the HTTP request body, is automatically included in theOAuth1.0a Authorization header.TheOAuth 1.0acallback URL.TheOAuth1.0aconsumer key to be used in theoauth_consumer_keyparameter of theAuthorizationheader.The consumer secret to be used in computing the contents of theOAuth1.0aAuthorizationheader.The OAuth1.0arealmto be used in theAuthorizationheader.Specify theoauth_signature_methodparameter in theOAuth 1.0a Authorization header.The value to be used for theoauth_tokenparameter in theOAuth1.0aAuthorizationheader.TheOAuth1.0atoken secret to be used in computing the Authorization header.The value to be used for the verifier to be used in theoauth_verifierparameter of theOAuth1.0aAuthorizationheader.The HTTP password for pages requiring a login/password.intThis property is only valid in programming environment and languages that allow for event callbacks.booleanIftrue, then use IPv6 over IPv4 when both are supported for a particular domain.Returns the installed listener, ornull.Set this tobasicif you know in advance that Basic authentication is to be used for the HTTP proxy.booleanSet totrueif the proxy server expects a direct TLS connection.The domain name of a proxy host if an HTTP proxy is used.If an HTTP proxy is used and it requires authentication, this property specifies the HTTP proxy login.The NTLM authentication domain (optional) if NTLM authentication is used.If an HTTP proxy is used and it requires authentication, this property specifies the HTTP proxy password.intThe port number of a proxy server if an HTTP proxy is used.intThe amount of time in seconds to wait before timing out when reading from an HTTP server.booleanIndicates whether the last HTTPS connection received a TLS CertificateRequest handshake message indicating that the server may require a client certificate.Indicates the HTTP verb, such as GET, POST, PUT, etc.getRequestHeader(String name)Returns the value of a header field previously set by calling.setRequestHeader(String, String)If set, then any HTTP response to any POST or GET, including downloads, will be rejected if the content-type in the response header does not match this setting.booleanIftrue, then the hostname/domain in the URL must match at least one of the entries in the server certificate's SAN.booleanIftrue, then the HTTP client will verify the server's SSL certificate.booleanIf this property istrue, cookies are automatically persisted to XML files in the directory specified by the CookiesDir property (or in memory if CookieDir =memory).intThe buffer size to be used with the underlying TCP/IP socket for sending.booleanIftrue, then cookies previously persisted to the CookiesDir are automatically added to all HTTP requests.voidgetServerCert(String domain, int port, Cert cert)Establishes an SSL/TLS connection with a web server to acquire its SSL certificate without retrieving any data, then disconnects.Enables file-based session logging.Sets the SNI hostname for the TLS ClientHello.The SOCKS4/SOCKS5 hostname or IPv4 address (in dotted decimal notation).The SOCKS5 password (if required).intThe SOCKS4/SOCKS5 proxy port.The SOCKS4/SOCKS5 proxy username.intSocksVersion May be set to one of the following integer values:intSets the receive buffer size socket option.intSets the send buffer size socket option.Provides a means for setting a list of ciphers that are allowed for SSL/TLS connections.Selects the SSL/TLS protocol version to be used for connections.Allows for the HTTP response body to be streamed directly into a file.Contains the current or last negotiated TLS cipher suite.Specifies a set of pins for Public Key Pinning for TLS connections.Contains the current or last negotiated TLS protocol version.This is a catch-all property to be used for uncommon needs.booleanSet this property totrueto automatically updated with HTTP GET request responses.getUrlPath(String url)Returns the path part of a URL.booleanIftrue, the proxy address/port used by Internet Explorer will also be used by Chilkat HTTP.This property sets theUser-Agentheader for all HTTP requests, except those sent by theandhttpReq(String, HttpRequest, HttpResponse)methods that use headers from anhttpSReq(String, int, boolean, HttpRequest, HttpResponse)HttpRequestobject.booleanThis shows whether the last HTTP request automatically followed a redirect.gSvcOauthAccessToken(String iss, String scope, String subEmail, int numSec, Cert cert)Obtains a Google API OAuth2 access token for a service account.gSvcOauthAccessToken2(Hashtable claimParams, int numSec, Cert cert)This method is similar toG_SvcOauthAccessToken, but offers greater customization.booleanhasRequestHeader(String name)Returnstrueif the header field specified bynameis included in all HTTP requests, except those sent by theorhttpReq(String, HttpRequest, HttpResponse)methods.httpSReq(String, int, boolean, HttpRequest, HttpResponse)voidSends an HTTP request tourlusing the specified HTTPverb(e.g.,POST,PUT,PATCH).voidSends an HTTP request tourlusing the specified HTTPverb(e.g.,POST,PUT,PATCH).voidhttpJson(String verb, String url, JsonObject json, String contentType, HttpResponse response)Sends an HTTP request tourlusing the specified method inverb(e.g., POST, PUT, PATCH).voidhttpNoBody(String verb, String url, HttpResponse response)Sends an HTTP request tourlusing the specified HTTPverb.voidhttpParams(String verb, String url, JsonObject json, HttpResponse response)Sends an HTTPverbrequest tourlwith query parameters fromjson.voidhttpReq(String url, HttpRequest request, HttpResponse response)Sends an HTTP request tourlwhere the content of the request is defined byrequest.voidhttpSb(String verb, String url, StringBuilder sb, String charset, String contentType, HttpResponse response)Sends an HTTP request tourlusing the specifiedverb(e.g.,POST,PUT,PATCH).voidhttpSReq(String domain, int port, boolean ssl, HttpRequest request, HttpResponse response)Sends an HTTP request to web server atdomain:portusing TLS ifsslequalstrue.voidhttpStr(String verb, String url, String bodyStr, String charset, String contentType, HttpResponse response)Sends an HTTP request tourlusing the specified verb (e.g.,POST,PUT,PATCH).intGets the server certificate at a domain:port and then sends an OCSP request to the certificate's OCSP URL to determine if the certificate has been revoked.voidonAbortCheck(BooleanSupplier callback)Installs a listener whose only callback isabortCheck: called everyHeartbeatMsmilliseconds during a long-running method; returntrueto abort it.voidonPercentDone(IntPredicate callback)Installs a listener whose only callback ispercentDone: called with the completion percentage (0..100) as a long-running method progresses; returntrueto abort it.voidonProgressInfo(BiConsumer<String,String> callback)Installs a listener whose only callback isprogressInfo: called with a name/value pair of progress information as a long-running method proceeds.intparseOcspReply(BinData ocspReply, JsonObject replyData)Parses an OCSP reply.quickDeleteStr(String url)This function sends an HTTPDELETErequest to a specified URL and returns the response body as a string.voidquickGetBd(String url, BinData binData)This function sends an HTTPGETrequest to a specified URL, which can include query parameters, and returns the binary response body inbinData.voidquickGetSb(String url, StringBuilder sbContent)This function sends an HTTPGETrequest to a specified URL, which can include query parameters, and returns the text response body insbContent.quickGetStr(String url)This function sends an HTTPGETrequest to a specified URL, which can include query parameters, and returns the text response body.voidremoveRequestHeader(String name)Eliminates a header field from being included in all HTTP requests, except for those sent by theandhttpReq(String, HttpRequest, HttpResponse)methods, which rely on header fields provided in anhttpSReq(String, int, boolean, HttpRequest, HttpResponse)HttpRequestobject via method arguments.Builds the GET request that would be sent if a method such aswas called.quickGetStr(String)voidresumeDownload(String url, String targetFilename)Resumes downloading content fromurland saves it to a partially completed local file attargetFilename.voidresumeDownloadBd(String url, BinData binData)Resumes a download from where it left off, determined by the number of bytes inbinData.voids3CreateBucket(String bucketPath)Creates a new Amazon S3 bucket.voids3DeleteBucket(String bucketPath)Deletes an Amazon S3 bucket.voids3DeleteObject(String bucketPath, String objectName)Deletes a remote file (object) on the Amazon S3 service.voids3DeleteObjects(String bucketName, StringTable objectNames, JsonObject jsonResponse)Deletes several objects from a bucket with a single request.voids3DownloadBd(String bucketPath, String objectName, BinData bd)Downloads a file from the Amazon S3 service intobd.voids3DownloadFile(String bucketPath, String objectName, String localFilePath)Downloads a file from the Amazon S3 service.s3DownloadString(String bucketPath, String objectName, String charset)Downloads a text file (object) from the Amazon S3 service and returns the content as a string.ints3FileExists(String bucketPath, String objectName)Checks the existence of a remote file, returning: 1 if the file exists 0 if the file does not exist -1 if the check failed 2 if in asynchronous mode, indicating the background task started successfullys3GenPresignedUrl(String httpVerb, boolean useHttps, String bucketName, String path, int numSecondsValid, String awsService)This method generates a temporary pre-signed URL for Amazon S3.s3ListBucketObjects(String bucketPath)Retrieve an XML-formatted list of objects in an Amazon S3 bucket, similar to a directory listing.Retrieves the XML listing of the buckets for an Amazon S3 account.voids3UploadBd(BinData bd, String contentType, String bucketPath, String objectName)Uploads the contents ofbdas a file to the Amazon S3 service.voids3UploadFile(String localFilePath, String contentType, String bucketPath, String objectName)Uploads a file to the Amazon S3 service.voids3UploadString(String objectContent, String charset, String contentType, String bucketPath, String objectName)Uploads the content ofobjectContentas a file to Amazon S3.voidsetAbortCurrent(boolean value)Sets theAbortCurrentproperty; seegetAbortCurrent().voidSets theAcceptproperty; seegetAccept().voidsetAllowGzip(boolean value)Sets theAllowGzipproperty; seegetAllowGzip().voidsetAllowHeaderFolding(boolean value)Sets theAllowHeaderFoldingproperty; seegetAllowHeaderFolding().voidsetAuthPrivateKey(String publicKeyId, PrivateKey privKey)Sets the private key to be used with some forms of authentication.voidsetAuthSignature(String value)Sets theAuthSignatureproperty; seegetAuthSignature().voidsetAuthToken(String value)Sets theAuthTokenproperty; seegetAuthToken().voidSets theproperty.getAuthToken()voidsetAutoAddHostHeader(boolean value)Sets theAutoAddHostHeaderproperty; seegetAutoAddHostHeader().voidsetAwsAccessKey(String value)Sets theAwsAccessKeyproperty; seegetAwsAccessKey().voidsetAwsEndpoint(String value)Sets theAwsEndpointproperty; seegetAwsEndpoint().voidsetAwsRegion(String value)Sets theAwsRegionproperty; seegetAwsRegion().voidsetAwsSecretKey(String value)Sets theAwsSecretKeyproperty; seegetAwsSecretKey().voidsetAwsSessionToken(String value)Sets theAwsSessionTokenproperty; seegetAwsSessionToken().voidsetAwsSubResources(String value)Sets theAwsSubResourcesproperty; seegetAwsSubResources().voidsetBandwidthThrottleDown(int value)Sets theBandwidthThrottleDownproperty; seegetBandwidthThrottleDown().voidsetBandwidthThrottleUp(int value)Sets theBandwidthThrottleUpproperty; seegetBandwidthThrottleUp().voidsetBasicAuth(boolean value)Sets theBasicAuthproperty; seegetBasicAuth().voidsetClientAssertionKey(PrivateKey privKey, String kid)Sets the private key forprivate_key_jwtclient authentication (RFC 7523) in the OAuth2 client credentials flow of theproperty.getAuthToken()voidsetClientIpAddress(String value)Sets theClientIpAddressproperty; seegetClientIpAddress().voidsetConnectTimeout(int value)Sets theConnectTimeoutproperty; seegetConnectTimeout().voidsetCookieDir(String value)Sets theCookieDirproperty; seegetCookieDir().voidsetCookieXml(String domain, String cookieXml)This method restores cookies for a specified domain.voidsetDefaultFreshPeriod(int value)Sets theDefaultFreshPeriodproperty; seegetDefaultFreshPeriod().voidsetDigestAuth(boolean value)Sets theDigestAuthproperty; seegetDigestAuth().voidsetDPoPKey(PrivateKey privKey)Sets the private key for automatically adding the DPoP header to HTTP requests.voidsetEnableSecrets(boolean value)Sets theEnableSecretsproperty; seegetEnableSecrets().voidsetFetchFromCache(boolean value)Sets theFetchFromCacheproperty; seegetFetchFromCache().voidsetFollowRedirects(boolean value)Sets theFollowRedirectsproperty; seegetFollowRedirects().voidsetFreshnessAlgorithm(int value)Sets theFreshnessAlgorithmproperty; seegetFreshnessAlgorithm().voidsetHeartbeatMs(int value)Sets theHeartbeatMsproperty; seegetHeartbeatMs().voidsetIgnoreMustRevalidate(boolean value)Sets theIgnoreMustRevalidateproperty; seegetIgnoreMustRevalidate().voidsetIgnoreNoCache(boolean value)Sets theIgnoreNoCacheproperty; seegetIgnoreNoCache().voidsetKeepResponseBody(boolean value)Sets theKeepResponseBodyproperty; seegetKeepResponseBody().voidsetLMFactor(int value)Sets theLMFactorproperty; seegetLMFactor().voidSets theLoginproperty; seegetLogin().voidsetLoginDomain(String value)Sets theLoginDomainproperty; seegetLoginDomain().voidsetMaxConnections(int value)Sets theMaxConnectionsproperty; seegetMaxConnections().voidsetMaxFreshPeriod(int value)Sets theMaxFreshPeriodproperty; seegetMaxFreshPeriod().voidsetMaxResponseSize(long value)Sets theMaxResponseSizeproperty; seegetMaxResponseSize().voidsetMaxUrlLen(int value)Sets theMaxUrlLenproperty; seegetMaxUrlLen().voidsetMinFreshPeriod(int value)Sets theMinFreshPeriodproperty; seegetMinFreshPeriod().voidsetNegotiateAuth(boolean value)Sets theNegotiateAuthproperty; seegetNegotiateAuth().voidsetNtlmAuth(boolean value)Sets theNtlmAuthproperty; seegetNtlmAuth().voidsetNumCacheLevels(int value)Sets theNumCacheLevelsproperty; seegetNumCacheLevels().voidsetOAuth1(boolean value)Sets theOAuth1property; seegetOAuth1().voidsetOAuthBodyHash(boolean value)Sets theOAuthBodyHashproperty; seegetOAuthBodyHash().voidsetOAuthCallback(String value)Sets theOAuthCallbackproperty; seegetOAuthCallback().voidsetOAuthConsumerKey(String value)Sets theOAuthConsumerKeyproperty; seegetOAuthConsumerKey().voidsetOAuthConsumerSecret(String value)Sets theOAuthConsumerSecretproperty; seegetOAuthConsumerSecret().voidsetOAuthRealm(String value)Sets theOAuthRealmproperty; seegetOAuthRealm().voidsetOAuthRsaKey(PrivateKey privKey)Sets the RSA key to be used withOAuth 1.0aauthentication when theisgetOAuthSigMethod()RSA-SHA256orRSA-SHA1.voidsetOAuthSigMethod(String value)Sets theOAuthSigMethodproperty; seegetOAuthSigMethod().voidsetOAuthToken(String value)Sets theOAuthTokenproperty; seegetOAuthToken().voidsetOAuthTokenSecret(String value)Sets theOAuthTokenSecretproperty; seegetOAuthTokenSecret().voidsetOAuthVerifier(String value)Sets theOAuthVerifierproperty; seegetOAuthVerifier().voidsetPassword(String value)Sets thePasswordproperty; seegetPassword().voidsetPercentDoneScale(int value)Sets thePercentDoneScaleproperty; seegetPercentDoneScale().voidsetPreferIpv6(boolean value)Sets thePreferIpv6property; seegetPreferIpv6().voidsetProgressListener(ProgressListener listener)Installs the listener that receives this object's progress events (abortCheck,percentDone,progressInfo) during its long-running methods; replaces any listener or lambda installed before;nullremoves it.voidsetProxyAuthMethod(String value)Sets theProxyAuthMethodproperty; seegetProxyAuthMethod().voidsetProxyDirectTls(boolean value)Sets theProxyDirectTlsproperty; seegetProxyDirectTls().voidsetProxyDomain(String value)Sets theProxyDomainproperty; seegetProxyDomain().voidsetProxyLogin(String value)Sets theProxyLoginproperty; seegetProxyLogin().voidsetProxyLoginDomain(String value)Sets theProxyLoginDomainproperty; seegetProxyLoginDomain().voidsetProxyPassword(String value)Sets theProxyPasswordproperty; seegetProxyPassword().voidsetProxyPort(int value)Sets theProxyPortproperty; seegetProxyPort().voidsetReadTimeout(int value)Sets theReadTimeoutproperty; seegetReadTimeout().voidsetRedirectVerb(String value)Sets theRedirectVerbproperty; seegetRedirectVerb().voidsetRequestHeader(String headerFieldName, String headerFieldValue)Adds a header field to be included in all HTTP requests, except for those sent by theandhttpReq(String, HttpRequest, HttpResponse)methods, which rely on header fields provided in anhttpSReq(String, int, boolean, HttpRequest, HttpResponse)HttpRequestobject via method arguments.voidsetRequiredContentType(String value)Sets theRequiredContentTypeproperty; seegetRequiredContentType().voidsetRequireHostnameMatch(boolean value)Sets theRequireHostnameMatchproperty; seegetRequireHostnameMatch().voidsetRequireSslCertVerify(boolean value)Sets theRequireSslCertVerifyproperty; seegetRequireSslCertVerify().voidsetSaveCookies(boolean value)Sets theSaveCookiesproperty; seegetSaveCookies().voidsetSecurePassword(SecureString password)Equivalent to setting theproperty but offers a more secure method by using a secure string object.getPassword()voidsetSendBufferSize(int value)Sets theSendBufferSizeproperty; seegetSendBufferSize().voidsetSendCookies(boolean value)Sets theSendCookiesproperty; seegetSendCookies().voidsetSessionLogFilename(String value)Sets theSessionLogFilenameproperty; seegetSessionLogFilename().voidsetSniHostname(String value)Sets theSniHostnameproperty; seegetSniHostname().voidsetSocksHostname(String value)Sets theSocksHostnameproperty; seegetSocksHostname().voidsetSocksPassword(String value)Sets theSocksPasswordproperty; seegetSocksPassword().voidsetSocksPort(int value)Sets theSocksPortproperty; seegetSocksPort().voidsetSocksUsername(String value)Sets theSocksUsernameproperty; seegetSocksUsername().voidsetSocksVersion(int value)Sets theSocksVersionproperty; seegetSocksVersion().voidsetSoRcvBuf(int value)Sets theSoRcvBufproperty; seegetSoRcvBuf().voidsetSoSndBuf(int value)Sets theSoSndBufproperty; seegetSoSndBuf().voidsetSslAllowedCiphers(String value)Sets theSslAllowedCiphersproperty; seegetSslAllowedCiphers().voidsetSslCertRequirement(String reqName, String reqValue)Enforces a requirement on the server's certificate.voidsetSslClientCert(Cert cert)Facilitates the use of a client-side certificate for a TLS connection, enabling mutual authentication.voidsetSslClientCertPem(String pemDataOrPath, String pemPassword)This is identical to themethod, but it allows the certificate with a private key to be in PEM format.setSslClientCert(Cert)voidsetSslClientCertPfx(String pfxPath, String pfxPassword)This is identical to themethod, but enables you to provide a certificate with private key directly from a .pfx or .p12 file.setSslClientCert(Cert)voidsetSslProtocol(String value)Sets theSslProtocolproperty; seegetSslProtocol().voidsetStreamResponseBodyPath(String value)Sets theStreamResponseBodyPathproperty; seegetStreamResponseBodyPath().voidsetTlsPinSet(String value)Sets theTlsPinSetproperty; seegetTlsPinSet().voidsetUncommonOptions(String value)Sets theUncommonOptionsproperty; seegetUncommonOptions().voidsetUpdateCache(boolean value)Sets theUpdateCacheproperty; seegetUpdateCache().voidSets a variable's value for URL substitutions used in any method.voidsetUseIEProxy(boolean value)Sets theUseIEProxyproperty; seegetUseIEProxy().voidsetUserAgent(String value)Sets theUserAgentproperty; seegetUserAgent().voidsharePointOnlineAuth(String siteUrl, String username, SecureString password, JsonObject extraInfo)This method authenticates withSharePoint Onlineand if successful, sets a cookie which is used for all following SharePoint HTTP requests.voidsleepMs(int millisec)This method makes the calling process sleep for a specified number of milliseconds.URL decodes a string.URL encodes a string.intverifyTimestampReply(BinData timestampReply, Cert tsaCert)Verifies a timestamp reply received from a timestamp authority (TSA).Methods inherited from class com.chilkatsoft.chilkat2.ChilkatObject
close, getDebugLogFilePath, getLastErrorHtml, getLastErrorText, getLastErrorXml, getLastMethodSuccess, getVerboseLogging, getVersion, isClosed, setDebugLogFilePath, setLastMethodSuccess, setVerboseLogging, toString
-
Constructor Details
-
Http
public Http()Creates a newHttpobject.
-
-
Method Details
-
getAbortCurrent
public boolean getAbortCurrent()When set totrue, causes the currently running method to abort. Methods that always finish quickly (i.e.have no length file operations or network communications) are not affected. If no method is running, then this property is automatically reset tofalsewhen the next method is called. When the abort occurs, this property is reset tofalse. Both synchronous and asynchronous method calls can be aborted. (A synchronous method call could be aborted by setting this property from a separate thread.)- Returns:
- the value of the
AbortCurrentproperty
-
setAbortCurrent
public void setAbortCurrent(boolean value)Sets theAbortCurrentproperty; seegetAbortCurrent().- Parameters:
value- the new value
-
getAccept
This property sets theAcceptheader for all HTTP requests, except those sent by theandhttpReq(String, HttpRequest, HttpResponse)methods that use headers from anhttpSReq(String, int, boolean, HttpRequest, HttpResponse)HttpRequestobject.By default, it is set to
*/*.Setting this property is the same as calling
withsetRequestHeader(String, String)Acceptas the header field name.The
AcceptHTTP header is sent by the client (your application) to tell the server which content types (MIME types) it can handle in the response.For example, the following means only a JSON response is accepted:
Accept: application/json
- Returns:
- the value of the
Acceptproperty
-
setAccept
Sets theAcceptproperty; seegetAccept().- Parameters:
value- the new value (notnull)
-
getAllowGzip
public boolean getAllowGzip()Iftruethen theAccept-Encoding: gzipis automatically added for all HTTP requests, except those made using theandhttpReq(String, HttpRequest, HttpResponse)methods that use headers from an HttpRequest object.httpSReq(String, int, boolean, HttpRequest, HttpResponse)The default value is
true.The
Accept-EncodingHTTP header is sent by the client to tell the server which compression algorithms it supports for the response body.Example:
Accept-Encoding: gzip, deflate
This means the client can handle responses compressed with gzip or deflate.
If this property is set to
false, then theAccept-Encodingheader is added, but the value is empty, like this:Accept-Encoding:
It means the client explicitly does not accept any content codings (no compression, no transformations).
- An absent
Accept-Encodingheader means the client will accept any encoding (server chooses, oftengzip). - An empty
Accept-Encodingheader means only the “identity” encoding (i.e., uncompressed) is acceptable.
The
method can be called withsetRequestHeader(String, String)Accept-Encodingas the header field name to explicitly set theAccept-Encodingheader. Note: Chilkat does not accept Brotli responses. Do not includebrin the list of encodings for this header.The
can be called to explicit omit theremoveRequestHeader(String)Accept-Encodingheader field from HTTP requests.- Returns:
- the value of the
AllowGzipproperty
- An absent
-
setAllowGzip
public void setAllowGzip(boolean value)Sets theAllowGzipproperty; seegetAllowGzip().- Parameters:
value- the new value
-
getAllowHeaderFolding
public boolean getAllowHeaderFolding()When set tofalse, MIME header folding is not applied to request headers automatically. By default, this setting istrue. This property exists for rare instances when a server cannot properly handle folded MIME headers.MIME header folding allows long header lines to be split across multiple lines for readability.
A folded line begins with whitespace (space or tab), which signals continuation.
Unfolded (single line):
Subject: This is a very long subject line that needs to be wrapped across lines
Folded (wrapped for transport):
Subject: This is a very long subject line that needs to be wrapped across lines
When received, the folded version is unfolded back into a single line by removing the CRLF + leading whitespace.
- Returns:
- the value of the
AllowHeaderFoldingproperty
-
setAllowHeaderFolding
public void setAllowHeaderFolding(boolean value)Sets theAllowHeaderFoldingproperty; seegetAllowHeaderFolding().- Parameters:
value- the new value
-
getAuthSignature
This property can be set to a JSON string containing the required information to add anHTTP Signaturein the following format:Authorization: Signature keyId="my-key-1", algorithm="hmac-sha256", headers="(request-target) host date", signature="Base64OfSignature"
See the linked example below for details.
- Returns:
- the value of the
AuthSignatureproperty
-
setAuthSignature
Sets theAuthSignatureproperty; seegetAuthSignature().- Parameters:
value- the new value (notnull)
-
getAuthToken
Applications can set this property to theOAuth2access_tokenvalue to be sent in theAuthorization: Bearer {access_token}header for all requests. ForOAuth1.0atokens, use theproperty instead.getOAuthToken()Starting from
Chilkat v10.1.2, this method can also accept aJSON stringcontaining details needed for automatic OAuth2 access token retrieval via theClient Credentialsflow. The JSON must include theclient secret,client ID,token endpoint, andscope(s). See the example below for guidance. This feature is compatible with any OAuth2 provider that supports the client credentials flow.- Returns:
- the value of the
AuthTokenproperty
-
setAuthToken
Sets theAuthTokenproperty; seegetAuthToken().- Parameters:
value- the new value (notnull)
-
getAutoAddHostHeader
public boolean getAutoAddHostHeader()When set totrue(the default), theHostheader is automatically added to all requests. The domain for theHostheader is taken from the URL passed in a method's arguments.The
HostHTTP header specifies the hostname (and optional port) of the server the client is trying to reach.Example:
Host: www.example.com
It’s required in HTTP/1.1 so a server can distinguish between multiple sites (virtual hosts) on the same IP address.
- Returns:
- the value of the
AutoAddHostHeaderproperty
-
setAutoAddHostHeader
public void setAutoAddHostHeader(boolean value)Sets theAutoAddHostHeaderproperty; seegetAutoAddHostHeader().- Parameters:
value- the new value
-
getAwsAccessKey
The AWS Access Key to be used with the Amazon S3 methods listed below.- Returns:
- the value of the
AwsAccessKeyproperty
-
setAwsAccessKey
Sets theAwsAccessKeyproperty; seegetAwsAccessKey().- Parameters:
value- the new value (notnull)
-
getAwsEndpoint
Specify the regional endpoint (domain) forAmazon S3method calls. The default iss3.amazonaws.com, but you can use any valid Amazon S3 endpoint, such ass3-eu-west-1.amazonaws.com, or endpoints from other S3-API compatible services.- Returns:
- the value of the
AwsEndpointproperty
-
setAwsEndpoint
Sets theAwsEndpointproperty; seegetAwsEndpoint().- Parameters:
value- the new value (notnull)
-
getAwsRegion
The AWS S3 region (e.g.,us-east-1,us-west-2,eu-west-1,eu-central-1) defaults tous-east-1. It is relevant only when theproperty is set to 4 and ignored when set to 2.AwsSignatureVersion- Returns:
- the value of the
AwsRegionproperty
-
setAwsRegion
Sets theAwsRegionproperty; seegetAwsRegion().- Parameters:
value- the new value (notnull)
-
getAwsSecretKey
The AWS Secret Key to be used with the Amazon S3 methods listed below.- Returns:
- the value of the
AwsSecretKeyproperty
-
setAwsSecretKey
Sets theAwsSecretKeyproperty; seegetAwsSecretKey().- Parameters:
value- the new value (notnull)
-
getAwsSessionToken
This is the AWS session token for temporary security credentials.When you call
AssumeRolewith AWS STS, you get temporary security credentials consisting of:- Access key ID
- Secret access key
- Session token
The session token is an extra credential that must be included with the access key and secret key when signing requests. It proves the credentials came from STS and are valid for the limited session duration.
In short: The AWS session token is a required component of temporary STS credentials, used alongside the key pair to authenticate API calls.
- Returns:
- the value of the
AwsSessionTokenproperty
-
setAwsSessionToken
Sets theAwsSessionTokenproperty; seegetAwsSessionToken().- Parameters:
value- the new value (notnull)
-
getAwsSubResources
This property can be used to specify sub-resources to be included in the Amazon S3 methods listed below. For example, set the property toacl&versionId=valueto request the acl for a specific version of an object.In Amazon S3, sub-resources are special query parameters you can append to an S3 object or bucket URL to access or manage specific properties or features beyond the main resource itself.
Examples:
- Bucket sub-resources:
?logging,?website,?lifecycle,?policy - Object sub-resources:
?acl,?torrent,?restore,?tagging
So:
- Resource = the bucket or object itself (e.g.,
mybucket/photo.jpg) - Sub-resource = a specific aspect or configuration of it, accessed with a query
string (e.g.,
mybucket?loggingorphoto.jpg?acl).
In short: S3 sub-resources let you operate on metadata/configuration of a bucket or object, not the content itself.
- Returns:
- the value of the
AwsSubResourcesproperty
- Bucket sub-resources:
-
setAwsSubResources
Sets theAwsSubResourcesproperty; seegetAwsSubResources().- Parameters:
value- the new value (notnull)
-
getBandwidthThrottleDown
public int getBandwidthThrottleDown()If set to a non-zero value, this limits the download bandwidth to the specified maximum number of bytes per second. The default value is0.- Returns:
- the value of the
BandwidthThrottleDownproperty
-
setBandwidthThrottleDown
public void setBandwidthThrottleDown(int value)Sets theBandwidthThrottleDownproperty; seegetBandwidthThrottleDown().- Parameters:
value- the new value
-
getBandwidthThrottleUp
public int getBandwidthThrottleUp()If set to a non-zero value, this property limits the upload bandwidth to the specified maximum number of bytes per second. The default is0.- Returns:
- the value of the
BandwidthThrottleUpproperty
-
setBandwidthThrottleUp
public void setBandwidthThrottleUp(int value)Sets theBandwidthThrottleUpproperty; seegetBandwidthThrottleUp().- Parameters:
value- the new value
-
getBasicAuth
public boolean getBasicAuth()To enable HTTP basic authentication, set this property totrue. The default value isfalse.Then basic authentication is enabled, Chilkat uses the
andgetLogin()properties to include thegetPassword()Authorization: Basic {base64}header in all requests.HTTP Basic Authentication is a simple authentication scheme where the client sends a username and password encoded in Base64 in the
Authorizationheader.Example:
Authorization: Basic dXNlcjpwYXNzd29yZA==
Here
dXNlcjpwYXNzd29yZA==is the Base64 ofuser:password.- Returns:
- the value of the
BasicAuthproperty
-
setBasicAuth
public void setBasicAuth(boolean value)Sets theBasicAuthproperty; seegetBasicAuth().- Parameters:
value- the new value
-
getClientIpAddress
A computer can have multiple network interfaces (e.g., Ethernet, Wi-Fi, VPN, virtual adapters). Each interface can have one or more IP addresses (IPv4 and/or IPv6).If multiple IPs exist (say,
192.168.1.10on Wi-Fi and10.0.0.5on Ethernet), the application can bind explicitly to either one, determining which interface and address the socket will use for communication.This property can be set to explicitly bind the communications socket to an IP address.
The default value is the empty string, which means the application does not bind to a specific local IP before connecting and the OS network stack automatically picks the default source IP.
- Returns:
- the value of the
ClientIpAddressproperty
-
setClientIpAddress
Sets theClientIpAddressproperty; seegetClientIpAddress().- Parameters:
value- the new value (notnull)
-
getConnectFailReason
public int getConnectFailReason()This property will be set to the status of the last HTTP connection made (or failed to be made) by any HTTP method.Possible values are:
0 = success Normal (non-TLS) sockets: 1 = empty hostname 2 = DNS lookup failed 3 = DNS timeout 4 = Aborted by application. 5 = Internal failure. 6 = Connect Timed Out 7 = Connect Rejected (or failed for some other reason) 50 = HTTP proxy authentication failure. 98 = Async operation in progress. 99 = Product is not unlocked. SSL/TLS: 100 = TLS internal error. 101 = Failed to send client hello. 102 = Unexpected handshake message. 103 = Failed to read server hello. 104 = No server certificate. 105 = Unexpected TLS protocol version. 106 = Server certificate verify failed (the server certificate is expired or the cert's signature verification failed). 107 = Unacceptable TLS protocol version. 108 = App-defined server certificate requirements failure. 109 = Failed to read handshake messages. 110 = Failed to send client certificate handshake message. 111 = Failed to send client key exchange handshake message. 112 = Client certificate's private key not accessible. 113 = Failed to send client cert verify handshake message. 114 = Failed to send change cipher spec handshake message. 115 = Failed to send finished handshake message. 116 = Server's Finished message is invalid. 125 = Peer tried to connect using older SSL 2.0 protocol version. 126 = TLS Pin Set Mismatch. 127 = TLS 1.3 handshake error.
- Returns:
- the value of the
ConnectFailReasonproperty (read-only)
-
getConnectTimeout
public int getConnectTimeout()Determines the maximum time, in seconds, to wait for an HTTP server to accept a TCP connection before timing out. The default value is 30 seconds.Note: A TLS connection always starts with a normal TCP connection (e.g., client connects to server on port 443). Once TCP is established, the client and server perform a TLS handshake: they exchange cryptographic messages to authenticate, agree on encryption keys, and set up a secure channel.
The
property applies to TLS handshake communications. When establishing a TLS connection, thegetReadTimeout()ConnectTimeoutgoverns the initial TCP connection, followed by theReadTimeout.- Returns:
- the value of the
ConnectTimeoutproperty
-
setConnectTimeout
public void setConnectTimeout(int value)Sets theConnectTimeoutproperty; seegetConnectTimeout().- Parameters:
value- the new value
-
getCookieDir
Designates a directory path for automatic cookie storage (such as"c:/myCookieDir"or"/Users/example/myCookieDir") when theproperty is set togetSaveCookies()true. Cookies are saved in XML files, with one file per domain. Alternatively, set the value tomemoryto cache cookies in memory.The default value is the empty string, which means cookies are not saved regardless of the
setting.getSaveCookies()- Returns:
- the value of the
CookieDirproperty
-
setCookieDir
Sets theCookieDirproperty; seegetCookieDir().- Parameters:
value- the new value (notnull)
-
getDefaultFreshPeriod
public int getDefaultFreshPeriod()Sets the default freshness period (in minutes) for cached documents when theproperty is set to 0. The default value is 10080 (1 week).getFreshnessAlgorithm()HTTP GET web page caching properties and methods include:
,getNumCacheRoots(),getNumCacheLevels(),addCacheRoot(String),getFetchFromCache(),getUpdateCache(),getMinFreshPeriod(),getMaxFreshPeriod(),getFreshnessAlgorithm(),getDefaultFreshPeriod(),getLMFactor(),getIgnoreMustRevalidate(), andgetIgnoreNoCache().getLastFromCache()- Returns:
- the value of the
DefaultFreshPeriodproperty
-
setDefaultFreshPeriod
public void setDefaultFreshPeriod(int value)Sets theDefaultFreshPeriodproperty; seegetDefaultFreshPeriod().- Parameters:
value- the new value
-
getDigestAuth
public boolean getDigestAuth()Setting this property totruecauses the HTTP component to use digest authentication. The default value isfalse.HTTP Digest Authentication is a challenge–response mechanism where the server sends a nonce (a unique random value) to the client. The client must hash the username, password, nonce, and request details (method, URI) into a digest using MD5 (or similar). The server performs the same calculation to verify.
Unlike Basic Auth, the password is never sent in clear text—only the hash is transmitted—making it more secure against eavesdropping.
- Returns:
- the value of the
DigestAuthproperty
-
setDigestAuth
public void setDigestAuth(boolean value)Sets theDigestAuthproperty; seegetDigestAuth().- Parameters:
value- the new value
-
getEnableSecrets
public boolean getEnableSecrets()This property that automatic resolution of credentials from the operating system’s secure storage.When set to
true, the supported properties and methods (listed below) can accept a secret specification string (beginning with!!) in place of a literal value. Chilkat detects this format and retrieves the corresponding secret from:- Windows Credential Manager (Windows)
- Apple Keychain (macOS)
Secrets are identified using a structured string format:
!![appName|]service[|domain]|usernameApplies to
,getAwsAccessKey(),getAwsEndpoint(),getAwsRegion(),getAwsSessionToken(),getAwsSecretKey(),getProxyPassword(),getSocksPassword().getPassword()This feature allows applications to avoid embedding sensitive data directly in code by securely resolving credentials at runtime.
The default value is
false- Returns:
- the value of the
EnableSecretsproperty
-
setEnableSecrets
public void setEnableSecrets(boolean value)Sets theEnableSecretsproperty; seegetEnableSecrets().- Parameters:
value- the new value
-
getFetchFromCache
public boolean getFetchFromCache()Set totrueto enable fetching pages from cache whenever possible. The default value isfalse. Only HTTP GET requests are cached. HTTP responses containingSet-Cookieheaders are never cached. A page is retrieved from the disk cache if it exists and is deemed fresh by theproperty. If the cached page is stale, the HTTP component will send a revalidate request and update the cache based on the response.getFreshnessAlgorithm()HTTP GET web page caching properties and methods include:
,getNumCacheRoots(),getNumCacheLevels(),addCacheRoot(String),getFetchFromCache(),getUpdateCache(),getMinFreshPeriod(),getMaxFreshPeriod(),getFreshnessAlgorithm(),getDefaultFreshPeriod(),getLMFactor(),getIgnoreMustRevalidate(), andgetIgnoreNoCache().getLastFromCache()- Returns:
- the value of the
FetchFromCacheproperty
-
setFetchFromCache
public void setFetchFromCache(boolean value)Sets theFetchFromCacheproperty; seegetFetchFromCache().- Parameters:
value- the new value
-
getFinalRedirectUrl
If theproperty indicates an HTTP GET was redirected, and thegetWasRedirected()property is set togetFollowRedirects()true, this property will hold the final redirect URL. This property will also contain the redirect URL for301/302responses, even ifis notgetFollowRedirects()true.- Returns:
- the value of the
FinalRedirectUrlproperty (read-only)
-
getFollowRedirects
public boolean getFollowRedirects()When set totrue,301,302,303,307, and308redirects are automatically followed. The default setting istrue.To determine if a redirect occurred, check the
property. The final URL after redirection is available in thegetWasRedirected()property.getFinalRedirectUrl()- Returns:
- the value of the
FollowRedirectsproperty
-
setFollowRedirects
public void setFollowRedirects(boolean value)Sets theFollowRedirectsproperty; seegetFollowRedirects().- Parameters:
value- the new value
-
getFreshnessAlgorithm
public int getFreshnessAlgorithm()To determine the freshness of a cached HTTP GET response, the freshness algorithm is employed. By default, it uses theLM-factoralgorithm, which is activated when theis set togetFreshnessAlgorithm()1. Theproperty, ranging from 1 to 100, specifies the percentage of the time since the last modification date of the HTML page that the page remains fresh. For instance, if the LMFactor is 50 and the page was last modified 10 days ago, it will expire after 5 days (50% of 10 days). This applies only to HTTP responses without explicit expiration information. If the FreshnessAlgorithm is set togetLMFactor()0, a constant expiry period, defined by theproperty, is applied.getDefaultFreshPeriod()HTTP GET web page caching properties and methods include:
,getNumCacheRoots(),getNumCacheLevels(),addCacheRoot(String),getFetchFromCache(),getUpdateCache(),getMinFreshPeriod(),getMaxFreshPeriod(),getFreshnessAlgorithm(),getDefaultFreshPeriod(),getLMFactor(),getIgnoreMustRevalidate(), andgetIgnoreNoCache().getLastFromCache()- Returns:
- the value of the
FreshnessAlgorithmproperty
-
setFreshnessAlgorithm
public void setFreshnessAlgorithm(int value)Sets theFreshnessAlgorithmproperty; seegetFreshnessAlgorithm().- Parameters:
value- the new value
-
getHeartbeatMs
public int getHeartbeatMs()The interval in milliseconds between eachevent callback, which enables an application to abort certain method calls before they complete. By default, HeartbeatMs is set toAbortCheck0, meaning no AbortCheck event callbacks will trigger.- Returns:
- the value of the
HeartbeatMsproperty
-
setHeartbeatMs
public void setHeartbeatMs(int value)Sets theHeartbeatMsproperty; seegetHeartbeatMs().- Parameters:
value- the new value
-
getIgnoreMustRevalidate
public boolean getIgnoreMustRevalidate()If an HTTP response includes theCache-Control: must-revalidateheader, it indicates that the server requires the client to revalidate the page with the server rather than serving it directly from the cache. However, if this property is set totrue, the page will be served directly from the cache without revalidation until it expires. The defautl value of this property isfalse.HTTP GET web page caching properties and methods include:
,getNumCacheRoots(),getNumCacheLevels(),addCacheRoot(String),getFetchFromCache(),getUpdateCache(),getMinFreshPeriod(),getMaxFreshPeriod(),getFreshnessAlgorithm(),getDefaultFreshPeriod(),getLMFactor(),getIgnoreMustRevalidate(), andgetIgnoreNoCache().getLastFromCache()- Returns:
- the value of the
IgnoreMustRevalidateproperty
-
setIgnoreMustRevalidate
public void setIgnoreMustRevalidate(boolean value)Sets theIgnoreMustRevalidateproperty; seegetIgnoreMustRevalidate().- Parameters:
value- the new value
-
getIgnoreNoCache
public boolean getIgnoreNoCache()Some HTTP responses include headers indicating the page should not be cached. Chilkat HTTP will follow these instructions unless this property is set totrue. The default value of this property isfalse.HTTP GET web page caching properties and methods include:
,getNumCacheRoots(),getNumCacheLevels(),addCacheRoot(String),getFetchFromCache(),getUpdateCache(),getMinFreshPeriod(),getMaxFreshPeriod(),getFreshnessAlgorithm(),getDefaultFreshPeriod(),getLMFactor(),getIgnoreMustRevalidate(), andgetIgnoreNoCache().getLastFromCache()- Returns:
- the value of the
IgnoreNoCacheproperty
-
setIgnoreNoCache
public void setIgnoreNoCache(boolean value)Sets theIgnoreNoCacheproperty; seegetIgnoreNoCache().- Parameters:
value- the new value
-
getKeepResponseBody
public boolean getKeepResponseBody()If set totrue, the response body, if it is text, is stored in theproperty for methods not returning angetLastResponseBody()HttpResponseobject. By default, this property isfalse.Note: Many methods provide an
HttpResponseobject as their final output argument.- Returns:
- the value of the
KeepResponseBodyproperty
-
setKeepResponseBody
public void setKeepResponseBody(boolean value)Sets theKeepResponseBodyproperty; seegetKeepResponseBody().- Parameters:
value- the new value
-
getLMFactor
public int getLMFactor()The LMFactor is an integer between 1 and 100 that specifies the percentage of time from an HTTP page's last-modified date to be used as the freshness period. The default is 25. For instance, if a page's last-modified date is 4 weeks ago and LMFactor is set to 25, the page will remain fresh in the cache for 1 week (25% of 4 weeks).HTTP GET web page caching properties and methods include:
,getNumCacheRoots(),getNumCacheLevels(),addCacheRoot(String),getFetchFromCache(),getUpdateCache(),getMinFreshPeriod(),getMaxFreshPeriod(),getFreshnessAlgorithm(),getDefaultFreshPeriod(),getLMFactor(),getIgnoreMustRevalidate(), andgetIgnoreNoCache().getLastFromCache()- Returns:
- the value of the
LMFactorproperty
-
setLMFactor
public void setLMFactor(int value)Sets theLMFactorproperty; seegetLMFactor().- Parameters:
value- the new value
-
getLastContentType
TheContent-Typeheader value from the most recent HTTP response received.- Returns:
- the value of the
LastContentTypeproperty (read-only)
-
getLastFromCache
public boolean getLastFromCache()trueif the last GET was fetched from cache.HTTP GET web page caching properties and methods include:
,getNumCacheRoots(),getNumCacheLevels(),addCacheRoot(String),getFetchFromCache(),getUpdateCache(),getMinFreshPeriod(),getMaxFreshPeriod(),getFreshnessAlgorithm(),getDefaultFreshPeriod(),getLMFactor(),getIgnoreMustRevalidate(), andgetIgnoreNoCache().getLastFromCache()- Returns:
- the value of the
LastFromCacheproperty (read-only)
-
getLastHeader
Contains the text of the last HTTP header sent by any method.An HTTP request begins with a start line (called the *status line*), which contains the protocol version, status code, and reason phrase (e.g.,
HTTP/1.1 200 OK).After that comes the header section, made up of key–value pairs (like
Content-Type: text/html).This property contains both the start line and the header section. For example:
POST /echo_request_body.asp HTTP/1.1 Host: chilkatsoft.com Accept: */* Accept-Encoding: gzip Content-Type: application/json Content-Length: 26
- Returns:
- the value of the
LastHeaderproperty (read-only)
-
getLastModDate
TheLast-Modifiedheader value from the most recent HTTP response received.- Returns:
- the value of the
LastModDateproperty (read-only)
-
getLastResponseBody
The response body from the last HTTP request is saved in this property only if theproperty is set to TRUE. This applies to methods that don't return angetKeepResponseBody()HttpResponseobject.- Returns:
- the value of the
LastResponseBodyproperty (read-only)
-
getLastResponseHeader
Returns the most recent full response header for methods that do not use anHttpResponseobject. For example:Content-Type: application/json Last-Modified: Sun, 20 Aug 2023 11:36:27 GMT Accept-Ranges: bytes ETag: "34c27f8e5ad3d91:0" Server: Microsoft-IIS/10.0 X-Powered-By: ASP.NET Date: Sat, 30 Aug 2025 14:35:55 GMT Content-Length: 22
- Returns:
- the value of the
LastResponseHeaderproperty (read-only)
-
getLastStatus
public int getLastStatus()Contains the most recent response status code for methods that don't utilize anHttpResponseobject.- Returns:
- the value of the
LastStatusproperty (read-only)
-
getLastStatusText
Contains the latest response status text for methods that don't use anHttpResponseobject. The response status text appears after the status code in the first line of an HTTP response. For example, in the HTTP response below, the status text isOK:HTTP/1.1 200 OK Content-Type: application/json Last-Modified: Sun, 20 Aug 2023 11:36:27 GMT Accept-Ranges: bytes ETag: "34c27f8e5ad3d91:0" Server: Microsoft-IIS/10.0 X-Powered-By: ASP.NET Date: Sat, 30 Aug 2025 14:35:55 GMT Content-Length: 22 { "hello": "world" }- Returns:
- the value of the
LastStatusTextproperty (read-only)
-
getLogin
This is the login string to be used with HTTPbasic,digest, orNTLMauthentication.- Returns:
- the value of the
Loginproperty
-
setLogin
Sets theLoginproperty; seegetLogin().- Parameters:
value- the new value (notnull)
-
getLoginDomain
The optional domain name to be used with NTLM authentication.In NTLM HTTP authentication, the login domain is the Windows domain that contains the user account.
The client sends it in the NTLM messages (e.g.,
DOMAIN\Username) so the server knows which domain controller to contact to verify the credentials. If no domain is given, the server may fall back to checking local machine accounts.- Returns:
- the value of the
LoginDomainproperty
-
setLoginDomain
Sets theLoginDomainproperty; seegetLoginDomain().- Parameters:
value- the new value (notnull)
-
getMaxConnections
public int getMaxConnections()This class automatically manages simultaneous open HTTP connections. If the maximum number of connections is reached, the least recently active connection is automatically closed. The default value is10.An HTTP connection can remain open if the client and server use persistent connections (e.g.,
Connection: keep-alivein HTTP/1.1).This allows multiple requests and responses to be sent over the same TLS connection instead of opening a new one each time.
Reasons:
- Reduces latency (no repeated TLS handshakes).
- Improves efficiency for sending many requests.
Also see:
closeAllConnections()- Returns:
- the value of the
MaxConnectionsproperty
-
setMaxConnections
public void setMaxConnections(int value)Sets theMaxConnectionsproperty; seegetMaxConnections().- Parameters:
value- the new value
-
getMaxFreshPeriod
public int getMaxFreshPeriod()Sets a time limit for how long a document can remain fresh in the cache, measured in minutes, with a default value of 525,600 minutes (equivalent to 1 year).HTTP GET web page caching properties and methods include:
,getNumCacheRoots(),getNumCacheLevels(),addCacheRoot(String),getFetchFromCache(),getUpdateCache(),getMinFreshPeriod(),getMaxFreshPeriod(),getFreshnessAlgorithm(),getDefaultFreshPeriod(),getLMFactor(),getIgnoreMustRevalidate(), andgetIgnoreNoCache().getLastFromCache()- Returns:
- the value of the
MaxFreshPeriodproperty
-
setMaxFreshPeriod
public void setMaxFreshPeriod(int value)Sets theMaxFreshPeriodproperty; seegetMaxFreshPeriod().- Parameters:
value- the new value
-
getMaxResponseSize
public long getMaxResponseSize()Specify the maximum HTTP response size the program will accept. Thedefault value of 0 meansthere isno size limit. This safeguard helps prevent receiving excessively large responses that could hang or crash the application.- Returns:
- the value of the
MaxResponseSizeproperty
-
setMaxResponseSize
public void setMaxResponseSize(long value)Sets theMaxResponseSizeproperty; seegetMaxResponseSize().- Parameters:
value- the new value (0 .. 4294967295)
-
getMaxUrlLen
public int getMaxUrlLen()Limit the length of URLs (including URL parameters) in HTTP requests by setting this property. The default value is2000characters.- Returns:
- the value of the
MaxUrlLenproperty
-
setMaxUrlLen
public void setMaxUrlLen(int value)Sets theMaxUrlLenproperty; seegetMaxUrlLen().- Parameters:
value- the new value
-
getMinFreshPeriod
public int getMinFreshPeriod()Sets the minimum time a document stays fresh in the cache, with a default of 30 minutes.HTTP GET web page caching properties and methods include:
,getNumCacheRoots(),getNumCacheLevels(),addCacheRoot(String),getFetchFromCache(),getUpdateCache(),getMinFreshPeriod(),getMaxFreshPeriod(),getFreshnessAlgorithm(),getDefaultFreshPeriod(),getLMFactor(),getIgnoreMustRevalidate(), andgetIgnoreNoCache().getLastFromCache()- Returns:
- the value of the
MinFreshPeriodproperty
-
setMinFreshPeriod
public void setMinFreshPeriod(int value)Sets theMinFreshPeriodproperty; seegetMinFreshPeriod().- Parameters:
value- the new value
-
getNegotiateAuth
public boolean getNegotiateAuth()Set this property equal totruefor Negotiate authentication.Note: The NegotiateAuth property is only available for the Microsoft Windows operating system.
- Returns:
- the value of the
NegotiateAuthproperty
-
setNegotiateAuth
public void setNegotiateAuth(boolean value)Sets theNegotiateAuthproperty; seegetNegotiateAuth().- Parameters:
value- the new value
-
getNtlmAuth
public boolean getNtlmAuth()Setting this property totruecauses the HTTP component to use NTLM authentication (also known as IWA -- or Integrated Windows Authentication) when authentication with an HTTP server. The default value isfalse.- Returns:
- the value of the
NtlmAuthproperty
-
setNtlmAuth
public void setNtlmAuth(boolean value)Sets theNtlmAuthproperty; seegetNtlmAuth().- Parameters:
value- the new value
-
getNumCacheLevels
public int getNumCacheLevels()This setting determines the directory levels used under each cache root. The default value is 0, meaning cached HTML pages are stored directly in the cache root directory.- Level 0: Cached pages are stored in the cache root directory.
- Level 1: Cached pages go into one of 255 subdirectories (0 to 255) under the cache root.
- Level 2: Two levels of subdirectories (0-255/0-255) are created under each
cache root.
The HTTP class automatically creates these subdirectories as needed. Multiple directory levels help prevent issues caused by having too many files in a single directory.
HTTP GET web page caching properties and methods include:
,getNumCacheRoots(),getNumCacheLevels(),addCacheRoot(String),getFetchFromCache(),getUpdateCache(),getMinFreshPeriod(),getMaxFreshPeriod(),getFreshnessAlgorithm(),getDefaultFreshPeriod(),getLMFactor(),getIgnoreMustRevalidate(), andgetIgnoreNoCache().getLastFromCache()- Returns:
- the value of the
NumCacheLevelsproperty
-
setNumCacheLevels
public void setNumCacheLevels(int value)Sets theNumCacheLevelsproperty; seegetNumCacheLevels().- Parameters:
value- the new value
-
getNumCacheRoots
public int getNumCacheRoots()Specifies the number of established cache roots used by the HTTP cache to distribute the disk cache across multiple directories. Each cache root is an absolute directory path, set using themethod.addCacheRoot(String)HTTP GET web page caching properties and methods include:
,getNumCacheRoots(),getNumCacheLevels(),addCacheRoot(String),getFetchFromCache(),getUpdateCache(),getMinFreshPeriod(),getMaxFreshPeriod(),getFreshnessAlgorithm(),getDefaultFreshPeriod(),getLMFactor(),getIgnoreMustRevalidate(), andgetIgnoreNoCache().getLastFromCache()- Returns:
- the value of the
NumCacheRootsproperty (read-only)
-
getOAuth1
public boolean getOAuth1()Iftruethen causes an OAuth Authorization header to be added to any request sent by the HTTP object. For example:Authorization: OAuth realm="http://sp.example.com/", oauth_consumer_key="0685bd9184jfhq22", oauth_token="ad180jjd733klru7", oauth_signature_method="HMAC-SHA1", oauth_signature="wOJIO9A2W5mFwDgiDvZbTSMK%2FPY%3D", oauth_timestamp="137131200", oauth_nonce="4572616e48616d6d65724c61686176", oauth_version="1.0"The information used to compute the OAuth Authorization header is obtained from the other OAuth* properties, such as OAuthConsumerKey, OAuthConsumerSecret, OAuthRealm, etc.
- Returns:
- the value of the
OAuth1property
-
setOAuth1
public void setOAuth1(boolean value)Sets theOAuth1property; seegetOAuth1().- Parameters:
value- the new value
-
getOAuthBodyHash
public boolean getOAuthBodyHash()When set totrue, theoauth_body_hash, which contains theSHA-256hash of the HTTP request body, is automatically included in theOAuth1.0a Authorization header.For example:
Authorization: OAuth oauth_consumer_key="***", oauth_nonce="A2E91C3B53E0BD7FBF71F441336679E358DDCEEE", oauth_body_hash="a5kPTsDwUwmBjC0voNlAAvM6YoaRS5X7sTO49jl3/h8=", oauth_timestamp="1756324932", oauth_signature_method="RSA-SHA256", oauth_version="1.0", oauth_signature="****"
This property is only used when the
property equalsgetOAuth1()true.- Returns:
- the value of the
OAuthBodyHashproperty
-
setOAuthBodyHash
public void setOAuthBodyHash(boolean value)Sets theOAuthBodyHashproperty; seegetOAuthBodyHash().- Parameters:
value- the new value
-
getOAuthCallback
TheOAuth 1.0acallback URL. Defaults tooob.This property is only used when the
property equalsgetOAuth1()true.- Returns:
- the value of the
OAuthCallbackproperty
-
setOAuthCallback
Sets theOAuthCallbackproperty; seegetOAuthCallback().- Parameters:
value- the new value (notnull)
-
getOAuthConsumerKey
TheOAuth1.0aconsumer key to be used in theoauth_consumer_keyparameter of theAuthorizationheader.This property is only used when the
property equalsgetOAuth1()true.- Returns:
- the value of the
OAuthConsumerKeyproperty
-
setOAuthConsumerKey
Sets theOAuthConsumerKeyproperty; seegetOAuthConsumerKey().- Parameters:
value- the new value (notnull)
-
getOAuthConsumerSecret
The consumer secret to be used in computing the contents of theOAuth1.0aAuthorizationheader.This property is only used when the
property equalsgetOAuth1()true.- Returns:
- the value of the
OAuthConsumerSecretproperty
-
setOAuthConsumerSecret
Sets theOAuthConsumerSecretproperty; seegetOAuthConsumerSecret().- Parameters:
value- the new value (notnull)
-
getOAuthRealm
The OAuth1.0arealmto be used in theAuthorizationheader.The OAuth 1.0a realm parameter is an optional, descriptive string in the Authorization header that indicates the protected resources’ scope. It is not required, not included in the signature, and rarely used in real-world APIs. Most modern OAuth 1.0a integrations ignore it completely.
This property is only used when the
property equalsgetOAuth1()true.- Returns:
- the value of the
OAuthRealmproperty
-
setOAuthRealm
Sets theOAuthRealmproperty; seegetOAuthRealm().- Parameters:
value- the new value (notnull)
-
getOAuthSigMethod
Specify theoauth_signature_methodparameter in theOAuth 1.0a Authorization header. The default method isHMAC-SHA1, but it can be set toHMAC-SHA256,RSA-SHA1, orRSA-SHA256. ForRSAmethods, provide an RSA private key using themethod.setOAuthRsaKey(PrivateKey)This property is only used when the
property equalsgetOAuth1()true.Note that RSA-SHA256 is supported from Chilkat v9.5.0.56 onwards.
- Returns:
- the value of the
OAuthSigMethodproperty
-
setOAuthSigMethod
Sets theOAuthSigMethodproperty; seegetOAuthSigMethod().- Parameters:
value- the new value (notnull)
-
getOAuthToken
The value to be used for theoauth_tokenparameter in theOAuth1.0aAuthorizationheader.This property is only used when the
property equalsgetOAuth1()true.- Returns:
- the value of the
OAuthTokenproperty
-
setOAuthToken
Sets theOAuthTokenproperty; seegetOAuthToken().- Parameters:
value- the new value (notnull)
-
getOAuthTokenSecret
TheOAuth1.0atoken secret to be used in computing the Authorization header.This property is only used when the
property equalsgetOAuth1()true.- Returns:
- the value of the
OAuthTokenSecretproperty
-
setOAuthTokenSecret
Sets theOAuthTokenSecretproperty; seegetOAuthTokenSecret().- Parameters:
value- the new value (notnull)
-
getOAuthVerifier
The value to be used for the verifier to be used in theoauth_verifierparameter of theOAuth1.0aAuthorizationheader.This property is only used when the
property equalsgetOAuth1()true.- Returns:
- the value of the
OAuthVerifierproperty
-
setOAuthVerifier
Sets theOAuthVerifierproperty; seegetOAuthVerifier().- Parameters:
value- the new value (notnull)
-
getPassword
The HTTP password for pages requiring a login/password. Chilkat HTTP can do Basic, Digest, and NTLM HTTP authentication. (NTLM is also known as SPA (or Windows Integrated Authentication). To use Basic authentication, the BasicAuth property must be set equal totrue. It is not necessary to set the NtlmAuth or DigestAuth properties beforehand if NTLM or Digest authentication is needed. However, it is most efficient to pre-set these properties when the type of authentication is known in advance.Note: When the Login and Password properties are set, and the type of authentication is specified by setting one of the following properties equal to
true(BasicAuth, DigestAuth, NtlmAuth), Chilkat will automatically add theAuthorization: ...header in the correct format.- Returns:
- the value of the
Passwordproperty
-
setPassword
Sets thePasswordproperty; seegetPassword().- Parameters:
value- the new value (notnull)
-
getPercentDoneScale
public int getPercentDoneScale()This property is only valid in programming environment and languages that allow for event callbacks.Sets the value to be defined as 100% complete for the purpose of PercentDone event callbacks. The defaut value of 100 means that at most 100 event PercentDone callbacks will occur in a method that (1) is event enabled and (2) is such that it is possible to measure progress as a percentage completed. This property may be set to larger numbers to get more fine-grained PercentDone callbacks. For example, setting this property equal to 1000 will provide callbacks with .1 percent granularity. For example, a value of 453 would indicate 45.3% competed. This property is clamped to a minimum value of 10, and a maximum value of 100000.
- Returns:
- the value of the
PercentDoneScaleproperty
-
setPercentDoneScale
public void setPercentDoneScale(int value)Sets thePercentDoneScaleproperty; seegetPercentDoneScale().- Parameters:
value- the new value
-
getPreferIpv6
public boolean getPreferIpv6()Iftrue, then use IPv6 over IPv4 when both are supported for a particular domain. The default value of this property isfalse, which will choose IPv4 over IPv6.- Returns:
- the value of the
PreferIpv6property
-
setPreferIpv6
public void setPreferIpv6(boolean value)Sets thePreferIpv6property; seegetPreferIpv6().- Parameters:
value- the new value
-
getProxyAuthMethod
Set this tobasicif you know in advance that Basic authentication is to be used for the HTTP proxy. Otherwise leave this property unset. Note: It is not necessary to set this property. The HTTP component will automatically handle proxy authentication for any of the supported authentication methods: NTLM, Digest, or Basic. Setting this property equal tobasicprevents the 407 response which is automatically handled internal to Chilkat and never seen by your application.Note: If NTLM authentication does not succeed, set the Global.DefaultNtlmVersion property equal to 1 and then retry.
- Returns:
- the value of the
ProxyAuthMethodproperty
-
setProxyAuthMethod
Sets theProxyAuthMethodproperty; seegetProxyAuthMethod().- Parameters:
value- the new value (notnull)
-
getProxyDirectTls
public boolean getProxyDirectTls()Set totrueif the proxy server expects a direct TLS connection. (This is where the initial connection to the HTTP proxy server is TLS. See Squid Direct TLS Connection. The default value of this property isfalse.- Returns:
- the value of the
ProxyDirectTlsproperty
-
setProxyDirectTls
public void setProxyDirectTls(boolean value)Sets theProxyDirectTlsproperty; seegetProxyDirectTls().- Parameters:
value- the new value
-
getProxyDomain
The domain name of a proxy host if an HTTP proxy is used. This can also be set to an IP address.- Returns:
- the value of the
ProxyDomainproperty
-
setProxyDomain
Sets theProxyDomainproperty; seegetProxyDomain().- Parameters:
value- the new value (notnull)
-
getProxyLogin
If an HTTP proxy is used and it requires authentication, this property specifies the HTTP proxy login.- Returns:
- the value of the
ProxyLoginproperty
-
setProxyLogin
Sets theProxyLoginproperty; seegetProxyLogin().- Parameters:
value- the new value (notnull)
-
getProxyLoginDomain
The NTLM authentication domain (optional) if NTLM authentication is used.- Returns:
- the value of the
ProxyLoginDomainproperty
-
setProxyLoginDomain
Sets theProxyLoginDomainproperty; seegetProxyLoginDomain().- Parameters:
value- the new value (notnull)
-
getProxyPassword
If an HTTP proxy is used and it requires authentication, this property specifies the HTTP proxy password.- Returns:
- the value of the
ProxyPasswordproperty
-
setProxyPassword
Sets theProxyPasswordproperty; seegetProxyPassword().- Parameters:
value- the new value (notnull)
-
getProxyPort
public int getProxyPort()The port number of a proxy server if an HTTP proxy is used.- Returns:
- the value of the
ProxyPortproperty
-
setProxyPort
public void setProxyPort(int value)Sets theProxyPortproperty; seegetProxyPort().- Parameters:
value- the new value
-
getReadTimeout
public int getReadTimeout()The amount of time in seconds to wait before timing out when reading from an HTTP server. The ReadTimeout is the amount of time that needs to elapse while no additional data is forthcoming. During a long download, if the data stream halts for more than this amount, it will timeout. Otherwise, there is no limit on the length of time for the entire download.The default value is 60 seconds. Note: Prior to v9.5.0.76, the default was 20 seconds.
- Returns:
- the value of the
ReadTimeoutproperty
-
setReadTimeout
public void setReadTimeout(int value)Sets theReadTimeoutproperty; seegetReadTimeout().- Parameters:
value- the new value
-
getReceivedCertReq
public boolean getReceivedCertReq()Indicates whether the last HTTPS connection received a TLS CertificateRequest handshake message indicating that the server may require a client certificate.- Returns:
- the value of the
ReceivedCertReqproperty (read-only)
-
getRedirectVerb
Indicates the HTTP verb, such as GET, POST, PUT, etc. to be used for a redirect when the FollowRedirects property is set totrue. The default value of this property isGET. This will produce the same behavior as a web browser (such as FireFox). If this property is set to the empty string, then it will cause the same verb as the original HTTP request to be used.Note: Prior to version 9.5.0.44, the default value of this property was the empty string.
- Returns:
- the value of the
RedirectVerbproperty
-
setRedirectVerb
Sets theRedirectVerbproperty; seegetRedirectVerb().- Parameters:
value- the new value (notnull)
-
getRequireHostnameMatch
public boolean getRequireHostnameMatch()Iftrue, then the hostname/domain in the URL must match at least one of the entries in the server certificate's SAN. A SAN (Subject Alternative Name) field in an SSL/TLS certificate contains a list of additional domain names, subdomains, IP addresses, or other identifiers that the certificate is valid for.In actuality, it is the SNI hostname in the TLS handshake that must match a SAN entry. By default, Chilkat uses the hostname from the URL as the SNI hostname. An application can explicitly set the SNI hostname via the
SniHostnameproperty, which would be typical if connecting via an IP address. See the example below.Starting in v11.7.0, a wildcard SAN entry is matched as RFC 9525 (formerly RFC 6125) specifies. The wildcard must be the entire left-most label (
*.example.com) and stands for exactly one label:*.example.commatcheswww.example.com, but nota.b.example.comand not the bareexample.com. (Earlier versions matched the bare domain, and accepted a wildcard in any position.) A wildcard is not accepted directly under a top-level domain or a country-code second level such asco.uk, and never matches an IP address.The default value is
false.- Returns:
- the value of the
RequireHostnameMatchproperty
-
setRequireHostnameMatch
public void setRequireHostnameMatch(boolean value)Sets theRequireHostnameMatchproperty; seegetRequireHostnameMatch().- Parameters:
value- the new value
-
getRequireSslCertVerify
public boolean getRequireSslCertVerify()Iftrue, then the HTTP client will verify the server's SSL certificate. The certificate is expired, or if the cert's signature is invalid, the connection is not allowed. The default value of this property isfalse.- Returns:
- the value of the
RequireSslCertVerifyproperty
-
setRequireSslCertVerify
public void setRequireSslCertVerify(boolean value)Sets theRequireSslCertVerifyproperty; seegetRequireSslCertVerify().- Parameters:
value- the new value
-
getRequiredContentType
If set, then any HTTP response to any POST or GET, including downloads, will be rejected if the content-type in the response header does not match this setting. If the content-type does not match, only the header of the HTTP response is read, the connection to the HTTP server is closed, and the remainder of the response is never read.This property is empty (zero-length string) by default.
Some typical content-types are
text/html,text/xml,image/gif,image/jpeg,application/zip,application/msword,application/pdf, etc.- Returns:
- the value of the
RequiredContentTypeproperty
-
setRequiredContentType
Sets theRequiredContentTypeproperty; seegetRequiredContentType().- Parameters:
value- the new value (notnull)
-
getSaveCookies
public boolean getSaveCookies()If this property istrue, cookies are automatically persisted to XML files in the directory specified by the CookiesDir property (or in memory if CookieDir =memory). Both CookiesDir and SaveCookies must be set for cookies to be persisted.- Returns:
- the value of the
SaveCookiesproperty
-
setSaveCookies
public void setSaveCookies(boolean value)Sets theSaveCookiesproperty; seegetSaveCookies().- Parameters:
value- the new value
-
getSendBufferSize
public int getSendBufferSize()The buffer size to be used with the underlying TCP/IP socket for sending. The default value is 65535.- Returns:
- the value of the
SendBufferSizeproperty
-
setSendBufferSize
public void setSendBufferSize(int value)Sets theSendBufferSizeproperty; seegetSendBufferSize().- Parameters:
value- the new value
-
getSendCookies
public boolean getSendCookies()Iftrue, then cookies previously persisted to the CookiesDir are automatically added to all HTTP requests. Only cookies matching the domain and path are added.- Returns:
- the value of the
SendCookiesproperty
-
setSendCookies
public void setSendCookies(boolean value)Sets theSendCookiesproperty; seegetSendCookies().- Parameters:
value- the new value
-
getSessionLogFilename
Enables file-based session logging. If set to a filename (or relative/absolute filepath), then the exact HTTP requests and responses are logged to a file. The file is created if it does not already exist, otherwise it is appended.- Returns:
- the value of the
SessionLogFilenameproperty
-
setSessionLogFilename
Sets theSessionLogFilenameproperty; seegetSessionLogFilename().- Parameters:
value- the new value (notnull)
-
getSniHostname
Sets the SNI hostname for the TLS ClientHello. This property is usually necessary only when the domain is specified by an IP address and an SNI hostname is required. By default Chilkat uses the hostname in the URL for the SNI hostname in the TLS ClientHello extension automatically.- Returns:
- the value of the
SniHostnameproperty
-
setSniHostname
Sets theSniHostnameproperty; seegetSniHostname().- Parameters:
value- the new value (notnull)
-
getSoRcvBuf
public int getSoRcvBuf()Sets the receive buffer size socket option. Normally, this property should be left unchanged. The default value is 4194304.This property can be increased if download performance seems slow. It is recommended to be a multiple of 4096.
- Returns:
- the value of the
SoRcvBufproperty
-
setSoRcvBuf
public void setSoRcvBuf(int value)Sets theSoRcvBufproperty; seegetSoRcvBuf().- Parameters:
value- the new value
-
getSoSndBuf
public int getSoSndBuf()Sets the send buffer size socket option. Normally, this property should be left unchanged. The default value is 262144.This property can be increased if upload performance seems slow. It is recommended to be a multiple of 4096. Testing with sizes such as 512K and 1MB is reasonable.
- Returns:
- the value of the
SoSndBufproperty
-
setSoSndBuf
public void setSoSndBuf(int value)Sets theSoSndBufproperty; seegetSoSndBuf().- Parameters:
value- the new value
-
getSocksHostname
The SOCKS4/SOCKS5 hostname or IPv4 address (in dotted decimal notation). This property is only used if the SocksVersion property is set to 4 or 5).- Returns:
- the value of the
SocksHostnameproperty
-
setSocksHostname
Sets theSocksHostnameproperty; seegetSocksHostname().- Parameters:
value- the new value (notnull)
-
getSocksPassword
The SOCKS5 password (if required). The SOCKS4 protocol does not include the use of a password, so this does not apply to SOCKS4.- Returns:
- the value of the
SocksPasswordproperty
-
setSocksPassword
Sets theSocksPasswordproperty; seegetSocksPassword().- Parameters:
value- the new value (notnull)
-
getSocksPort
public int getSocksPort()The SOCKS4/SOCKS5 proxy port. The default value is 1080. This property only applies if a SOCKS proxy is used (if the SocksVersion property is set to 4 or 5).- Returns:
- the value of the
SocksPortproperty
-
setSocksPort
public void setSocksPort(int value)Sets theSocksPortproperty; seegetSocksPort().- Parameters:
value- the new value
-
getSocksUsername
The SOCKS4/SOCKS5 proxy username. This property is only used if the SocksVersion property is set to 4 or 5).- Returns:
- the value of the
SocksUsernameproperty
-
setSocksUsername
Sets theSocksUsernameproperty; seegetSocksUsername().- Parameters:
value- the new value (notnull)
-
getSocksVersion
public int getSocksVersion()SocksVersion May be set to one of the following integer values:0 - No SOCKS proxy is used. This is the default.
4 - Connect via a SOCKS4 proxy.
5 - Connect via a SOCKS5 proxy.- Returns:
- the value of the
SocksVersionproperty
-
setSocksVersion
public void setSocksVersion(int value)Sets theSocksVersionproperty; seegetSocksVersion().- Parameters:
value- the new value
-
getSslAllowedCiphers
Provides a means for setting a list of ciphers that are allowed for SSL/TLS connections. The default (empty string) indicates that all implemented ciphers are possible. The TLS ciphers supported in Chilkat v9.5.0.55 and later are:TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256 TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 TLS_DHE_RSA_WITH_AES_256_CBC_SHA TLS_RSA_WITH_AES_256_CBC_SHA256 TLS_RSA_WITH_AES_256_GCM_SHA384 TLS_RSA_WITH_AES_256_CBC_SHA TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 TLS_DHE_RSA_WITH_AES_128_CBC_SHA TLS_RSA_WITH_AES_128_CBC_SHA256 TLS_RSA_WITH_AES_128_GCM_SHA256 TLS_RSA_WITH_AES_128_CBC_SHA TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA TLS_RSA_WITH_3DES_EDE_CBC_SHA TLS_ECDHE_RSA_WITH_RC4_128_SHA TLS_RSA_WITH_RC4_128_SHA TLS_RSA_WITH_RC4_128_MD5 TLS_DHE_RSA_WITH_DES_CBC_SHA TLS_RSA_WITH_DES_CBC_SHA
To restrict SSL/TLS connections to one or more specific ciphers, set this property to a comma-separated list of ciphers such as
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384. The order should be in terms of preference, with the preferred algorithms listed first. (Note that the client cannot specifically choose the algorithm is picked because it is the server that chooses. The client simply provides the server with a list from which to choose.)The property can also disallow connections with servers having certificates with RSA keys less than a certain size. By default, server certificates having RSA keys of 512 bits or greater are allowed. Add the keyword
rsa1024to disallow connections with servers having keys smaller than 1024 bits. Add the keywordrsa2048to disallow connections with servers having keys smaller than 2048 bits.Note: Prior to Chilkat v9.5.0.55, it was not possible to explicitly list allowed cipher suites. The deprecated means for indicating allowed ciphers was both incomplete and unprecise. For example, the following keywords could be listed to allow matching ciphers:
aes256-cbc,aes128-cbc,3des-cbc, andrc4. These keywords will still be recognized, but programs should be updated to explicitly list the allowed ciphers.secure-renegotiation: Starting in Chilkat v9.5.0.55, the keyword
secure-renegotiationmay be added to require that all renegotions be done securely (as per RFC 5746).best-practices: Starting in Chilkat v9.5.0.55, this property may be set to the single keyword
best-practices. This will allow ciphers based on the current best practices. As new versions of Chilkat are released, the best practices may change. Changes will be noted here. The current best practices are:- If the server uses an RSA key, it must be 1024 bits or greater.
- All renegotations must be secure renegotiations.
- All ciphers using RC4, DES, or 3DES are disallowed.
Example: The following string would restrict to 2 specific cipher suites, require RSA keys to be 1024 bits or greater, and require secure renegotiations:
TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, rsa1024, secure-renegotiation- Returns:
- the value of the
SslAllowedCiphersproperty
-
setSslAllowedCiphers
Sets theSslAllowedCiphersproperty; seegetSslAllowedCiphers().- Parameters:
value- the new value (notnull)
-
getSslProtocol
Selects the SSL/TLS protocol version to be used for connections. Possible values are:default
The default value is
TLS 1.3
TLS 1.2
TLS 1.1
TLS 1.0
SSL 3.0
TLS 1.3 or higher
TLS 1.2 or higher
TLS 1.1 or higher
TLS 1.0 or higher
defaultwhich allows for the protocol to be selected dynamically at runtime based on the requirements of the server. Choosing an exact protocol will cause the connection to fail unless that exact protocol is negotiated. It is better to chooseX or higherthan an exact protocol. Thedefaultis effectivelySSL 3.0 or higher.- Returns:
- the value of the
SslProtocolproperty
-
setSslProtocol
Sets theSslProtocolproperty; seegetSslProtocol().- Parameters:
value- the new value (notnull)
-
getStreamResponseBodyPath
Allows for the HTTP response body to be streamed directly into a file. If this property is set, then any method returning an HTTP response object will stream the response body directly to the file path specified. The HTTP response object will still contain the response header. (This property is useful when the HTTP response is too large to fit into memory.)- Returns:
- the value of the
StreamResponseBodyPathproperty
-
setStreamResponseBodyPath
Sets theStreamResponseBodyPathproperty; seegetStreamResponseBodyPath().- Parameters:
value- the new value (notnull)
-
getTlsCipherSuite
Contains the current or last negotiated TLS cipher suite. If no TLS connection has yet to be established, or if a connection as attempted and failed, then this will be empty. A sample cipher suite string looks like this: TLS_DHE_RSA_WITH_AES_256_CBC_SHA256.- Returns:
- the value of the
TlsCipherSuiteproperty (read-only)
-
getTlsPinSet
Specifies a set of pins for Public Key Pinning for TLS connections. This property lists the expected SPKI fingerprints for the server certificates. If the server's certificate (sent during the TLS handshake) does not match any of the SPKI fingerprints, then the TLS handshake is aborted and the connection fails. The format of this string property is as follows:hash_algorithm, encoding, SPKI_fingerprint_1, SPKI_fingerprint_2, ...
For example, the following string specifies a single sha256 base64-encoded SPKI fingerprint:
"sha256, base64, lKg1SIqyhPSK19tlPbjl8s02yChsVTDklQpkMCHvsTE="
This example specifies two SPKI fingerprints:
"sha256, base64, 4t37LpnGmrMEAG8HEz9yIrnvJV2euVRwCLb9EH5WZyI=, 68b0G5iqMvWVWvUCjMuhLEyekM5729PadtnU5tdXZKs="
Any of the following hash algorithms are allowed:.sha1, sha256, sha384, sha512, md2, md5, haval, ripemd128, ripemd160,ripemd256, or ripemd320.
The following encodings are allowed: base64, hex, and any of the encodings indicated in the link below.
- Returns:
- the value of the
TlsPinSetproperty
-
setTlsPinSet
Sets theTlsPinSetproperty; seegetTlsPinSet().- Parameters:
value- the new value (notnull)
-
getTlsVersion
Contains the current or last negotiated TLS protocol version. If no TLS connection has yet to be established, or if a connection as attempted and failed, then this will be empty. Possible values areSSL 3.0,TLS 1.0,TLS 1.1,TLS 1.2, andTLS 1.3.- Returns:
- the value of the
TlsVersionproperty (read-only)
-
getUncommonOptions
This is a catch-all property to be used for uncommon needs. This property defaults to the empty string and should typically remain empty. Can be set to a list of the following comma separated keywords:QuickDisconnect- Introduced in v9.5.0.77. In the call to CloseAllConnections, do not disconnect cleanly. Instead just disconnect as quickly as possible.ProtectFromVpn- Introduced in v9.5.0.80. On Android systems, will bypass any VPN that may be installed or active.TlsNoClientRootCert- Introduced in v9.5.0.82. Will exclude root CA certs from being included in the client certificate chain that is sent to the server for client-side authentication. This must be set prior to calling SetSslClientCert.AllowEmptyHeaders- Introduced in v9.5.0.82. If present, an empty value string passed to SetHeaderField will cause the header to be added with an empty value. Otherwise, for historical purposes and backward compatibility, the header field is removed when an empty value string is passed.AnsiLogin- Introduced in v9.5.0.87. For HTTP basic authentication, the login and password is sent using the utf-8 byte representation. Some servers expect the ANSI byte representation (typically Windows-1252). Use this keyword to send the login/password using ANSI.
- Returns:
- the value of the
UncommonOptionsproperty
-
setUncommonOptions
Sets theUncommonOptionsproperty; seegetUncommonOptions().- Parameters:
value- the new value (notnull)
-
getUpdateCache
public boolean getUpdateCache()Set this property totrueto automatically updated with HTTP GET request responses. Only HTTP GET requests are cached. HTTP responses containingSet-Cookieheaders are never cached. The default value isfalse.HTTP GET web page caching properties and methods include:
,getNumCacheRoots(),getNumCacheLevels(),addCacheRoot(String),getFetchFromCache(),getUpdateCache(),getMinFreshPeriod(),getMaxFreshPeriod(),getFreshnessAlgorithm(),getDefaultFreshPeriod(),getLMFactor(),getIgnoreMustRevalidate(), andgetIgnoreNoCache().getLastFromCache()- Returns:
- the value of the
UpdateCacheproperty
-
setUpdateCache
public void setUpdateCache(boolean value)Sets theUpdateCacheproperty; seegetUpdateCache().- Parameters:
value- the new value
-
getUseIEProxy
public boolean getUseIEProxy()Iftrue, the proxy address/port used by Internet Explorer will also be used by Chilkat HTTP. Note: This property only pays attention to the proxy address and port, and does not pay attention to additional information such as IE proxy server exceptions.- Returns:
- the value of the
UseIEProxyproperty
-
setUseIEProxy
public void setUseIEProxy(boolean value)Sets theUseIEProxyproperty; seegetUseIEProxy().- Parameters:
value- the new value
-
getUserAgent
This property sets theUser-Agentheader for all HTTP requests, except those sent by theandhttpReq(String, HttpRequest, HttpResponse)methods that use headers from anhttpSReq(String, int, boolean, HttpRequest, HttpResponse)HttpRequestobject.By default, it is set to an empty string, meaning no
User-Agentheader is included.Setting this property is the same as calling
withsetRequestHeader(String, String)User-Agentas the header field name.The
User-AgentHTTP header is sent by the client to identify the software making the request (browser, app, library, bot, etc.).Example:
MyApp/1.1
Note: Some web servers reject requests that do not include a
User-Agent.- Returns:
- the value of the
UserAgentproperty
-
setUserAgent
Sets theUserAgentproperty; seegetUserAgent().- Parameters:
value- the new value (notnull)
-
getWasRedirected
public boolean getWasRedirected()This shows whether the last HTTP request automatically followed a redirect. For more information on redirection, see theandgetFollowRedirects()properties.getFinalRedirectUrl()- Returns:
- the value of the
WasRedirectedproperty (read-only)
-
addCacheRoot
Disk caching operates similarly to browser caching of web pages, but it focuses on downloading web pages rather than handling HTTP requests to a REST API.To activate disk caching, invoke the method at least once. Use the
AddCacheRootmethod and provide a file path (e.g.,D:\MyHttpCache\) to set the root directory. To distribute the cache over multiple directories, callAddCacheRootmultiple times with different directory paths.HTTP GET web page caching properties and methods include:
,getNumCacheRoots(),getNumCacheLevels(),addCacheRoot(String),getFetchFromCache(),getUpdateCache(),getMinFreshPeriod(),getMaxFreshPeriod(),getFreshnessAlgorithm(),getDefaultFreshPeriod(),getLMFactor(),getIgnoreMustRevalidate(), andgetIgnoreNoCache().getLastFromCache()- Parameters:
dir- thedirargument (notnull)
-
clearHeaders
public void clearHeaders()Removes all headers set by themethod.setRequestHeader(String, String) -
clearInMemoryCookies
public void clearInMemoryCookies()Clears all in-memory cookies accumulated while theproperty was set togetSaveCookies()trueand thewas set togetCookieDir()memory. -
clearUrlVars
public void clearUrlVars()Removes all URL variable values previously set by.setUrlVar(String, String) -
closeAllConnections
public void closeAllConnections()Closes all remaining open HTTP connections.An HTTP object can hold up to 10 connections. If a server response lacks a
Connection: Closeheader, the connection stays open and may be reused for subsequent requests to the same host. Connections are identified by their IP address or domain name as specified in the URL. Once the limit of 10 connections is reached, the least recently used connection will be closed to open a new one.Also see:
.getMaxConnections()- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
createOcspRequest
Generates an OCSP request for one or more certificates using JSON (requestDetails) that specifies the request details. Refer to the examples in the provided links for guidance on constructing the JSON.Note:
After creating the OCSP request, send it to the server usingwith ahttpBd(String, String, BinData, String, HttpResponse)POSTrequest and a Content-Type ofapplication/ocsp-request. Useto analyze the OCSP response.parseOcspReply(BinData, JsonObject)- Parameters:
requestDetails- therequestDetailsargument (notnull)ocspRequest- theocspRequestargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
createTimestampRequest
public void createTimestampRequest(String hashAlg, String hashVal, String reqPolicyOid, boolean addNonce, boolean reqTsaCert, BinData timestampToken)Creates an RFC 3161 time-stamp request and returns the binary request token intimestampToken. ThehashAlgcan besha1,sha256,sha384,sha512, ormd5, ThehashValis the base64 hash of the data to be timestamped. The optionalreqPolicyOidis the requested policy OID in a format such as1.3.6.1.4.1.47272.1.2. TheaddNonceindicates whether to auto-generate and include a nonce in the request. It may betrueorfalse. ThereqTsaCertdetermines whether or not to request the TSA's certificate (true= Yes,false= No).Note:
After creating the timestamp request, send it to the server usingwith ahttpBd(String, String, BinData, String, HttpResponse)POSTrequest and a Content-Type ofapplication/timestamp-query. Useto analyze and verify the timestamp reply. See the examples linked below.verifyTimestampReply(BinData, Cert)- Parameters:
hashAlg- thehashAlgargument (notnull)hashVal- thehashValargument (notnull)reqPolicyOid- thereqPolicyOidargument (notnull)addNonce- theaddNonceargumentreqTsaCert- thereqTsaCertargumenttimestampToken- thetimestampTokenargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
dnsCacheClear
public void dnsCacheClear()This function clears the Chilkat in-memory DNS cache, which stores hostname-to-IP address mappings to avoid repeated DNS lookups.Note:
- The DNS cache is shared across all Chilkat objects, so clearing it will impact all such objects.
-
Chilkat's DNS caching respects the TTL (time to live) of DNS records. If the TTL has expired since
the initial lookup, Chilkat will perform a new DNS query and update the cache with the latest IP
address.
-
download
Downloads the content at the specifiedurland saves to a local file atlocalFilePath.The download succeeds if the HTTP response status code is in the 200s. If unsuccessful, no output file is created. If the
property is set togetKeepResponseBody()true, the server's error response will be available in theproperty.getLastResponseBody()The response status code will be available in the
property.getLastStatus()- Parameters:
url- theurlargument (notnull)localFilePath- thelocalFilePathargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
downloadAppend
Downloads the content at the specifiedurland appends to the local file atappendToPath. The file is created if it does not yet exist.The download succeeds if the HTTP status code is in the 200s. If unsuccessful, no output file is created. If the
property is set togetKeepResponseBody()true, the server's error response will be available in theproperty.getLastResponseBody()The response status code will be available in the
property.getLastStatus()- Parameters:
url- theurlargument (notnull)appendToPath- theappendToPathargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
downloadBd
Downloads content fromurltobinData, clearingbinDatabeforehand.binDatawill only contain the downloaded bytes if the operation is successful.The download succeeds if the HTTP status code is in the 200s. If unsuccessful, nothing is written to
binData. If theproperty is set togetKeepResponseBody()true, the server's error response will be available in theproperty.getLastResponseBody()The response status code will be available in the
property.getLastStatus()- Parameters:
url- theurlargument (notnull)binData- thebinDataargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
downloadHash
Fetches the content aturland returns the encoded hash using the specified algorithm (hashAlgorithm:sha1,sha256,sha384,sha512,md2,md5,haval,ripemd128,ripemd160,ripemd256, orripemd320), and returns the hash encoded in the specified encoding (encoding:Base64,modBase64,Base32,UU,QPfor quoted-printable,URLfor URL-encoding,Hex,Q,B,url_oath,url_rfc1738,url_rfc2396, orurl_rfc3986).- Parameters:
url- theurlargument (notnull)hashAlgorithm- thehashAlgorithmargument (notnull)encoding- theencodingargument (notnull)- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
downloadSb
Downloads the content at theurlinto a Chilkat StringBuilder object. Thecharsettells Chilkat how to interpret the bytes received. Thesbis appended with the downloaded text data.- Parameters:
url- theurlargument (notnull)charset- thecharsetargument (notnull)sb- thesbargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
extractMetaRefreshUrl
This is a convenience method for extracting the META refresh URL from HTML. For example, if thehtmlContentcontains a META refresh tag, such as:_LT_meta http-equiv="refresh" content="5;URL='https://example.com/'"_GT_
Then the return value of this method would be
https://example.com/.- Parameters:
htmlContent- thehtmlContentargument (notnull)- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
gSvcOauthAccessToken
public String gSvcOauthAccessToken(String iss, String scope, String subEmail, int numSec, Cert cert)Obtains a Google API OAuth2 access token for a service account. Theissis your service account email address ending ingserviceaccount.com. Thescopeshould be set tohttps://mail.google.com/for GMail. ThesubEmailis your company email address, e.g.bob@yourcompany.com.numSecis the number of seconds the access token will remain valid.- Parameters:
iss- theissargument (notnull)scope- thescopeargument (notnull)subEmail- thesubEmailargument (notnull)numSec- thenumSecargumentcert- thecertargument (notnull)- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
gSvcOauthAccessToken2
This method is similar toG_SvcOauthAccessToken, but offers greater customization. The first three arguments of G_SvcOauthAccessToken are replaced withclaimParamsto allow for future expansion with name-value parameters. See the example below.- Parameters:
claimParams- theclaimParamsargument (notnull)numSec- thenumSecargumentcert- thecertargument (notnull)- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
genTimeStamp
Returns the current date and time in GMT (UTC) as a string formatted according to RFC 2616:Day, DD Mon YYYY HH:MM:SS GMT. For example,Thu, 21 Aug 2025 11:17:31 GMT.- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
getCacheRoot
Returns the Nth cache root, with indexing starting at 0. Cache roots are established by callingone or more times. The number of established cache roots is in theaddCacheRoot(String)property.getNumCacheRoots()- Parameters:
index- theindexargument- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
getCookieXml
Returns cookies in XML format for a specified domain. Cookies are saved only if theproperty is set togetSaveCookies()true. If theproperty is set togetCookieDir()memory,cookies are stored in-memory.- Parameters:
domain- thedomainargument (notnull)- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
getDomain
Utility method to extract the domain name from a URL. For instance, passing inhttps://chilkatsoft.com/refdoc/csharp.aspwill returnchilkatsoft.com.- Parameters:
url- theurlargument (notnull)- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
getLastJsonData
Offers details about the most recent method called on this object instance, although some methods may not supply any information.- Parameters:
json- thejsonargument (notnull)
-
getRequestHeader
Returns the value of a header field previously set by calling.setRequestHeader(String, String)- Parameters:
name- thenameargument (notnull)- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
getServerCert
Establishes an SSL/TLS connection with a web server to acquire its SSL certificate without retrieving any data, then disconnects.- Parameters:
domain- thedomainargument (notnull)port- theportargumentcert- thecertargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
getUrlPath
Returns the path part of a URL. For example, the path part ofhttps://example.com/folder/page?lang=en&sort=asc#section2is/folder/page.- Parameters:
url- theurlargument (notnull)- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
hasRequestHeader
Returnstrueif the header field specified bynameis included in all HTTP requests, except those sent by theorhttpReq(String, HttpRequest, HttpResponse)methods.httpSReq(String, int, boolean, HttpRequest, HttpResponse)- Parameters:
name- thenameargument (notnull)- Returns:
- the result; this method never throws
ChilkatException
-
httpBd
Sends an HTTP request tourlusing the specified HTTPverb(e.g.,POST,PUT,PATCH). The body of the request is defined bybd, and the Content-Type header is set bycontentType, with possible values likeapplication/octet-stream,application/pdf,image/jpeg, orapplication/zip. The HTTP response is returned inresponse.This method returns
falsefor HTTP response status codes of400or higher, but the response object is still provided inresponse. Ifresponse's status code is0, it indicates no response was received due to a communication error or another issue. In such cases, check the LastErrorText property for details.- Parameters:
verb- theverbargument (notnull)url- theurlargument (notnull)bd- thebdargument (notnull)contentType- thecontentTypeargument (notnull)response- theresponseargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
httpFile
public void httpFile(String verb, String url, String localFilePath, String contentType, HttpResponse response)Sends an HTTP request tourlusing the specified HTTPverb(e.g.,POST,PUT,PATCH). The body of the request is streamed directly fromlocalFilePath, and the Content-Type header is set bycontentType, with possible values likeapplication/octet-stream,application/pdf,image/jpeg, orapplication/zip. The HTTP response is returned inresponse.This method returns
falsefor HTTP response status codes of400or higher, but the response object is still provided inresponse. Ifresponse's status code is0, it indicates no response was received due to a communication error or another issue. In such cases, check the LastErrorText property for details.- Parameters:
verb- theverbargument (notnull)url- theurlargument (notnull)localFilePath- thelocalFilePathargument (notnull)contentType- thecontentTypeargument (notnull)response- theresponseargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
httpJson
public void httpJson(String verb, String url, JsonObject json, String contentType, HttpResponse response)Sends an HTTP request tourlusing the specified method inverb(e.g., POST, PUT, PATCH). The request body contains the JSON fromjson, with the content type set bycontentType, such asapplication/jsonorapplication/jsonrequest.The HTTP response is returned inresponse.This method returns
falsefor HTTP response status codes of400or higher, but the response object is still provided inresponse. Ifresponse's status code is0, it indicates no response was received due to a communication error or another issue. In such cases, check the LastErrorText property for details.- Parameters:
verb- theverbargument (notnull)url- theurlargument (notnull)json- thejsonargument (notnull)contentType- thecontentTypeargument (notnull)response- theresponseargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
httpNoBody
Sends an HTTP request tourlusing the specified HTTPverb. The request body is empty. Verbs likeGET,HEAD, andDELETEusually do not include a body. NoContent-Typeheader is included because there is no content in the body of the request. The HTTP response is returned inresponse.This method returns
falsefor HTTP response status codes of400or higher, but the response object is still provided inresponse. Ifresponse's status code is0, it indicates no response was received due to a communication error or another issue. In such cases, check the LastErrorText property for details.- Parameters:
verb- theverbargument (notnull)url- theurlargument (notnull)response- theresponseargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
httpParams
Sends an HTTPverbrequest tourlwith query parameters fromjson. The request has an empty body, and therefore, noContent-Typeheader is included. Typically, verbs such asGET,HEAD, andDELETEdo not require a body. Applications generally call this method withurl, while passing query parameters separately injson. See the example below. The HTTP response is returned inresponse.This method returns
falsefor HTTP response status codes of400or higher, but the response object is still provided inresponse. Ifresponse's status code is0, it indicates no response was received due to a communication error or another issue. In such cases, check the LastErrorText property for details.- Parameters:
verb- theverbargument (notnull)url- theurlargument (notnull)json- thejsonargument (notnull)response- theresponseargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
httpReq
Sends an HTTP request tourlwhere the content of the request is defined byrequest. The path and query part of target is taken from theurlinstead of the path property withinrequest.scheme host path query ┌────┐ ┌─────────┐┌──────────────┐ ┌────────┐ https://example.com/docs/index.html?search=test
The HTTP response is returned in
response.This method returns
falsefor HTTP response status codes of400or higher, but the response object is still provided inresponse. Ifresponse's status code is0, it indicates no response was received due to a communication error or another issue. In such cases, check the LastErrorText property for details.- Parameters:
url- theurlargument (notnull)request- therequestargument (notnull)response- theresponseargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
httpSReq
public void httpSReq(String domain, int port, boolean ssl, HttpRequest request, HttpResponse response)Sends an HTTP request to web server atdomain:portusing TLS ifsslequalstrue. The content of the request, including the path part of the URL, query params, additional headers, and request body is defined byrequest.Note: The
domainshould include only the domain (host), not the complete URL. The path and query params are defined in therequestobject.scheme host path query ┌────┐ ┌─────────┐┌──────────────┐ ┌────────┐ https://example.com/docs/index.html?search=test
responsecontains the HTTP response.This method returns
falsefor HTTP response status codes of400or higher, but the response object is still provided inresponse. Ifresponse's status code is0, it indicates no response was received due to a communication error or another issue. In such cases, check the LastErrorText property for details.- Parameters:
domain- thedomainargument (notnull)port- theportargumentssl- thesslargumentrequest- therequestargument (notnull)response- theresponseargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
httpSb
public void httpSb(String verb, String url, StringBuilder sb, String charset, String contentType, HttpResponse response)Sends an HTTP request tourlusing the specifiedverb(e.g.,POST,PUT,PATCH). The request body contains the text passed insb, and the content type is specified bycontentType(e.g.,text/xml,application/json). Thecharsetdefines the text encoding, such asutf-8oriso-8859-1. The HTTP response is returned inresponse.This method returns
falsefor HTTP response status codes of400or higher, but the response object is still provided inresponse. Ifresponse's status code is0, it indicates no response was received due to a communication error or another issue. In such cases, check the LastErrorText property for details.- Parameters:
verb- theverbargument (notnull)url- theurlargument (notnull)sb- thesbargument (notnull)charset- thecharsetargument (notnull)contentType- thecontentTypeargument (notnull)response- theresponseargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
httpStr
public void httpStr(String verb, String url, String bodyStr, String charset, String contentType, HttpResponse response)Sends an HTTP request tourlusing the specified verb (e.g.,POST,PUT,PATCH). The request body contains the text passed inbodyStr, and the content type is specified bycontentType(e.g.,text/xml,application/json). Thecharsetdefines the text encoding, such asutf-8oriso-8859-1. The HTTP response is returned inresponse.This method returns
falsefor HTTP response status codes of400or higher, but the response object is still provided inresponse. Ifresponse's status code is0, it indicates no response was received due to a communication error or another issue. In such cases, check the LastErrorText property for details.- Parameters:
verb- theverbargument (notnull)url- theurlargument (notnull)bodyStr- thebodyStrargument (notnull)charset- thecharsetargument (notnull)contentType- thecontentTypeargument (notnull)response- theresponseargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
ocspCheck
Gets the server certificate at a domain:port and then sends an OCSP request to the certificate's OCSP URL to determine if the certificate has been revoked. Returns the OCSP status, which has one of the following values:- -1: Unable to check. See the contents of the LastErrorText property for more informaiton.
- 0: Good
- 1: Revoked
- 2: Unknown
- Parameters:
domain- thedomainargument (notnull)port- theportargument- Returns:
- the result (see
ChilkatObject.getLastMethodSuccess()where the description mentions failure)
-
parseOcspReply
Parses an OCSP reply. Returns the following possible integer values:- -1: The
ocspReplydoes not contain a valid OCSP reply. - 0: Successful - Response has valid confirmations..
- 1: Malformed request - Illegal confirmation request.
- 2: Internal error - Internal error in issuer.
- 3: Try later - Try again later.
- 4: Not used - This value is never returned.
- 5: Sig required - Must sign the request.
- 6: Unauthorized - Request unauthorized.
The binaryOCSP reply is provided in
ocspReply. ThereplyDatais populated with data parsed fromocspReply.OCSP requests are created by calling
.createOcspRequest(JsonObject, BinData)- Parameters:
ocspReply- theocspReplyargument (notnull)replyData- thereplyDataargument (notnull)- Returns:
- the result (see
ChilkatObject.getLastMethodSuccess()where the description mentions failure)
- -1: The
-
quickDeleteStr
This function sends an HTTPDELETErequest to a specified URL and returns the response body as a string.The HTTP response code is stored in the
property, while additional response details are available in properties such asgetLastStatus(),getLastResponseHeader(),getLastResponseBody(), andgetLastModDate().getLastContentType()- Parameters:
url- theurlargument (notnull)- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
quickGetBd
This function sends an HTTPGETrequest to a specified URL, which can include query parameters, and returns the binary response body inbinData.The HTTP response code is stored in the
property. Additional response details can be found in properties likegetLastStatus(),getLastResponseHeader(), andgetLastModDate().getLastContentType()A response code of 400 or higher indicates a failure. If the error response is text-based and the
property isgetKeepResponseBody()true, it will be available in theproperty.getLastResponseBody()- Parameters:
url- theurlargument (notnull)binData- thebinDataargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
quickGetSb
This function sends an HTTPGETrequest to a specified URL, which can include query parameters, and returns the text response body insbContent. The existing content ofsbContent, if any, is cleared and replaced with the downloaded content.The response status code is stored in the
property. Additional response details can be found in properties likegetLastStatus(),getLastResponseHeader(), andgetLastModDate().getLastContentType()If the response status code is >= 400, then this method returns
false, but the body of the HTTP response is still returned insbContent. This allows for the application to examine the response body for cases where an error is returned, but the expected content is not received.- Parameters:
url- theurlargument (notnull)sbContent- thesbContentargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
quickGetStr
This function sends an HTTPGETrequest to a specified URL, which can include query parameters, and returns the text response body.The response status code is stored in the
property. Additional response details can be found in properties likegetLastStatus(),getLastResponseHeader(), andgetLastModDate().getLastContentType()A response code of 400 or higher indicates a failure. If the error response is text-based and the
property isgetKeepResponseBody()true, it will be available in theproperty.getLastResponseBody()- Parameters:
url- theurlargument (notnull)- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
removeRequestHeader
Eliminates a header field from being included in all HTTP requests, except for those sent by theandhttpReq(String, HttpRequest, HttpResponse)methods, which rely on header fields provided in anhttpSReq(String, int, boolean, HttpRequest, HttpResponse)HttpRequestobject via method arguments.- Parameters:
name- thenameargument (notnull)
-
renderGet
Builds the GET request that would be sent if a method such aswas called. Instead of sending the request, it returns the HTTP request that would have been sent.quickGetStr(String)- Parameters:
url- theurlargument (notnull)- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
resumeDownload
Resumes downloading content fromurland saves it to a partially completed local file attargetFilename. If the file attargetFilenamedoesn't exist or is empty, this method functions the same as.download(String, String)The download succeeds if the HTTP response status code is in the 200s. If unsuccessful, no output file is created. If the
property is set togetKeepResponseBody()true, the server's error response will be available in theproperty.getLastResponseBody()The response status code will be available in the
property.getLastStatus()- Parameters:
url- theurlargument (notnull)targetFilename- thetargetFilenameargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
resumeDownloadBd
Resumes a download from where it left off, determined by the number of bytes inbinData. This method can be called multiple times until the download is complete.The download succeeds if the HTTP response status code is in the 200s. If unsuccessful, no output file is created. If the
property is set togetKeepResponseBody()true, the server's error response will be available in theproperty.getLastResponseBody()The response status code will be available in the
property.getLastStatus()- Parameters:
url- theurlargument (notnull)binData- thebinDataargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
s3CreateBucket
Creates a new Amazon S3 bucket.Note:
You can addx-amz-*headers, including metadata, to any S3 request by usingfor each header. This applies to all S3 methods, even if not explicitly mentioned.setRequestHeader(String, String)- Parameters:
bucketPath- thebucketPathargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
s3DeleteBucket
Deletes an Amazon S3 bucket.Note:
Ensure theproperty is set to the correct region if the bucket is outsidegetAwsEndpoint()us-east-1, for example,eu-central-1. For S3-compatible services likeWasabi, always set the, such asgetAwsEndpoint()s3.wasabisys.comors3.eu-central-1.wasabisys.com.- Parameters:
bucketPath- thebucketPathargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
s3DeleteObject
Deletes a remote file (object) on the Amazon S3 service.- Parameters:
bucketPath- thebucketPathargument (notnull)objectName- theobjectNameargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
s3DeleteObjects
Deletes several objects from a bucket with a single request.objectNamesincludes the object names (orkeys) to be deleted. To delete a specific object version, add a versionId to the object name, like this:SampleDocument.txt; VersionId=OYcLXagmS.WaD..oyH4KRguB95_YhLs7. If successful,jsonResponsewill contain the JSON response.- Parameters:
bucketName- thebucketNameargument (notnull)objectNames- theobjectNamesargument (notnull)jsonResponse- thejsonResponseargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
s3DownloadBd
Downloads a file from the Amazon S3 service intobd.- Parameters:
bucketPath- thebucketPathargument (notnull)objectName- theobjectNameargument (notnull)bd- thebdargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
s3DownloadFile
Downloads a file from the Amazon S3 service.Note:
Ensure theproperty is set to the correct region if the bucket is outsidegetAwsEndpoint()us-east-1, for example,eu-central-1. For S3-compatible services likeWasabi, always set the, such asgetAwsEndpoint()s3.wasabisys.comors3.eu-central-1.wasabisys.com.- Parameters:
bucketPath- thebucketPathargument (notnull)objectName- theobjectNameargument (notnull)localFilePath- thelocalFilePathargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
s3DownloadString
Downloads a text file (object) from the Amazon S3 service and returns the content as a string. Thecharsetspecifies the character encoding, such asutf-8, of the remote text object.Note:
Ensure theproperty is set to the correct region if the bucket is outsidegetAwsEndpoint()us-east-1, for example,eu-central-1. For S3-compatible services likeWasabi, always set the, such asgetAwsEndpoint()s3.wasabisys.comors3.eu-central-1.wasabisys.com.- Parameters:
bucketPath- thebucketPathargument (notnull)objectName- theobjectNameargument (notnull)charset- thecharsetargument (notnull)- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
s3FileExists
Checks the existence of a remote file, returning:- 1 if the file exists
- 0 if the file does not exist
- -1 if the check failed
- 2 if in asynchronous mode, indicating the background task started successfully
Note:
Ensure theproperty is set to the correct region if the bucket is outsidegetAwsEndpoint()us-east-1, for example,eu-central-1. For S3-compatible services likeWasabi, always set the, such asgetAwsEndpoint()s3.wasabisys.comors3.eu-central-1.wasabisys.com.- Parameters:
bucketPath- thebucketPathargument (notnull)objectName- theobjectNameargument (notnull)- Returns:
- the result (see
ChilkatObject.getLastMethodSuccess()where the description mentions failure)
-
s3GenPresignedUrl
public String s3GenPresignedUrl(String httpVerb, boolean useHttps, String bucketName, String path, int numSecondsValid, String awsService)This method generates a temporary pre-signed URL for Amazon S3. Before calling this method, ensure the following properties are set to valid values:,getAwsSecretKey(), andgetAwsAccessKey(). If the endpoint differs fromgetAwsRegion()s3.amazonaws.com, set theproperty accordingly.getAwsEndpoint()httpVerbis the HTTP verb (e.g.,GET,PUT,POST,DELETE).awsServiceis the name of the AWS service (e.g.,s3,s3-accelerate). IfuseHttpsistrue, the returned URL will start withhttps://; otherwise, it will start withhttp://.The generated URL has this format:
https://<AwsEndpoint>/<bucket_name>/<path> ?X-Amz-Algorithm=AWS4-HMAC-SHA256 &X-Amz-Credential=<AwsAccessKey>/<currentDate>/<AwsRegion>/<awsService>/aws4_request &X-Amz-Date=<currentDateTime> &X-Amz-Expires=<numSecondsValid> &X-Amz-SignedHeaders=host &X-Amz-Signature=<signature-value>
- Parameters:
httpVerb- thehttpVerbargument (notnull)useHttps- theuseHttpsargumentbucketName- thebucketNameargument (notnull)path- thepathargument (notnull)numSecondsValid- thenumSecondsValidargumentawsService- theawsServiceargument (notnull)- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
s3ListBucketObjects
Retrieve an XML-formatted list of objects in an Amazon S3 bucket, similar to a directory listing.bucketPathcan include URL-encoded parameters. For example, to list objects in a bucket namedChilkatABCwith a max-keys value of2000and a marker ofxyz, pass the following string asbucketPathto the S3_ListBucketObjects method:ChilkatABC?max-keys=2000&marker=xyzThis method recognizes all parameters listed in the AWS documentation for bucket object listing:
delimiter,marker,max-keys, andprefix. For further details, refer to Amazon's AWS online documentation.- Parameters:
bucketPath- thebucketPathargument (notnull)- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
s3ListBuckets
Retrieves the XML listing of the buckets for an Amazon S3 account.- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
s3UploadBd
Uploads the contents ofbdas a file to the Amazon S3 service.Note:
x-amz-*headers, including metadata, can be added to any S3 request by adding each header with a call to. This applies to all S3 methods, even if not explicitly stated.setRequestHeader(String, String)Note:
Ensure theproperty is set to the correct region if the bucket is outsidegetAwsEndpoint()us-east-1, for example,eu-central-1. For S3-compatible services likeWasabi, always set the, such asgetAwsEndpoint()s3.wasabisys.comors3.eu-central-1.wasabisys.com.- Parameters:
bd- thebdargument (notnull)contentType- thecontentTypeargument (notnull)bucketPath- thebucketPathargument (notnull)objectName- theobjectNameargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
s3UploadFile
public void s3UploadFile(String localFilePath, String contentType, String bucketPath, String objectName)Uploads a file to the Amazon S3 service.Note:
x-amz-*headers, including metadata, can be added to any S3 request by adding each header with a call to. This applies to all S3 methods, even if not explicitly stated.setRequestHeader(String, String)Note:
Ensure theproperty is set to the correct region if the bucket is outsidegetAwsEndpoint()us-east-1, for example,eu-central-1. For S3-compatible services likeWasabi, always set the, such asgetAwsEndpoint()s3.wasabisys.comors3.eu-central-1.wasabisys.com.- Parameters:
localFilePath- thelocalFilePathargument (notnull)contentType- thecontentTypeargument (notnull)bucketPath- thebucketPathargument (notnull)objectName- theobjectNameargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
s3UploadString
public void s3UploadString(String objectContent, String charset, String contentType, String bucketPath, String objectName)Uploads the content ofobjectContentas a file to Amazon S3.charsetspecifies the string's character encoding (byte representation).Note:
x-amz-*headers, including metadata, can be added to any S3 request by adding each header with a call to. This applies to all S3 methods, even if not explicitly stated.setRequestHeader(String, String)Note:
Ensure theproperty is set to the correct region if the bucket is outsidegetAwsEndpoint()us-east-1, for example,eu-central-1. For S3-compatible services likeWasabi, always set the, such asgetAwsEndpoint()s3.wasabisys.comors3.eu-central-1.wasabisys.com.- Parameters:
objectContent- theobjectContentargument (notnull)charset- thecharsetargument (notnull)contentType- thecontentTypeargument (notnull)bucketPath- thebucketPathargument (notnull)objectName- theobjectNameargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
setAuthPrivateKey
Sets the private key to be used with some forms of authentication. For example, this is used automatically add the Authorization header (Signature) forAmazon Payrequests.- Parameters:
publicKeyId- thepublicKeyIdargument (notnull)privKey- theprivKeyargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
setAuthTokenSb
Sets theproperty. ThegetAuthToken()sbcontains the OAuth2 access token to be used.- Parameters:
sb- thesbargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
setClientAssertionKey
Sets the private key forprivate_key_jwtclient authentication (RFC 7523) in the OAuth2 client credentials flow of theproperty. When thegetAuthToken()AuthTokenis set to JSON with the client credentials, Chilkat creates a newclient_assertionJWT, signed with this key, for each token request, and sends it withclient_assertion_typeset tourn:ietf:params:oauth:client-assertion-type:jwt-bearer. The JWT has the claimsissandsub(theclient_idfrom the JSON),aud(thetoken_endpoint),iat,exp(5 minutes afteriat) and a uniquejti.kid is the key ID, which is put in the JWT header. Pass an empty string if the authorization server does not need one. The key can be an EC key on the P-256, P-384 or P-521 curve (the JWT is signed with ES256, ES384 or ES512), an RSA key of 2048 bits or more (RS256), or an Ed25519 key (EdDSA). For example, load a key in JWK format with
PrivateKey.LoadJwkand pass itskid.This is typically used with
, when the authorization server requires both a client assertion and DPoP. The same key may be passed to both methods if the server allows it. AsetDPoPKey(PrivateKey)client_assertionorclient_assertion_typemember in theAuthTokenJSON is ignored once this key is set. The JSON must include theclient_id.- Parameters:
privKey- theprivKeyargument (notnull)kid- thekidargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
setCookieXml
This method restores cookies for a specified domain. It requires that the cookies, previously obtained using themethod, are stored in a persistent storage like a database or file. An application can then restore these cookies using this method.getCookieXml(String)- Parameters:
domain- thedomainargument (notnull)cookieXml- thecookieXmlargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
setDPoPKey
Sets the private key for automatically adding the DPoP header to HTTP requests. Chilkat will generate a JWT (a DPoP proof) for each request and include theDPoPheader. Ensure theproperty is also set.getAuthToken()The key can be an EC key on the P-256, P-384 or P-521 curve (the proof is signed with ES256, ES384 or ES512), an RSA key of 2048 bits or more (RS256), or an Ed25519 key (EdDSA). Before v11.7.0, only EC keys were accepted.
- Parameters:
privKey- theprivKeyargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
setOAuthRsaKey
Sets the RSA key to be used withOAuth 1.0aauthentication when theisgetOAuthSigMethod()RSA-SHA256orRSA-SHA1.- Parameters:
privKey- theprivKeyargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
setRequestHeader
Adds a header field to be included in all HTTP requests, except for those sent by theandhttpReq(String, HttpRequest, HttpResponse)methods, which rely on header fields provided in anhttpSReq(String, int, boolean, HttpRequest, HttpResponse)HttpRequestobject via method arguments. If the header field already exists, it is replaced.Use the
method to delete a specific header. Setting a header field to an empty string will also remove it, unless theremoveRequestHeader(String)AllowEmptyHeadersoption inis used.getUncommonOptions()Avoid setting the
Authorizationheader manually. Instead, use the appropriate authorization properties such as,getPassword(),getAuthToken(),getAuthSignature(),getBasicAuth(),getDigestAuth(),getNtlmAuth(),getOAuth1(), etc.getOAuthToken()To add cookies, use the
Cookieheader field format:Cookie: name1=value1; name2=value2; name3=value3.Do not manually set the
Content-Lengthheader. Chilkat will automatically calculate and includeContent-Lengthwhen sending the HTTP request.- Parameters:
headerFieldName- theheaderFieldNameargument (notnull)headerFieldValue- theheaderFieldValueargument (notnull)
-
setSecurePassword
Equivalent to setting theproperty but offers a more secure method by using a secure string object.getPassword()- Parameters:
password- thepasswordargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
setSslCertRequirement
Enforces a requirement on the server's certificate. ThereqNamecan be one of the following:- SubjectDN
- SubjectCN
- IssuerDN
- IssuerCN
- SAN
The
reqNamespecifies the part of the certificate, and thereqValueis the value that it must match exactly or with a wildcard (*), for example"*.example.com". If the server's certificate does not match, the SSL / TLS connection is aborted.- Parameters:
reqName- thereqNameargument (notnull)reqValue- thereqValueargument (notnull)
-
setSslClientCert
Facilitates the use of a client-side certificate for a TLS connection, enabling mutual authentication. In a standard TLS connection, the server alone presents a certificate during the handshake to verify its identity. With mutual TLS (mTLS), the client also presents a trusted certificate, allowing the server to authenticate the client's identity. This process enhances security by adding a layer of verification beyond just usernames, passwords, or tokens.- Parameters:
cert- thecertargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
setSslClientCertPem
This is identical to themethod, but it allows the certificate with a private key to be in PEM format.setSslClientCert(Cert)- Parameters:
pemDataOrPath- thepemDataOrPathargument (notnull)pemPassword- thepemPasswordargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
setSslClientCertPfx
This is identical to themethod, but enables you to provide a certificate with private key directly from a .pfx or .p12 file.setSslClientCert(Cert)- Parameters:
pfxPath- thepfxPathargument (notnull)pfxPassword- thepfxPasswordargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
setUrlVar
Sets a variable's value for URL substitutions used in any method. Variables are formatted as{$varName}in URLs, such as:https://graph.microsoft.com/v1.0/users/{$id}.Call
to unset all URL variables.clearUrlVars()- Parameters:
name- thenameargument (notnull)value- thevalueargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
sleepMs
public void sleepMs(int millisec)This method makes the calling process sleep for a specified number of milliseconds.- Parameters:
millisec- themillisecargument
-
urlDecode
URL decodes a string.- Parameters:
str- thestrargument (notnull)- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
urlEncode
URL encodes a string.- Parameters:
str- thestrargument (notnull)- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
verifyTimestampReply
Verifies a timestamp reply received from a timestamp authority (TSA). Returns the following possible integer values:- -1: The
timestampReplydoes not contain a valid timestamp reply. - -2: The
timestampReplyis a valid timestamp reply, but failed verification using the public key of thetsaCert. - 0: Granted and verified.
- 1: Granted and verified, with mods (see RFC 3161)
- 2: Rejected.
- 3: Waiting.
- 4: Revocation Warning
- 5: Revocation Notification
If the timestamp reply (
timestampReply) is known to be from a trusted source, then thetsaCertmay be empty. IftsaCertis empty (never loaded with a certificate), then the verification will use the certificate embedded in the timestamp reply.The
method is used to create a timestamp request.createTimestampRequest(String, String, String, boolean, boolean, BinData)- Parameters:
timestampReply- thetimestampReplyargument (notnull)tsaCert- thetsaCertargument (notnull)- Returns:
- the result (see
ChilkatObject.getLastMethodSuccess()where the description mentions failure)
- -1: The
-
setProgressListener
Installs the listener that receives this object's progress events (abortCheck,percentDone,progressInfo) during its long-running methods; replaces any listener or lambda installed before;nullremoves it.- Parameters:
listener- the listener, ornull- Throws:
IllegalStateException- if called from inside one of this object's own callbacks
-
getProgressListener
Returns the installed listener, ornull.- Returns:
- the listener installed with
setProgressListener(ProgressListener)or one of theon...methods
-
onAbortCheck
Installs a listener whose only callback isabortCheck: called everyHeartbeatMsmilliseconds during a long-running method; returntrueto abort it. Replaces any listener installed before.- Parameters:
callback- the callback, ornullto remove the listener
-
onPercentDone
Installs a listener whose only callback ispercentDone: called with the completion percentage (0..100) as a long-running method progresses; returntrueto abort it. Replaces any listener installed before.- Parameters:
callback- the callback, ornullto remove the listener
-
onProgressInfo
Installs a listener whose only callback isprogressInfo: called with a name/value pair of progress information as a long-running method proceeds. Replaces any listener installed before.- Parameters:
callback- the callback, ornullto remove the listener
-