Class WebBrowser
- java.lang.Object
-
- com.facilita.fc.web.WebBrowser
-
public class WebBrowser extends java.lang.ObjectTheWebBrowserclass is the starting point for sending web requests. It can be used to createRequestobjects to send to a web server (using thecreateRequest(HttpMethod, Url)method).The
WebBrowserclass manages HTTP caching and cookies. It also provides many options for controlling how the various HTTP requests are handled.Each Web Virtual User has a separate
WebBrowserobject associated with it, which can be accessed by callingWebBrowserScript.getWebBrowser().e.g.
Request request1 = getWebBrowser().createRequest(HttpMethod.GET, new Url("http://www.testplant.com/"), 1); Response response1 = request1.send();
-
-
Constructor Summary
Constructors Constructor Description WebBrowser(long cPtr, boolean cMemoryOwn)For internal use only.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDefaultKeepSubRequestContentType(java.lang.String typeFragment)Adds a Content-Type fragment, so the content of sub-request responses that match the specified Content-Type fragment will be kept by default for any subsequentRequestobjects created by thisWebBrowser.voidaddDefaultKeepSubRequestContentUrl(java.lang.String urlFragment)Adds a URL, so the content of sub-request responses that match the specified URL fragment will be kept by default for any subsequentRequestobjects created by thisWebBrowser.voidaddResponseToCache(CachedResponse response)Adds an entry to thisWebBrowserobject's cache.voidcacheContentTypeDirectory(java.lang.String contentTypeDirectory)Adds a Content-Type media type for which cached content is stored.voidcacheContentTypeDirectory(java.lang.String contentTypeDirectory, boolean cache)Adds or removes a Content-Type media type for which cached content is stored.booleancacheSecureData()Returnstrueif secure (HTTPS) data will be cached.voidclearCache()Clears the HTTP cache.voidclearCookies()Clears the cookie cache.voidclearDefaultHeaders()Removes all of the default HTTP headers.voidcloseAllConnections()Closes all of the open TCP/IP connections to the web server.booleancontainsDefaultHeader(java.lang.String header)Returnstrueif the specified HTTP header is set by default onRequestobjects created by thisWebBrowser.RequestcreateRequest(HttpMethod method, Url url)Creates aRequestobject that can be used to send an HTTP request to the web server.RequestcreateRequest(HttpMethod method, Url url, int reference)Creates aRequestobject that can be used to send an HTTP request to the web server, specifying a unique identifier that can be used to track the request.WebSocketcreateWebSocket(Url url, int reference)Creates aWebSocketobject that can be used to send/receive WebSocket messages to/from the web server.WebSocketMessagecreateWebSocketMessage(byte[] data)Creates aWebSocketMessageobject that can be sent to the server.WebSocketMessagecreateWebSocketMessage(byte[] data, boolean isBinary)Creates aWebSocketMessageobject that can be sent to the server.WebSocketMessagecreateWebSocketMessage(java.lang.String data)Creates aWebSocketMessageobject that can be sent to the server.voiddelete()voidexcludeContentTypeFromCache(java.lang.String contentType)Adds a Content-Type for which cached content is not stored.intgetAccessType()Gets thedwAccessTypeparameter to be passed toInternetOpen()used by WinInet/WinHTTP.intgetBufferSize()Gets the size of the buffer used when reading TCP data from a socket.java.util.List<java.lang.String>getCachedContentTypeDirectories()Gets a list of all Content-Type media types for which cached content is stored.java.util.List<java.lang.String>getCachedContentTypeExclusions()Gets a list of all Content-Types for which cached content is not stored.intgetCacheInMemoryContentLimit()Gets the maximum size of resources that can be cached in memory.booleangetCertificateDisplay()Returnstrueif client certificate names will be written to the event log.java.lang.StringgetCertificateStoreName()Gets the name of the system certificate store in which to search for client certificates.java.lang.StringgetCertificateSubject()Gets the subject to search for when selecting a client certificate.java.lang.StringgetCertLocation()Gets the location folder or file path for a client certificate.intgetConnectionsPerServer()Gets the maximum number of connections allowed per server for a WinHTTP handler.ConnectionTypegetConnectionType(boolean secure)Gets theConnectionTypein use.intgetConnectRetries()Gets the number of times to attempt to connect to a web server before reporting a failure.intgetConnectTimeout()Gets the time in milliseconds to wait for a TCP connection to be opened, before reporting a failure.booleangetCookiesSupported()Returnstrueif cookies will be handled automatically.java.lang.StringgetCookieValue(java.lang.String domain, java.lang.String path, java.lang.String cookieName)Gets the value of the specified cookie, at the specifieddomainandpath.static longgetCPtr(WebBrowser obj)For internal use only.java.lang.StringgetDefaultCharactersAllowedInPostedForm()Get the characters that, by default, will NOT be percent-encoded when aFormis sent to the web server using a POST request.intgetDefaultConnectionIdleTimeout()Gets the time in milliseconds after which a TCP connection is considered to be idle, and automatically closed.java.util.List<java.lang.String>getDefaultContentTypeFragments()Gets a list of all the Content-Type fragments for which the content of sub-request responses will be kept by default for any subsequentRequestobjects created by thisWebBrowser.java.util.List<java.lang.String>getDefaultContentUrlFragments()Gets a list of all the URL fragments for which the content of sub-request responses will be kept by default for any subsequentRequestobjects created by thisWebBrowser.booleangetDefaultFollowRedirects()Returnstrueif redirects will automatically be followed forRequestobjects created by thisWebBrowser.java.util.List<java.lang.String>getDefaultHeaderKeys()Gets a list of names of all the default HTTP request headers that will be set for every subsequentRequestobject created by thisWebBrowser.java.lang.StringgetDefaultHeaderValue(java.lang.String header)Gets the value of the specified default HTTP header.booleangetDefaultIncludeQueryDataInLabels()Returnstrueif URLs with different query data should be considered different from each other by default.booleangetDefaultKeepAllSubRequestContent()Returnstrueif the content of responses to sub-requests will be kept, for any subsequentRequestobjects created by thisWebBrowser.booleangetDefaultKeepContent()Returnstrueif the content of responses will be kept, for any subsequentRequestobjects created by thisWebBrowser.booleangetDefaultRetrieveSubRequests()Returnstrueif sub-requests will be retrieved for any subsequentRequestobjects created by thisWebBrowser.intgetDefaultSubRequestThreadCount()Gets the number of threads that will be used to fetch sub-requests from the web server, for any subsequentRequestobjects created by thisWebBrowser.booleangetDefaultTimeEveryHttpRequest()Returnstrueif sub-requests will be timed as well as top-level HTTP requests, for any subsequentRequestobjects created by thisWebBrowser.java.lang.StringgetDefaultUserAgent()Gets the value that the"User-Agent"HTTP header defaults to inRequestobjects created by thisWebBrowser.java.lang.StringgetDefaultVersion()Gets the HTTP version as aString, as set by default for any subsequentRequestobjects created by thisWebBrowser.intgetDnsRetries()Gets the number of times that eggPlant Performance will retry a DNS lookup in the event of failure.intgetDnsTimeout()Gets the time in milliseconds before a DNS lookup will time-out.booleangetEnableOptionalClientCertificates()Returnstrueif client certificates can be optional, in case the server requests a client certificate but doesn't require one.HostFilteringModegetHostFilteringMode()Get theHostFilteringMode.IpEndPointgetLocalIpEndPoint()Gets the localIpEndPointto use when making a connection to a web server.intgetMaxNetworkErrors()Gets the maximum number of network errors to accept before the script is terminated.intgetMinorVersion()Gets the minor HTTP version number.java.lang.StringgetPassword()Gets the password that will be used for HTTP authentication.java.lang.StringgetProxy()Gets the address of the proxy server used by thisWebBrowser.java.lang.StringgetProxyBypass()Gets thelpszProxyBypassparameter to be passed toInternetOpen()used by WinInet/WinHTTP.intgetProxyPort()Gets the port number used by the proxy server for thisWebBrowser.java.lang.StringgetProxyServer()Gets thelpszProxyNameparameter to be passed toInternetOpen()used by WinInet/WinHTTP.intgetReadRetries()Gets the number of times to attempt to read data from the web server before reporting a failure.intgetReceiveTimeout()Gets the time in milliseconds to wait for a web server to respond to a request before reporting a failure.intgetSendTimeout()Gets the time in milliseconds before a sent TCP packet will time-out.intgetSSLrenegotiateTime()Gets the time in milliseconds after which the SSL connection must be renegotiated.java.lang.StringgetUser()Gets the username that will be used for HTTP authentication.VirtualUsergetVirtualUser()Gets theVirtualUserinstance that thisWebBrowseris associated with.voidignoreHost(java.lang.String domain)Prevents requests from being sent to the specifieddomain.voidignoreHostRegexp(java.lang.String regexp)Prevents requests from being sent to any domain that matches the specified regular expression.voidincludeContentTypeInCache(java.lang.String contentType)Adds a Content-Type for which cached content is stored.voidincludeHost(java.lang.String domain)Allows requests to be sent to the specifieddomain.voidincludeHostRegexp(java.lang.String regexp)Allow requests to be sent to any host that matches the given regular expression.booleanisCachingEnabled()Returnstrueif HTTP caching is enabled.booleanisDynatraceIntegrationEnabled()Returnstrueif dynaTrace integration is enabled.booleanisHostIgnored(java.lang.String domain)Returnstrueif the specifieddomainis currently being ignored.booleanisLoggingEnabled()Returnstrueif detailed HTTP logging has been enabled for this Virtual User.booleanisLoggingSuspended()Returnstrueif detailed HTTP logging has been suspended for this Virtual User.booleanisSetCertLocation()Returnstrueif a certificate location has been set.booleanisSetProxy()Returnstrueif a proxy server has been defined for thisWebBrowser.voidremoveCookie(java.lang.String cookieName)Removes all cookies with the given name from the cookie cachevoidremoveDefaultHeader(java.lang.String header)Removes the specified default HTTP header.voidremoveDefaultKeepSubRequestContentType(java.lang.String typeFragment)Removes a Content-Type fragment, so the content of sub-request responses that match the specified Content-Type fragment will no longer be kept by default for any subsequentRequestobjects created by thisWebBrowser.voidremoveDefaultKeepSubRequestContentUrl(java.lang.String urlFragment)Removes a URL, so the content of sub-request responses that match the specified URL fragment will no longer be kept by default for any subsequentRequestobjects created by thisWebBrowser.booleanresponseWithNoExpiryInformationIsFresh()Gets a value that indicates whether a response from a web server that does not contains any expiry information (such as an "Expires" or "Cache-Control, max-age" header) is treated as expired or not.voidresumeLogging()Resumes detailed HTTP logging for this Virtual User.voidsaveCookie(java.lang.String host, java.lang.String data)Saves cookie data for the specifiedhost.voidsetAccess(int accessType, java.lang.String proxyServer, java.lang.String proxyBypass)Sets thedwAccessType,lpszProxyNameandlpszProxyBypassparameters to be passed toInternetOpen()used by WinInet/WinHTTP.voidsetAuthentication(java.lang.String domain, java.lang.String username, java.lang.String password)Sets the domain, username and password that will be used for HTTP authentication.voidsetBufferSize(int bufferSize)Sets the size of the buffer used when reading TCP data from a socket.voidsetCacheInMemoryContentLimit(int value)Sets the maximum size of resources that can be cached in memory.voidsetCacheSecureData(boolean cacheSecureData)Sets whether secure (HTTPS) data should be cached (trueby default).voidsetCachingEnabled(boolean value)Sets whether HTTP caching should be enabled.voidsetCertificateDisplay(boolean display)Sets whether client certificate names should be written to the event log.voidsetCertificateStoreName(java.lang.String storeName)Sets the name of the system certificate store in which to search for client certificates.voidsetCertificateSubject(java.lang.String subject)Sets the subject to search for when selecting a client certificate.voidsetCertLocation(java.lang.String path)Sets the location folder or file path for a client certificate.voidsetConnectionsPerServer(int connections)Sets the maximum number of connections allowed per server for a WinHTTP handler.voidsetConnectRetries(int retries)Sets the number of times to attempt to connect to a web server before reporting a failure.voidsetConnectTimeout(int timeout)Sets the time in milliseconds to wait for a TCP connection to be opened, before reporting a failure.voidsetCookiesSupported()Sets automatic cookie handling to be enabled.voidsetCookiesSupported(boolean on)Sets whether cookies should be handled automatically.voidsetDefaultCharactersAllowedInPostedForm(java.lang.String charactersAllowedInPostedForm)Set the characters that, by default, will NOT be percent-encoded when aFormis sent to the web server using a POST request.voidsetDefaultConnectionIdleTimeout(int timeout)Sets the time in milliseconds after which a TCP connection is considered to be idle, and automatically closed.voidsetDefaultFollowRedirects()Sets the behaviour of thisWebBrowserso redirects will automatically be followed for any subsequentRequestobjects created.voidsetDefaultFollowRedirects(boolean followRedirects)Sets whether redirects will automatically be followed for any subsequentRequestobjects created by thisWebBrowser.voidsetDefaultHeader(java.lang.String header)Sets a default HTTP request header for every subsequentRequestobject created by thisWebBrowser, using the contents of the specifiedString.voidsetDefaultHeader(java.lang.String header, java.lang.String value)Sets a default HTTP request header for every subsequentRequestobject created by thisWebBrowser, as a name/value pair.voidsetDefaultIncludeQueryDataInLabels(boolean includeQueryDataInLabels)Sets whether URLs with different query data should be considered different from each other by default.voidsetDefaultKeepAllSubRequestContent(boolean keep)Sets whether the content of responses to sub-requests should be kept, for any subsequentRequestobjects created by thisWebBrowser.voidsetDefaultKeepContent(boolean keep)Sets whether to keep the content of responses by default, for any subsequentRequestobjects created by thisWebBrowser.voidsetDefaultRetrieveSubRequests(boolean getDefaultEmbeddedUrls)Sets whether sub-requests will be retrieved for any subsequentRequestobjects created by thisWebBrowser.voidsetDefaultSubRequestThreadCount(int subRequestThreadCount)Sets the number of threads that will be used to fetch sub-requests from the web server, for any subsequentRequestobjects created by thisWebBrowser.voidsetDefaultTimeEveryHttpRequest(boolean timings)Sets whether sub-requests should be timed as well as top-level HTTP requests, for any subsequentRequestobjects created by thisWebBrowser.voidsetDefaultUserAgent(java.lang.String userAgent)Sets the value that the"User-Agent"HTTP header defaults to inRequestobjects created by thisWebBrowser.voidsetDefaultVersion(java.lang.String version)Sets the HTTP version for any subsequentRequestobjects created by thisWebBrowser.voidsetDnsRetries(int retries)Sets the number of times that eggPlant Performance will retry a DNS lookup in the event of failure.voidsetDnsTimeout(int timeout)Sets the time in milliseconds before a DNS lookup will time-out.voidsetDynatraceIntegrationEnabled(boolean value)Sets whether or not dynaTrace integration is enabled.voidsetEnableOptionalClientCertificates(boolean enable)Sets whether client certificates can be optional, in case the server requests a client certificate but doesn't require one.voidsetHostFilteringMode(HostFilteringMode mode)Set theHostFilteringMode.voidsetLocalIpEndPoint(IpEndPoint localIpEndPoint)Sets the localIpEndPointto use when making a connection to a web server.voidsetMaxNetworkErrors(int n)Sets the maximum number of network errors to accept before the script is terminated.voidsetMinorVersion(int version)Sets the minor HTTP version number.voidsetPassword(java.lang.String password)Sets the password that will be used for HTTP authentication.voidsetProxy(java.lang.String proxy, int port)Sets the proxy server address and port.voidsetProxyUserPassword(java.lang.String username, java.lang.String password)Sets the username and password that will be used for proxy authentication.voidsetReadRetries(int n)Sets the number of times to attempt to read data from the web server before reporting a failure.voidsetReceiveTimeout(int timeout)Sets the time in milliseconds to wait for a web server to respond to a request before reporting a failure.voidsetResponseWithNoExpiryInformationIsFresh(boolean value)Sets a value that indicates whether a response from a web server that does not contains any expiry information (such as an "Expires" or "Cache-Control, max-age" header) is treated as expired or not.voidsetSendTimeout(int timeout)Sets the time in milliseconds before a sent TCP packet will time-out.voidsetSSLrenegotiateTime(int time)Sets the time in milliseconds after which the SSL connection must be renegotiated.voidsetUser(java.lang.String user)Sets the username that will be used for HTTP authentication.voidsetUserPassword(java.lang.String username, java.lang.String password)Sets the username and password that will be used for HTTP authentication.voidsuspendLogging()Suspends detailed HTTP logging for this Virtual User.booleanunignoreHost(java.lang.String domain)Stops preventing requests from being sent to the specifieddomain.voidunignoreHostRegexp(java.lang.String regexp)Stops preventing requests from being sent to the domains that match the specified regular expression.voidunincludeHost(java.lang.String domain)Stop sending requests to the specifieddomain.voidunincludeHostRegexp(java.lang.String regexp)Stop sending requests to hosts that match the given regular expression.voidunsetProxy()Unsets the proxy server address and port.
-
-
-
Method Detail
-
getCPtr
public static long getCPtr(WebBrowser obj)
For internal use only. Of no interest to the user.- Parameters:
obj- a reference to an object of this class- Returns:
- a long containing the address of the CPP wrapped object
-
delete
public void delete()
-
getVirtualUser
public VirtualUser getVirtualUser()
Gets theVirtualUserinstance that thisWebBrowseris associated with.- Returns:
- the
VirtualUserinstance that thisWebBrowseris associated with
-
createRequest
public Request createRequest(HttpMethod method, Url url, int reference) throws com.facilita.exception.NotImplementedException, BadValueException
Creates aRequestobject that can be used to send an HTTP request to the web server, specifying a unique identifier that can be used to track the request. Note that the HTTP request is not sent until theRequest.send()orRequest.sendTopLevel()method is called.e.g.
// Send a GET request to http://www.testplant.com/ Request request1 = getWebBrowser().createRequest(HttpMethod.GET, new Url("http://www.testplant.com/"), 1); Response response1 = request1.send();- Parameters:
method- theHttpMethodto use when sending theRequestto the web serverurl- theUrlthat this request should be sent toreference- a unique identifier that can be used to track thisRequest- Returns:
- the new
Requestobject - Throws:
BadValueException- One of the parameters is invalidcom.facilita.exception.NotImplementedException- An internal error occurred
-
createRequest
public Request createRequest(HttpMethod method, Url url) throws com.facilita.exception.NotImplementedException, BadValueException
Creates aRequestobject that can be used to send an HTTP request to the web server. Note that the HTTP request is not sent until theRequest.send()orRequest.sendTopLevel()method is called.e.g.
// Send a GET request to http://www.testplant.com/ Request request1 = getWebBrowser().createRequest(HttpMethod.GET, new Url("http://www.testplant.com/")); Response response1 = request1.send();- Parameters:
method- theHttpMethodto use when sending theRequestto the web serverurl- theUrlthat this request should be sent to- Returns:
- the new
Requestobject - Throws:
BadValueException- One of the parameters is invalidcom.facilita.exception.NotImplementedException- An internal error occurred
-
setDefaultHeader
public void setDefaultHeader(java.lang.String header, java.lang.String value)Sets a default HTTP request header for every subsequentRequestobject created by thisWebBrowser, as a name/value pair.This method is useful if there is a particular HTTP header that is required in every HTTP request by a particular application.
e.g.
// Set the "Accept-Language: en-GB" HTTP header for EVERY subsequent request getWebBrowser().setDefaultHeader("Accept-Language", "en-GB"); // Create a request Request request = getWebBrowser().createRequest(HttpMethod.GET, new Url("http://www.testplant.com/")); // Override the "Accept-Language" header for this request ONLY request.setHeader("Accept-Language", "en-US"); Response response = request.send(); // Subsequent requests will still use the "Accept-Language: en-GB" HTTP header- Parameters:
header- the header to setvalue- the default value of the header- See Also:
Request.setHeader(String, String),removeDefaultHeader(String),getDefaultHeaderValue(String)
-
setDefaultHeader
public void setDefaultHeader(java.lang.String header)
Sets a default HTTP request header for every subsequentRequestobject created by thisWebBrowser, using the contents of the specifiedString.This method is useful if there is a particular HTTP header that is required in every HTTP request by a particular application.
e.g.
// Set the "Accept-Language: en-GB" HTTP header for EVERY subsequent request getWebBrowser().setDefaultHeader("Accept-Language: en-GB"); // Create a request Request request = getWebBrowser().createRequest(HttpMethod.GET, new Url("http://www.testplant.com/")); // Override the "Accept-Language" header for this request ONLY request.setHeader("Accept-Language: en-US"); Response response = request.send(); // Subsequent requests will still use the "Accept-Language: en-GB" HTTP header- Parameters:
header- the full header to set- See Also:
Request.setHeader(String),removeDefaultHeader(String),getDefaultHeaderValue(String)
-
removeDefaultHeader
public void removeDefaultHeader(java.lang.String header)
Removes the specified default HTTP header.Requestobjects created by thisWebBrowserwill no longer have this header set by default.- Parameters:
header- the name of the header to remove- See Also:
setDefaultHeader(String, String)
-
clearDefaultHeaders
public void clearDefaultHeaders()
Removes all of the default HTTP headers.Requestobjects created by thisWebBrowserwill no longer have default headers set.
-
containsDefaultHeader
public boolean containsDefaultHeader(java.lang.String header)
Returnstrueif the specified HTTP header is set by default onRequestobjects created by thisWebBrowser.- Parameters:
header- the header to check for- Returns:
trueif the specifiedheaderhas been set as a default HTTP header
-
getDefaultHeaderValue
public java.lang.String getDefaultHeaderValue(java.lang.String header)
Gets the value of the specified default HTTP header.Requestobjects created by thisWebBrowserwill have the specified HTTP header set with the value returned by this method.- Parameters:
header- the header to look for- Returns:
- the value of the default HTTP header with the specified
name, or an emptyStringif this header is not set by default - See Also:
setDefaultHeader(String, String),removeDefaultHeader(String),clearDefaultHeaders()
-
getDefaultUserAgent
public java.lang.String getDefaultUserAgent()
Gets the value that the"User-Agent"HTTP header defaults to inRequestobjects created by thisWebBrowser. Calling this method is equivalent to callinggetDefaultHeaderValue("User-Agent").- Returns:
- the value of the
"User-Agent"default HTTP header - See Also:
setDefaultUserAgent(String),getDefaultHeaderValue(String)
-
setDefaultUserAgent
public void setDefaultUserAgent(java.lang.String userAgent)
Sets the value that the"User-Agent"HTTP header defaults to inRequestobjects created by thisWebBrowser. Calling this method is equivalent to callingsetDefaultHeaderValue("User-Agent", userAgent).- Parameters:
userAgent- the new value of the"User-Agent"default HTTP header- See Also:
getDefaultUserAgent(),setDefaultHeader(String, String)
-
getDefaultHeaderKeys
public java.util.List<java.lang.String> getDefaultHeaderKeys() throws com.facilita.exception.InternalErrorGets a list of names of all the default HTTP request headers that will be set for every subsequentRequestobject created by thisWebBrowser.- Returns:
- a list of names of all the default HTTP request headers
- Throws:
com.facilita.exception.InternalError- An internal error occurred- See Also:
setDefaultHeader(String)
-
setDefaultFollowRedirects
public void setDefaultFollowRedirects(boolean followRedirects)
Sets whether redirects will automatically be followed for any subsequentRequestobjects created by thisWebBrowser.If the response to a request is an HTTP redirect code (e.g.
301,302), and theRequestobject has been set to follow redirects, then the eggPlant Performance engine will automatically follow the redirect link.If you only want to change automatic redirecting for a single request, then it is better to call
Request.setFollowRedirects(boolean)instead of this method.- Parameters:
followRedirects-trueif redirects should be followed automatically- See Also:
Request.setFollowRedirects(boolean)
-
setDefaultFollowRedirects
public void setDefaultFollowRedirects()
Sets the behaviour of thisWebBrowserso redirects will automatically be followed for any subsequentRequestobjects created.If the response to a request is an HTTP redirect code (e.g.
301,302), and theRequestobject has been set to follow redirects, then the eggPlant Performance engine will automatically follow the redirect link.If you only want to change automatic redirecting for a single request, then it is better to call
Request.setFollowRedirects(boolean)instead of this method.
-
getDefaultFollowRedirects
public boolean getDefaultFollowRedirects()
Returnstrueif redirects will automatically be followed forRequestobjects created by thisWebBrowser.If the response to a request is an HTTP redirect code (e.g.
301,302), and theRequestobject has been set to follow redirects, then the eggPlant Performance engine will automatically follow the redirect link.- Returns:
trueif redirects will automatically be followed forRequestobjects created- See Also:
setDefaultFollowRedirects(boolean),Request.getFollowRedirects()
-
setDefaultRetrieveSubRequests
public void setDefaultRetrieveSubRequests(boolean getDefaultEmbeddedUrls)
Sets whether sub-requests will be retrieved for any subsequentRequestobjects created by thisWebBrowser. See theRequest.send()method for more information.- Parameters:
getDefaultEmbeddedUrls-trueif sub-requests should be retrieved by default- See Also:
Request.send(),Request.setRetrieveSubRequests(boolean)
-
getDefaultRetrieveSubRequests
public boolean getDefaultRetrieveSubRequests()
Returnstrueif sub-requests will be retrieved for any subsequentRequestobjects created by thisWebBrowser. See theRequest.send()method for more information.- Returns:
trueif sub-requests will be retrieved forRequestobjects by default- See Also:
Request.getRetrieveSubRequests(),Request.send()
-
getDefaultIncludeQueryDataInLabels
public boolean getDefaultIncludeQueryDataInLabels()
Returnstrueif URLs with different query data should be considered different from each other by default. If this returnstrue, then the query data will be included in the HTTP metric labels.e.g.
http://localhost:32144/search?q=camerahttp://localhost:32144/search?q=laptop
http://localhost:32144/search.- Returns:
trueif URL query data will be included in the HTTP metric labels by default- See Also:
setDefaultIncludeQueryDataInLabels(boolean),Request.getIncludeQueryDataInLabels()
-
setDefaultIncludeQueryDataInLabels
public void setDefaultIncludeQueryDataInLabels(boolean includeQueryDataInLabels)
Sets whether URLs with different query data should be considered different from each other by default. If set totrue, then the query data will be included in the HTTP metric labels.e.g.
http://localhost:32144/search?q=camerahttp://localhost:32144/search?q=laptop
http://localhost:32144/search.- Parameters:
includeQueryDataInLabels-trueif URL query data should be included in the HTTP metric labels by default- See Also:
getDefaultIncludeQueryDataInLabels(),Request.setIncludeQueryDataInLabels(boolean)
-
setDefaultTimeEveryHttpRequest
public void setDefaultTimeEveryHttpRequest(boolean timings)
Sets whether sub-requests should be timed as well as top-level HTTP requests, for any subsequentRequestobjects created by thisWebBrowser. Top-level requests will always be timed, even if this is set tofalse.- Parameters:
timings-trueif sub-requests should be timed by default as well as top-level HTTP requests- See Also:
getDefaultTimeEveryHttpRequest(),Request.setTimeEveryHttpRequest(boolean)
-
getDefaultTimeEveryHttpRequest
public boolean getDefaultTimeEveryHttpRequest()
Returnstrueif sub-requests will be timed as well as top-level HTTP requests, for any subsequentRequestobjects created by thisWebBrowser. Top-level requests will always be timed, even if this method returnsfalse.- Returns:
trueif sub-requests will be timed by default as well as top-level HTTP requests- See Also:
setDefaultTimeEveryHttpRequest(boolean),Request.getTimeEveryHttpRequest()
-
getDefaultSubRequestThreadCount
public int getDefaultSubRequestThreadCount()
Gets the number of threads that will be used to fetch sub-requests from the web server, for any subsequentRequestobjects created by thisWebBrowser. If this value is increased, then more sub-requests can be fetched in parallel. However, using more threads will increase the load on the injector machine.- Returns:
- the number of threads that will be used by default to fetch sub-requests from the web server
- See Also:
setDefaultSubRequestThreadCount(int),Request.getSubRequestThreadCount()
-
setDefaultSubRequestThreadCount
public void setDefaultSubRequestThreadCount(int subRequestThreadCount)
Sets the number of threads that will be used to fetch sub-requests from the web server, for any subsequentRequestobjects created by thisWebBrowser. If this value is increased, then more sub-requests can be fetched in parallel. However, using more threads will increase the load on the injector machine.- Parameters:
subRequestThreadCount- the number of threads that will be used by default to fetch sub-requests from the web server- See Also:
getDefaultSubRequestThreadCount(),Request.setSubRequestThreadCount(int)
-
getDefaultVersion
public java.lang.String getDefaultVersion()
Gets the HTTP version as aString, as set by default for any subsequentRequestobjects created by thisWebBrowser.The version of HTTP in common use is currently
"HTTP/1.1", but"HTTP/2"can be used to enable HTTP/2 support where applicable.- Returns:
- the HTTP version set by default
- See Also:
setDefaultVersion(String),Request.getVersion()
-
setDefaultVersion
public void setDefaultVersion(java.lang.String version)
Sets the HTTP version for any subsequentRequestobjects created by thisWebBrowser.The version of HTTP in common use is currently
"HTTP/1.1", but"HTTP/2"can be used to enable HTTP/2 support where applicable.- Parameters:
version- the HTTP version to use by default- See Also:
getDefaultVersion(),Request.setVersion(String)
-
getDefaultKeepAllSubRequestContent
public boolean getDefaultKeepAllSubRequestContent()
Returnstrueif the content of responses to sub-requests will be kept, for any subsequentRequestobjects created by thisWebBrowser.If this returns
false, then all the responses to sub-requests will be discarded. There is a significant performance penalty to keep the sub-request content, so this value should only be set totrueif it is necessary to examine the content of sub-responses.- Returns:
trueif the content of responses to sub-requests will be kept by default- See Also:
setDefaultKeepAllSubRequestContent(boolean),setDefaultKeepContent(boolean),addDefaultKeepSubRequestContentType(String),addDefaultKeepSubRequestContentUrl(String)
-
setDefaultKeepAllSubRequestContent
public void setDefaultKeepAllSubRequestContent(boolean keep)
Sets whether the content of responses to sub-requests should be kept, for any subsequentRequestobjects created by thisWebBrowser.If this is set to
false, then all the responses to sub-requests will be discarded. There is a significant performance penalty to keep the sub-request content, so this value should only be set totrueif it is necessary to examine the content of sub-responses.- Parameters:
keep-trueif the content of responses to sub-requests should be kept by default- See Also:
getDefaultKeepAllSubRequestContent(),setDefaultKeepContent(boolean),addDefaultKeepSubRequestContentType(String),addDefaultKeepSubRequestContentUrl(String)
-
setDefaultKeepContent
public void setDefaultKeepContent(boolean keep)
Sets whether to keep the content of responses by default, for any subsequentRequestobjects created by thisWebBrowser.If this value is set to
falsethen the content of every response to thisRequestwill be discarded, and it will not be possible to examine the content using theResponseclass (but other information will still be accessible in theResponseobjects).- Parameters:
keep-trueif the content of responses should be kept by default- See Also:
getDefaultKeepContent(),setDefaultKeepAllSubRequestContent(boolean)
-
getDefaultKeepContent
public boolean getDefaultKeepContent()
Returnstrueif the content of responses will be kept, for any subsequentRequestobjects created by thisWebBrowser.If this returns
falsethen the content of every response to thisRequestwill be discarded, and it will not be possible to examine the content using theResponseclass (but other information will still be accessible in theResponseobjects).- Returns:
trueif the content of responses will be kept by default- See Also:
setDefaultKeepContent(boolean),setDefaultKeepAllSubRequestContent(boolean),addDefaultKeepSubRequestContentType(String),addDefaultKeepSubRequestContentUrl(String)
-
addDefaultKeepSubRequestContentType
public void addDefaultKeepSubRequestContentType(java.lang.String typeFragment)
Adds a Content-Type fragment, so the content of sub-request responses that match the specified Content-Type fragment will be kept by default for any subsequentRequestobjects created by thisWebBrowser.In general, it is not necessary to retain content for sub-requests, and it will incur a performance penalty to do so. However, a situation may arise where it is necessary to check or extract a value from a sub-response. In this situation, you can specify that the content of certain sub-responses should be retained.
e.g.
// Keep the content of any sub-requests that have a Content-Type starting with "text" (e.g. text/html, text/xml) getWebBrowser().addDefaultKeepSubRequestContentType("text");- Parameters:
typeFragment- sub-request responses that have a Content-Type header containing thistypeFragmentwill be kept by default- See Also:
getDefaultKeepContent(),getDefaultKeepAllSubRequestContent(),removeDefaultKeepSubRequestContentType(String),addDefaultKeepSubRequestContentUrl(String)
-
addDefaultKeepSubRequestContentUrl
public void addDefaultKeepSubRequestContentUrl(java.lang.String urlFragment)
Adds a URL, so the content of sub-request responses that match the specified URL fragment will be kept by default for any subsequentRequestobjects created by thisWebBrowser.In general, it is not necessary to retain content for sub-requests, and it will incur a performance penalty to do so. However, a situation may arise where it is necessary to check or extract a value from a sub-response. In this situation, you can specify that the content of certain sub-responses should be retained.
e.g.
// Keep the content of the sub-request with the url http://localhost/images/magnifying-glass.png getWebBrowser().addDefaultKeepSubRequestContentUrl("http://localhost/images/magnifying-glass.png");- Parameters:
urlFragment- the responses from sub-requests that match thisurlFragmentwill be kept by default- See Also:
getDefaultKeepContent(),getDefaultKeepAllSubRequestContent(),removeDefaultKeepSubRequestContentUrl(String),addDefaultKeepSubRequestContentType(String)
-
removeDefaultKeepSubRequestContentType
public void removeDefaultKeepSubRequestContentType(java.lang.String typeFragment)
Removes a Content-Type fragment, so the content of sub-request responses that match the specified Content-Type fragment will no longer be kept by default for any subsequentRequestobjects created by thisWebBrowser.In general, it is not necessary to retain content for sub-requests, and it will incur a performance penalty to do so. However, a situation may arise where it is necessary to check or extract a value from a sub-response. In this situation, you can specify that the content of certain sub-responses should be retained.
e.g.
// Don't keep the content of any sub-requests that have a Content-Type starting with "text" (e.g. text/html, text/xml) getWebBrowser().removeDefaultKeepSubRequestContentType("text");- Parameters:
typeFragment- sub-request responses that have a Content-Type header containing thistypeFragmentwill no longer be kept by default- See Also:
addDefaultKeepSubRequestContentType(String),setDefaultKeepAllSubRequestContent(boolean)
-
removeDefaultKeepSubRequestContentUrl
public void removeDefaultKeepSubRequestContentUrl(java.lang.String urlFragment)
Removes a URL, so the content of sub-request responses that match the specified URL fragment will no longer be kept by default for any subsequentRequestobjects created by thisWebBrowser.In general, it is not necessary to retain content for sub-requests, and it will incur a performance penalty to do so. However, a situation may arise where it is necessary to check or extract a value from a sub-response. In this situation, you can specify that the content of a particular sub-responses should be retained.
e.g.
// Don't keep the content of the sub-request with the url http://localhost/images/magnifying-glass.png getWebBrowser().removeDefaultKeepSubRequestContentUrl("http://localhost/images/magnifying-glass.png");- Parameters:
urlFragment- the responses from sub-requests that match thisurlFragmentwill no longer be kept by default- See Also:
getDefaultKeepContent(),getDefaultKeepAllSubRequestContent(),addDefaultKeepSubRequestContentUrl(String)
-
getDefaultContentUrlFragments
public java.util.List<java.lang.String> getDefaultContentUrlFragments() throws com.facilita.exception.InternalErrorGets a list of all the URL fragments for which the content of sub-request responses will be kept by default for any subsequentRequestobjects created by thisWebBrowser.- Returns:
- a list of all the URL fragments for which the content of sub-request responses will be kept by default
- Throws:
com.facilita.exception.InternalError- An internal error occurred- See Also:
addDefaultKeepSubRequestContentUrl(String),removeDefaultKeepSubRequestContentUrl(String)
-
getDefaultContentTypeFragments
public java.util.List<java.lang.String> getDefaultContentTypeFragments() throws com.facilita.exception.InternalErrorGets a list of all the Content-Type fragments for which the content of sub-request responses will be kept by default for any subsequentRequestobjects created by thisWebBrowser.- Returns:
- a list of all the Content-Type fragments for which the content of sub-request responses will be kept by default
- Throws:
com.facilita.exception.InternalError- An internal error occurred- See Also:
addDefaultKeepSubRequestContentType(String),removeDefaultKeepSubRequestContentType(String)
-
setCookiesSupported
public void setCookiesSupported(boolean on)
Sets whether cookies should be handled automatically. If this is set totrue, then eggPlant Performance will automatically store any cookies that are set by the web server, and send them back to the web server in subsequent requests.- Parameters:
on-trueif cookies should be handled automatically- See Also:
getCookiesSupported()
-
setCookiesSupported
public void setCookiesSupported()
Sets automatic cookie handling to be enabled. If cookies are handled automatically, then eggPlant Performance will automatically store any cookies that are set by the web server, and send them back to the web server in subsequent requests.- See Also:
getCookiesSupported()
-
getCookiesSupported
public boolean getCookiesSupported()
Returnstrueif cookies will be handled automatically. If cookies are handled automatically, then eggPlant Performance will automatically store any cookies that are set by the web server, and send them back to the web server in subsequent requests.- Returns:
trueif cookies will be handled automatically- See Also:
setCookiesSupported(boolean)
-
saveCookie
public void saveCookie(java.lang.String host, java.lang.String data)Saves cookie data for the specifiedhost. The host must be a hostname or TCP/IP address. Use this call to populate a browser with a set of pre-defined cookies or to add a cookie to the browser cookie cache.The cookie data is in the form of a
"Set-Cookie"header as received from a server.e.g.
A path may be specified in thegetWebBrowser().saveCookie("www.mycookiesite.com", "SESSIONID=99; path=/cookies; expires=Mon, 01-Jan-2003 00:00:00 GMT");data, in which case the cookie value is only available at that path and any paths below it in the hierarchy.e.g.
If no path is specified, the path will default toSet-Cookie: SESSIONID=99; path=/cookies; expires=Mon, 01-Jan-2003 00:00:00 GMT http://www.mycookiesite.com:8080/ // No cookie available at this path http://www.mycookiesite.com:8080/cookies/ // Cookie SESSIONID=99 stored here http://www.mycookiesite.com:8080/cookies/howto // SESSIONID=99 available here http://www.mycookiesite.com:8080/cookies/howto/bake // SESSIONID=99 available here"/". This causes the cookie to be sent on all requests to the domain.- Parameters:
host- the target domaindata- the cookie name and value, in the form of a Set-Cookie header- See Also:
getCookieValue(String, String, String),setCookiesSupported(boolean)
-
getCookieValue
public java.lang.String getCookieValue(java.lang.String domain, java.lang.String path, java.lang.String cookieName)Gets the value of the specified cookie, at the specifieddomainandpath. A cookie stored at a particular path is available to all paths below it in the hierarchy.e.g.
Set-Cookie: SESSIONID=99; path=/cookies; expires=Mon, 01-Jan-2003 00:00:00 GMT http://www.mycookiesite.com:8080/ // No cookie stored at this path http://www.mycookiesite.com:8080/cookies/ // Cookie SESSIONID stored here http://www.mycookiesite.com:8080/cookies/howto // SESSIONID available here http://www.mycookiesite.com:8080/cookies/howto/bake // SESSIONID available here // assuming the cookie has been set as above, //the following calls can be made to obtain the value of SESSIONID String cookie; cookie = getWebBrowser().getCookieValue("www.mycookiesite.com", "/cookies/", "SESSIONID"); cookie = getWebBrowser().getCookieValue("www.mycookiesite.com", "/cookies/howto/", "SESSIONID"); cookie = getWebBrowser().getCookieValue("www.mycookiesite.com", "/cookies/howto/bake/", "SESSIONID"); // the following call will not return a value as the path "/" // is above the path at which the cookie is stored ("/cookies") cookie = getWebBrowser().getCookieValue("www.mycookiesite.com", "/", "SESSIONID");- Parameters:
domain- the domain of the cookiepath- the path within the domain of the cookiecookieName- the name of the cookie- Returns:
- the value of the key/value pair stored as a cookie at the specified
domainandpath - See Also:
saveCookie(String, String),clearCookies()
-
clearCookies
public void clearCookies()
Clears the cookie cache. AWebBrowserobject maintains its own cookie cache, and each Virtual User has its own instance ofWebBrowser.This method clears the cookie cache in a similar manner to the Delete Cookies option within Internet Explorer.
-
removeCookie
public void removeCookie(java.lang.String cookieName)
Removes all cookies with the given name from the cookie cache- Parameters:
cookieName- the name of the cookie to remove
-
getUser
public java.lang.String getUser()
Gets the username that will be used for HTTP authentication.If the web server returns an HTTP
401 (Unauthorized)or407 (Proxy Authentication Required)response to a request, then eggPlant Performance will automatically retry the request with an additional"Authorization"HTTP header, using this username.- Returns:
- the username that will be used for HTTP authentication
- See Also:
setUser(String),setUserPassword(String, String)
-
setUser
public void setUser(java.lang.String user)
Sets the username that will be used for HTTP authentication.If the web server returns an HTTP
401 (Unauthorized)or407 (Proxy Authentication Required)response to a request, then eggPlant Performance will automatically retry the request with an additional"Authorization"HTTP header, using this username.- Parameters:
user- the username that will be used for HTTP authentication- See Also:
getUser(),setUserPassword(String, String)
-
getPassword
public java.lang.String getPassword()
Gets the password that will be used for HTTP authentication.If the web server returns an HTTP
401 (Unauthorized)or407 (Proxy Authentication Required)response to a request, then eggPlant Performance will automatically retry the request with an additional"Authorization"HTTP header, using this password.- Returns:
- the password that will be used for HTTP authentication
- See Also:
setPassword(String),setUserPassword(String, String)
-
setPassword
public void setPassword(java.lang.String password)
Sets the password that will be used for HTTP authentication.If the web server returns an HTTP
401 (Unauthorized)or407 (Proxy Authentication Required)response to a request, then eggPlant Performance will automatically retry the request with an additional"Authorization"HTTP header, using this password.- Parameters:
password- the password that will be used for HTTP authentication- See Also:
getPassword(),setUserPassword(String, String)
-
setUserPassword
public void setUserPassword(java.lang.String username, java.lang.String password)Sets the username and password that will be used for HTTP authentication.If the web server returns an HTTP
401 (Unauthorized)response to a request, then eggPlant Performance will automatically retry the request with an additional"Authorization"HTTP header, using this username and password.- Parameters:
username- the username that will be used for HTTP authenticationpassword- the password that will be used for HTTP authentication- See Also:
getUser(),getPassword(),setUser(String),setPassword(String)
-
setAuthentication
public void setAuthentication(java.lang.String domain, java.lang.String username, java.lang.String password)Sets the domain, username and password that will be used for HTTP authentication.If the web server returns an HTTP
401 (Unauthorized)response to a request, then eggPlant Performance will automatically retry the request with an additional"Authorization"HTTP header, using this username and password.- Parameters:
domain- the domain that will be used for HTTP authenticationusername- the username that will be used for HTTP authenticationpassword- the password that will be used for HTTP authentication- See Also:
getUser(),getPassword(),setUser(String),setPassword(String)
-
setProxyUserPassword
public void setProxyUserPassword(java.lang.String username, java.lang.String password)Sets the username and password that will be used for proxy authentication.If the web server returns an HTTP
407 (Proxy Authentication Required)response to a request, then eggPlant Performance will automatically retry the request with an additional"Proxy-Authorization"HTTP header, using this username and password.- Parameters:
username- the username that will be used for HTTP authenticationpassword- the password that will be used for HTTP authentication- See Also:
getUser(),getPassword(),setUser(String),setPassword(String)
-
ignoreHost
public void ignoreHost(java.lang.String domain)
Prevents requests from being sent to the specifieddomain.This method only has any effect if the
HostFilteringModeis set toHostFilteringMode.BLOCKLIST.No HTTP/HTTPS requests will be made to this host. Use this method to prevent all HTTP calls to servers such as advertisement servers or servers that are offline.
Warning: The test may not function correctly if server calls are not made that are necessary for the correct operation of the test.
- Parameters:
domain- the host name to be ignored- See Also:
setHostFilteringMode(HostFilteringMode),unignoreHost(String),isHostIgnored(String)
-
unignoreHost
public boolean unignoreHost(java.lang.String domain)
Stops preventing requests from being sent to the specifieddomain.This method only has any effect if the
HostFilteringModeis set toHostFilteringMode.BLOCKLIST.- Parameters:
domain- the host name to be removed from the list of ignored hosts- Returns:
trueif the host name was removed from the list of ignored hosts, orfalseif the host name did not exist in the list of ignored hosts- See Also:
ignoreHost(String),isHostIgnored(String)
-
isHostIgnored
public boolean isHostIgnored(java.lang.String domain)
Returnstrueif the specifieddomainis currently being ignored.- Parameters:
domain- the host to check- Returns:
trueif the specifieddomainis currently being ignored- See Also:
ignoreHost(String),unignoreHost(String)
-
ignoreHostRegexp
public void ignoreHostRegexp(java.lang.String regexp)
Prevents requests from being sent to any domain that matches the specified regular expression.This method only has any effect if the
HostFilteringModeis set toHostFilteringMode.BLOCKLIST.No HTTP/HTTPS requests will be made to any of these domains. Use this method to prevent all HTTP calls to servers such as advertisement servers or servers that are offline.
Warning: The test may not function correctly if server calls are not made that are necessary for the correct operation of the test.
- Parameters:
regexp- the regular expression to use- See Also:
ignoreHost(String),unignoreHost(String),isHostIgnored(String),unignoreHostRegexp(String)
-
unignoreHostRegexp
public void unignoreHostRegexp(java.lang.String regexp)
Stops preventing requests from being sent to the domains that match the specified regular expression.This method only has any effect if the
HostFilteringModeis set toHostFilteringMode.BLOCKLIST.- Parameters:
regexp- the regular expression to unignore- See Also:
ignoreHostRegexp(String),ignoreHost(String),unignoreHost(String),isHostIgnored(String)
-
getHostFilteringMode
public HostFilteringMode getHostFilteringMode()
Get theHostFilteringMode.The default is
HostFilteringMode.BLOCKLIST- Returns:
- the
HostFilteringMode - See Also:
setHostFilteringMode(HostFilteringMode),isHostIgnored(String),ignoreHost(String),includeHost(String)
-
setHostFilteringMode
public void setHostFilteringMode(HostFilteringMode mode)
Set theHostFilteringMode.The default is
HostFilteringMode.BLOCKLIST- Parameters:
mode- the mode to set- See Also:
getHostFilteringMode(),isHostIgnored(String),ignoreHost(String),includeHost(String)
-
includeHost
public void includeHost(java.lang.String domain)
Allows requests to be sent to the specifieddomain.This method only has any effect if the
HostFilteringModeis set toHostFilteringMode.ALLOWLIST.Warning: The test may not function correctly if server calls are not made that are necessary for the correct operation of the test.
- Parameters:
domain- the host name to include- See Also:
setHostFilteringMode(HostFilteringMode),unincludeHost(String),includeHostRegexp(String),isHostIgnored(String)
-
unincludeHost
public void unincludeHost(java.lang.String domain)
Stop sending requests to the specifieddomain.This method only has any effect if the
HostFilteringModeis set toHostFilteringMode.ALLOWLIST.Warning: The test may not function correctly if server calls are not made that are necessary for the correct operation of the test.
- Parameters:
domain- the host that will no longer be included- See Also:
setHostFilteringMode(HostFilteringMode),includeHost(String),includeHostRegexp(String),isHostIgnored(String)
-
includeHostRegexp
public void includeHostRegexp(java.lang.String regexp)
Allow requests to be sent to any host that matches the given regular expression.This method only has any effect if the
HostFilteringModeis set toHostFilteringMode.ALLOWLIST.Warning: The test may not function correctly if server calls are not made that are necessary for the correct operation of the test.
- Parameters:
regexp- the regular expression to match against- See Also:
setHostFilteringMode(HostFilteringMode),includeHost(String),unincludeHostRegexp(String),isHostIgnored(String)
-
unincludeHostRegexp
public void unincludeHostRegexp(java.lang.String regexp)
Stop sending requests to hosts that match the given regular expression.This method only has any effect if the
HostFilteringModeis set toHostFilteringMode.ALLOWLIST.Warning: The test may not function correctly if server calls are not made that are necessary for the correct operation of the test.
- Parameters:
regexp- The regular expression to stop matching against- See Also:
setHostFilteringMode(HostFilteringMode),includeHost(String),includeHostRegexp(String),isHostIgnored(String)
-
clearCache
public void clearCache()
Clears the HTTP cache. AWebBrowserobject maintains its own HTTP cache, and each Virtual User has its own instance ofWebBrowser.This method clears the HTTP cache in a similar manner to the Delete Files option within Internet Explorer.
- See Also:
isCachingEnabled(),setCachingEnabled(boolean)
-
isCachingEnabled
public boolean isCachingEnabled()
Returnstrueif HTTP caching is enabled.If HTTP caching is disabled, then every HTTP request will always be requested from the web server, even if the requested resource has already been downloaded.
- Returns:
trueif HTTP caching is enabled
-
setCachingEnabled
public void setCachingEnabled(boolean value)
Sets whether HTTP caching should be enabled.If HTTP caching is disabled, then every HTTP request will always be requested from the web server, even if the requested resource has already been downloaded.
- Parameters:
value-trueif HTTP caching should be enabled
-
getCachedContentTypeDirectories
public java.util.List<java.lang.String> getCachedContentTypeDirectories() throws com.facilita.exception.InternalErrorGets a list of all Content-Type media types for which cached content is stored.There is a performance overhead incurred by storing resources in the cache. By default, eggPlant Performance will only store the content of resources with certain Content-Type media types:
- application
- message
- model
- multipart
- text
"text/html", or"application/pdf"will be stored, but content with Content-Type"image/png"will be discarded. In most cases, there is no reason to access the contents of image data.Note that images are still cached, in that they will not be requested again from the web server once they have been downloaded; it is just the image data that is discarded.
- Returns:
- a list of all Content-Type media types for which cached content is stored
- Throws:
com.facilita.exception.InternalError- An internal error occurred- See Also:
cacheContentTypeDirectory(String),cacheContentTypeDirectory(String, boolean)
-
cacheContentTypeDirectory
public void cacheContentTypeDirectory(java.lang.String contentTypeDirectory, boolean cache)Adds or removes a Content-Type media type for which cached content is stored.There is a performance overhead incurred by storing resources in the cache. By default, eggPlant Performance will only store the content of resources with certain Content-Type media types:
- application
- message
- model
- multipart
- text
"text/html", or"application/pdf"will be stored, but content with Content-Type"image/png"will be discarded. In most cases, there is no reason to access the contents of image data.Note that images are still cached, in that they will not be requested again from the web server once they have been downloaded; it is just the image data that is discarded.
- Parameters:
contentTypeDirectory- the Content-Type media type to add or remove e.g."text","application"cache-trueif content with the specified media type should be stored- See Also:
clearCache(),setCachingEnabled(boolean),includeContentTypeInCache(String),excludeContentTypeFromCache(String)
-
cacheContentTypeDirectory
public void cacheContentTypeDirectory(java.lang.String contentTypeDirectory)
Adds a Content-Type media type for which cached content is stored.There is a performance overhead incurred by storing resources in the cache. By default, eggPlant Performance will only store the content of resources with certain Content-Type media types:
- application
- message
- model
- multipart
- text
"text/html", or"application/pdf"will be stored, but content with Content-Type"image/png"will be discarded. In most cases, there is no reason to access the contents of image data.Note that images are still cached, in that they will not be requested again from the web server once they have been downloaded; it is just the image data that is discarded.
- Parameters:
contentTypeDirectory- the Content-Type media type to store e.g."text","application"- See Also:
clearCache(),setCachingEnabled(boolean),includeContentTypeInCache(String),excludeContentTypeFromCache(String)
-
getCachedContentTypeExclusions
public java.util.List<java.lang.String> getCachedContentTypeExclusions() throws com.facilita.exception.InternalErrorGets a list of all Content-Types for which cached content is not stored.There is a performance overhead incurred by storing resources in the cache. By default, eggPlant Performance will only store the content of resources with certain Content-Type media types:
- application
- message
- model
- multipart
- text
"text/html", or"application/pdf"will be stored, but content with Content-Type"image/png"will be discarded. In most cases, there is no reason to access the contents of image data.Note that resources are still cached, in that they will not be requested again from the web server once they have been downloaded; it is just the data that is discarded.
- Returns:
- a list of all Content-Types for which cached content is not stored
- Throws:
com.facilita.exception.InternalError- An internal error occurred- See Also:
excludeContentTypeFromCache(String),includeContentTypeInCache(String)
-
excludeContentTypeFromCache
public void excludeContentTypeFromCache(java.lang.String contentType)
Adds a Content-Type for which cached content is not stored. There is a performance overhead incurred by storing resources in the cache.e.g.
Note that resources are still cached, in that they will not be requested again from the web server once they have been downloaded; it is just the data that is discarded.// do not store the content of "application/pdf" Content-Types getWebBrowser().excludeContentTypeFromCache("application/pdf");- Parameters:
contentType- the Content-Type to exclude e.g."text/xml","application/pdf"- See Also:
includeContentTypeInCache(String),cacheContentTypeDirectory(String, boolean),clearCache(),setCachingEnabled(boolean)
-
includeContentTypeInCache
public void includeContentTypeInCache(java.lang.String contentType)
Adds a Content-Type for which cached content is stored.There is a performance overhead incurred by storing resources in the cache. By default, eggPlant Performance will only store the content of resources with certain Content-Type media types:
- application
- message
- model
- multipart
- text
"text/html", or"application/pdf"will be stored, but content with Content-Type"image/png"will be discarded. In most cases, there is no reason to access the contents of image data, but this method can be used to store specific types.e.g.
// store the content of "image/png" Content-Types getWebBrowser().excludeContentTypeFromCache("image/png");- Parameters:
contentType- the Content-Type to include e.g."text/xml","application/pdf"- See Also:
cacheContentTypeDirectory(String, boolean),clearCache(),setCachingEnabled(boolean)
-
getCacheInMemoryContentLimit
public int getCacheInMemoryContentLimit()
Gets the maximum size of resources that can be cached in memory. Any cached resource that is larger than this will be written to disk. The default value is 2048 bytes. This limit can prevent the memory footprint of a Virtual User from becoming too large.- Returns:
- the maximum size in bytes
- See Also:
setCacheInMemoryContentLimit(int)
-
setCacheInMemoryContentLimit
public void setCacheInMemoryContentLimit(int value)
Sets the maximum size of resources that can be cached in memory. Any cached resource that is larger than this will be written to disk. The default value is 2048 bytes. This limit can prevent the memory footprint of a Virtual User from becoming too large.- Parameters:
value- the maximum size in bytes- See Also:
getCacheInMemoryContentLimit()
-
cacheSecureData
public boolean cacheSecureData()
Returnstrueif secure (HTTPS) data will be cached.- Returns:
trueif secure data will be cached- See Also:
setCacheSecureData(boolean),setCachingEnabled(boolean)
-
setCacheSecureData
public void setCacheSecureData(boolean cacheSecureData)
Sets whether secure (HTTPS) data should be cached (trueby default).- Parameters:
cacheSecureData-trueif secure data should be cached- See Also:
cacheSecureData(),setCachingEnabled(boolean)
-
addResponseToCache
public void addResponseToCache(CachedResponse response)
Adds an entry to thisWebBrowserobject's cache. This method can be used to pre-populate aWebBrowserobject's cache, prior to sending any requests to the web server.e.g.
CachedResponse cachedResponse = new CachedResponse("http://myDomain/weather/images/symbols/57x57/3.gif"); cachedResponse.setHeader("Expires", "Fri, 22 Aug 2008 16:23:24 GMT"); cachedResponse.setHeader("Last-Modified", "Tue, 18 Mar 2008 11:37:40 GMT"); cachedResponse.setHeader("ETag", "\"b23-905a6900\""); getWebBrowser().addResponseToCache(cachedResponse);- Parameters:
response- aCachedResponserepresenting a URL and appropriate HTTP request headers
-
setMaxNetworkErrors
public void setMaxNetworkErrors(int n)
Sets the maximum number of network errors to accept before the script is terminated.- Parameters:
n- the maximum number of network errors- See Also:
getMaxNetworkErrors()
-
getMaxNetworkErrors
public int getMaxNetworkErrors()
Gets the maximum number of network errors to accept before the script is terminated.- Returns:
- the maximum number of network errors
- See Also:
setMaxNetworkErrors(int)
-
getProxy
public java.lang.String getProxy()
Gets the address of the proxy server used by thisWebBrowser.- Returns:
- the address of the proxy server used by this
WebBrowser - See Also:
setProxy(String, int),getProxyPort()
-
getProxyPort
public int getProxyPort()
Gets the port number used by the proxy server for thisWebBrowser.- Returns:
- the port number used by the proxy server for this
WebBrowser - See Also:
setProxy(String, int),getProxy()
-
setProxy
public void setProxy(java.lang.String proxy, int port)Sets the proxy server address and port.Browsers often access target web servers via a proxy server.
- Parameters:
proxy- the IP address or domain of the proxy serverport- the port number of the proxy server- See Also:
getProxy(),getProxyPort()
-
unsetProxy
public void unsetProxy()
Unsets the proxy server address and port.Once this method has been called, any subsequent requests will go directly to the target domain, rather than via a proxy server.
- See Also:
setProxy(String, int)
-
isSetProxy
public boolean isSetProxy()
Returnstrueif a proxy server has been defined for thisWebBrowser. This method indicates that a domain name and port for a proxy server have been set, not whether the proxy server is configured correctly or whether a proxy server exists at the specified domain name and port.- Returns:
trueif a proxy server has been defined for thisWebBrowser- See Also:
setProxy(String, int)
-
getMinorVersion
public int getMinorVersion()
Gets the minor HTTP version number.The minor version number follows the dot, so for example
HTTP 1.0has a minor version number of0.Note that this method only applies to WinInet and WinHTTP connections.
- Returns:
- the minor HTTP version number
- See Also:
setMinorVersion(int)
-
setMinorVersion
public void setMinorVersion(int version)
Sets the minor HTTP version number.The minor version number follows the dot, so for example
HTTP 1.0has a minor version number of0.Note that this method only applies to WinInet and WinHTTP connections.
- Parameters:
version- the minor HTTP version number- See Also:
getMinorVersion()
-
isLoggingEnabled
public boolean isLoggingEnabled()
Returnstrueif detailed HTTP logging has been enabled for this Virtual User.- Returns:
trueif detailed HTTP logging has been enabled for this Virtual User
-
getConnectionType
public ConnectionType getConnectionType(boolean secure)
Gets theConnectionTypein use.Note that it is possible to use different connection types for HTTP and HTTPS traffic; the
secureparameter is used to distinguish between them.- Parameters:
secure-trueto return theConnectionTypeused for secure (HTTPS) connections, orfalsefor unsecure (HTTP) connections- Returns:
- the
ConnectionTypein use
-
getBufferSize
public int getBufferSize()
Gets the size of the buffer used when reading TCP data from a socket.- Returns:
- the size of the buffer in bytes
- See Also:
setBufferSize(int)
-
getDnsTimeout
public int getDnsTimeout()
Gets the time in milliseconds before a DNS lookup will time-out.- Returns:
- the time in milliseconds before a DNS lookup will time-out
- See Also:
setDnsTimeout(int)
-
getDnsRetries
public int getDnsRetries()
Gets the number of times that eggPlant Performance will retry a DNS lookup in the event of failure.- Returns:
- the number of times that eggPlant Performance will retry a DNS lookup in the event of failure
- See Also:
setDnsRetries(int)
-
getConnectTimeout
public int getConnectTimeout()
Gets the time in milliseconds to wait for a TCP connection to be opened, before reporting a failure.- Returns:
- the time in milliseconds to wait for a TCP connection to be opened, before reporting a failure
- See Also:
setConnectTimeout(int)
-
getReceiveTimeout
public int getReceiveTimeout()
Gets the time in milliseconds to wait for a web server to respond to a request before reporting a failure.- Returns:
- the time in milliseconds to wait for a web server to respond to a request before reporting a failure
- See Also:
setReceiveTimeout(int)
-
getSendTimeout
public int getSendTimeout()
Gets the time in milliseconds before a sent TCP packet will time-out.- Returns:
- the time in milliseconds before a sent TCP packet will time-out
- See Also:
setSendTimeout(int)
-
getConnectRetries
public int getConnectRetries()
Gets the number of times to attempt to connect to a web server before reporting a failure.- Returns:
- the number of times to attempt to connect to a web server before reporting a failure
- See Also:
setConnectRetries(int)
-
setBufferSize
public void setBufferSize(int bufferSize)
Sets the size of the buffer used when reading TCP data from a socket.- Parameters:
bufferSize- the size of the buffer in bytes- See Also:
getBufferSize()
-
setDnsTimeout
public void setDnsTimeout(int timeout)
Sets the time in milliseconds before a DNS lookup will time-out.- Parameters:
timeout- the time in milliseconds- See Also:
getDnsTimeout()
-
setDnsRetries
public void setDnsRetries(int retries)
Sets the number of times that eggPlant Performance will retry a DNS lookup in the event of failure.- Parameters:
retries- the number of retries to attempt- See Also:
getDnsRetries()
-
setConnectTimeout
public void setConnectTimeout(int timeout)
Sets the time in milliseconds to wait for a TCP connection to be opened, before reporting a failure.- Parameters:
timeout- the time in milliseconds- See Also:
getConnectTimeout()
-
setReceiveTimeout
public void setReceiveTimeout(int timeout)
Sets the time in milliseconds to wait for a web server to respond to a request before reporting a failure.- Parameters:
timeout- the time in milliseconds- See Also:
getReceiveTimeout()
-
setSendTimeout
public void setSendTimeout(int timeout)
Sets the time in milliseconds before a sent TCP packet will time-out.- Parameters:
timeout- the time in milliseconds
-
setConnectRetries
public void setConnectRetries(int retries)
Sets the number of times to attempt to connect to a web server before reporting a failure.- Parameters:
retries- the number of retries to attempt- See Also:
getConnectRetries()
-
getLocalIpEndPoint
public IpEndPoint getLocalIpEndPoint() throws com.facilita.exception.NotSupportedException
Gets the localIpEndPointto use when making a connection to a web server. Usually, it is not necessary to set this property, and each Virtual User will use the same IP address.IP Spoofing can be enabled by assigning Virtual Users different local
IpEndPointobjects. For more information, search the main Eggplant Performance user guide for "IP Spoofing".Note that this method only applies if you are using the Internal HTTP handler.
- Returns:
- the local
IpEndPointto use when making a connection to a web server - Throws:
com.facilita.exception.NotSupportedException- either the WinInet or WinHTTP handler is currently in use, for which this method is not supported- See Also:
setLocalIpEndPoint(IpEndPoint)
-
setLocalIpEndPoint
public void setLocalIpEndPoint(IpEndPoint localIpEndPoint) throws com.facilita.exception.NotSupportedException
Sets the localIpEndPointto use when making a connection to a web server. Usually, it is not necessary to set this property, and each Virtual User will use the same IP address.IP Spoofing can be enabled by assigning Virtual Users different local
IpEndPointobjects. For more information, search the main Eggplant Performance user guide for "IP Spoofing".Note that this method only applies if you are using the Internal HTTP handler.
- Parameters:
localIpEndPoint- the localIpEndPointto use when making a connection to a web server- Throws:
com.facilita.exception.NotSupportedException- either the WinInet or WinHTTP handler is currently in use, for which this method is not supported- See Also:
getLocalIpEndPoint()
-
setReadRetries
public void setReadRetries(int n) throws com.facilita.exception.NotSupportedExceptionSets the number of times to attempt to read data from the web server before reporting a failure.- Parameters:
n- the number of times to attempt to read data from the web server before reporting a failure- Throws:
com.facilita.exception.NotSupportedException- either the WinInet or WinHTTP handler is currently in use, for which this method is not supported- See Also:
getReadRetries()
-
getReadRetries
public int getReadRetries() throws com.facilita.exception.NotSupportedExceptionGets the number of times to attempt to read data from the web server before reporting a failure.- Returns:
- the number of times to attempt to read data from the web server before reporting a failure
- Throws:
com.facilita.exception.NotSupportedException- either the WinInet or WinHTTP handler is currently in use, for which this method is not supported- See Also:
setReadRetries(int)
-
getSSLrenegotiateTime
public int getSSLrenegotiateTime() throws com.facilita.exception.NotSupportedExceptionGets the time in milliseconds after which the SSL connection must be renegotiated.- Returns:
- the time in milliseconds
- Throws:
com.facilita.exception.NotSupportedException- either the WinInet or WinHTTP handler is currently in use, for which this method is not supported- See Also:
setSSLrenegotiateTime(int)
-
setSSLrenegotiateTime
public void setSSLrenegotiateTime(int time) throws com.facilita.exception.NotSupportedExceptionSets the time in milliseconds after which the SSL connection must be renegotiated.- Parameters:
time- the time in milliseconds- Throws:
com.facilita.exception.NotSupportedException- either the WinInet or WinHTTP handler is currently in use, for which this method is not supported- See Also:
getSSLrenegotiateTime()
-
setCertLocation
public void setCertLocation(java.lang.String path) throws com.facilita.exception.NotSupportedExceptionSets the location folder or file path for a client certificate.This method enables a specific certificate file, or folder containing certificates, to be set. It should be called before any requests to a server that requires a client certificate. This method calls the OpenSSL method SSL_CTX_load_verify_locations(), see http://www.openssl.org/docs/ssl/SSL_CTX_load_verify_locations.html for details of usage.
If the path is a folder, then the CAfile argument of SSL_CTX_load_verify_locations is NULL. If it is a file, the CApath argument is set to NULL. Certificates must be in PEM format. Other formats can be converted to PEM format:
e.g. to convert a certificate exported from a browser to PEM format using the OpenSSL utility:
See http://www.openssl.org/ for details.openssl pkcs12 -clcerts -nokeys -out hostcert.pem -in cert.p12- Parameters:
path- the file path or folder to use- Throws:
com.facilita.exception.NotSupportedException- either the WinInet or WinHTTP handler is currently in use, for which this method is not supported- See Also:
getCertLocation(),isSetCertLocation()
-
isSetCertLocation
public boolean isSetCertLocation() throws com.facilita.exception.NotSupportedExceptionReturnstrueif a certificate location has been set.- Returns:
trueif a certificate location has been set- Throws:
com.facilita.exception.NotSupportedException- either the WinInet or WinHTTP handler is currently in use, for which this method is not supported- See Also:
setCertLocation(String),getCertLocation()
-
getCertLocation
public java.lang.String getCertLocation() throws com.facilita.exception.NotSupportedExceptionGets the location folder or file path for a client certificate.A specific certificate file, or folder containing certificates, can be set. It should be set before any requests to a server that requires a client certificate.
Certificates must be in PEM format. Other formats can be converted to PEM format:
e.g. to convert a certificate exported from a browser to PEM format using the OpenSSL utility:
See http://www.openssl.org/ for details.openssl pkcs12 -clcerts -nokeys -out hostcert.pem -in cert.p12- Returns:
- the location folder or file path for a client certificate
- Throws:
com.facilita.exception.NotSupportedException- either the WinInet or WinHTTP handler is currently in use, for which this method is not supported- See Also:
setCertLocation(String),isSetCertLocation()
-
getDefaultConnectionIdleTimeout
public int getDefaultConnectionIdleTimeout() throws com.facilita.exception.NotSupportedExceptionGets the time in milliseconds after which a TCP connection is considered to be idle, and automatically closed.- Returns:
- the time in milliseconds
- Throws:
com.facilita.exception.NotSupportedException- either the WinInet or WinHTTP handler is currently in use, for which this method is not supported- See Also:
setDefaultConnectionIdleTimeout(int)
-
setDefaultConnectionIdleTimeout
public void setDefaultConnectionIdleTimeout(int timeout) throws com.facilita.exception.NotSupportedExceptionSets the time in milliseconds after which a TCP connection is considered to be idle, and automatically closed.- Parameters:
timeout- the time in milliseconds- Throws:
com.facilita.exception.NotSupportedException- either the WinInet or WinHTTP handler is currently in use, for which this method is not supported- See Also:
getDefaultConnectionIdleTimeout()
-
setCertificateStoreName
public void setCertificateStoreName(java.lang.String storeName) throws com.facilita.exception.NotSupportedExceptionSets the name of the system certificate store in which to search for client certificates.As part of the SSL/TLS handshake, a server can request a certificate to authenticate the client (i.e. the virtual user). If you have a client certificate, you can specify its location with this method and
setCertificateSubject(String).- The default certificate store name is
"MY", which corresponds toCertificates - Current User\Personal\Certificates. - Another common option is
"ROOT"which corresponds toCertificates - Current User\Trusted Root Certification Authorities\Certificates.
Both of these certificate stores can be viewed by running
certmgr.msc, from which you can also add client certificates.Note that it is not possible to load client certificates from the
Certificates - Local Computercertificate stores (which are viewable by runningcertlm.msc).- Parameters:
storeName- the name of the system certificate store, e.g."MY"or"ROOT"- Throws:
com.facilita.exception.NotSupportedException- the Internal HTTP handler is currently in use, for which this method is not supported- See Also:
getCertificateStoreName(),setCertificateSubject(String),setCertificateDisplay(boolean),setEnableOptionalClientCertificates(boolean)
- The default certificate store name is
-
setCertificateSubject
public void setCertificateSubject(java.lang.String subject) throws com.facilita.exception.NotSupportedExceptionSets the subject to search for when selecting a client certificate.For more information about the certificate stores and how to view/add client certificates, see
setCertificateStoreName(String). The first certificate in the store whose subject contains the specified text will be selected.- Parameters:
subject- the subject fragment of the certificate to select- Throws:
com.facilita.exception.NotSupportedException- the Internal HTTP handler is currently in use, for which this method is not supported- See Also:
getCertificateSubject(),setCertificateStoreName(String),setCertificateDisplay(boolean),setEnableOptionalClientCertificates(boolean)
-
setCertificateDisplay
public void setCertificateDisplay(boolean display) throws com.facilita.exception.NotSupportedExceptionSets whether client certificate names should be written to the event log. This can be useful for debugging SSL/TLS client certificate issues.- Parameters:
display-trueif client certificate names should be written to the event log- Throws:
com.facilita.exception.NotSupportedException- the Internal HTTP handler is currently in use, for which this method is not supported- See Also:
getCertificateDisplay(),setCertificateStoreName(String),setCertificateSubject(String),setEnableOptionalClientCertificates(boolean)
-
setEnableOptionalClientCertificates
public void setEnableOptionalClientCertificates(boolean enable) throws com.facilita.exception.NotSupportedExceptionSets whether client certificates can be optional, in case the server requests a client certificate but doesn't require one.As part of the SSL/TLS handshake, a server can request a certificate to authenticate the client (i.e. the virtual user). If you have a client certificate, you can use the other certificate methods to specify its location. However if you know the server doesn't require a client certificate, you can set this flag. If
getCertificateSubject()returns an empty string or a client certificate cannot otherwise be located, the handshake will continue without one.- Parameters:
enable-trueif SSL/TLS handshakes should be retried without a client certificate- Throws:
com.facilita.exception.NotSupportedException- either the WinInet or Internal HTTP handler is currently in use, for which this method is not supported- See Also:
getEnableOptionalClientCertificates(),setCertificateStoreName(String),setCertificateSubject(String),setCertificateDisplay(boolean)
-
getCertificateStoreName
public java.lang.String getCertificateStoreName() throws com.facilita.exception.NotSupportedExceptionGets the name of the system certificate store in which to search for client certificates.As part of the SSL/TLS handshake, a server can request a certificate to authenticate the client (i.e. the virtual user). If you have a client certificate, you can specify its location with
setCertificateStoreName(String)andsetCertificateSubject(String).- The default certificate store name is
"MY", which corresponds toCertificates - Current User\Personal\Certificates. - Another common option is
"ROOT"which corresponds toCertificates - Current User\Trusted Root Certification Authorities\Certificates.
Both of these certificate stores can be viewed by running
certmgr.msc, from which you can also add client certificates.Note that it is not possible to load client certificates from the
Certificates - Local Computercertificate stores (which are viewable by runningcertlm.msc).- Returns:
- the name of the system certificate store, e.g.
"MY"or"ROOT" - Throws:
com.facilita.exception.NotSupportedException- the Internal HTTP handler is currently in use, for which this method is not supported- See Also:
setCertificateStoreName(String),getCertificateSubject(),getCertificateDisplay(),getEnableOptionalClientCertificates()
- The default certificate store name is
-
getCertificateSubject
public java.lang.String getCertificateSubject() throws com.facilita.exception.NotSupportedExceptionGets the subject to search for when selecting a client certificate.For more information about the certificate stores and how to view/add client certificates, see
getCertificateStoreName(). The first certificate in the store whose subject contains the specified text will be selected.- Returns:
- the subject fragment of the certificate to select
- Throws:
com.facilita.exception.NotSupportedException- the Internal HTTP handler is currently in use, for which this method is not supported- See Also:
setCertificateSubject(String),getCertificateStoreName(),getCertificateDisplay(),getEnableOptionalClientCertificates()
-
getCertificateDisplay
public boolean getCertificateDisplay() throws com.facilita.exception.NotSupportedExceptionReturnstrueif client certificate names will be written to the event log. This can be useful for debugging SSL/TLS client certificate issues.- Returns:
trueif client certificate names will be written to the event log- Throws:
com.facilita.exception.NotSupportedException- the Internal HTTP handler is currently in use, for which this method is not supported- See Also:
setCertificateDisplay(boolean),getCertificateStoreName(),getCertificateSubject(),getEnableOptionalClientCertificates()
-
getEnableOptionalClientCertificates
public boolean getEnableOptionalClientCertificates() throws com.facilita.exception.NotSupportedExceptionReturnstrueif client certificates can be optional, in case the server requests a client certificate but doesn't require one.As part of the SSL/TLS handshake, a server can request a certificate to authenticate the client (i.e. the virtual user). If you have a client certificate, you can use the other certificate methods to specify its location. However if you know the server doesn't require a client certificate, you can set this flag. If
getCertificateSubject()returns an empty string or a client certificate cannot otherwise be located, the handshake will continue without one.- Returns:
trueif SSL/TLS handshakes should be retried without a client certificate- Throws:
com.facilita.exception.NotSupportedException- either the WinInet or Internal HTTP handler is currently in use, for which this method is not supported- See Also:
setEnableOptionalClientCertificates(boolean),getCertificateStoreName(),getCertificateSubject(),getCertificateDisplay()
-
setAccess
public void setAccess(int accessType, java.lang.String proxyServer, java.lang.String proxyBypass) throws com.facilita.exception.NotSupportedExceptionSets thedwAccessType,lpszProxyNameandlpszProxyBypassparameters to be passed toInternetOpen()used by WinInet/WinHTTP.- Parameters:
accessType- possible values are documented at Microsoft MSDN InternetOpen functionproxyServer- the proxy server address when accessType is set to INTERNET_OPEN_TYPE_PROXY. This must not be an emptyStringproxyBypass- an optional list of host names or IP addresses, or both, that should not be routed through the proxy when accessType set to INTERNET_OPEN_TYPE_PROXY. This must not be an emptyString- Throws:
com.facilita.exception.NotSupportedException- either the WinInet or WinHTTP handler is currently in use, for which this method is not supported
-
getAccessType
public int getAccessType() throws com.facilita.exception.NotSupportedExceptionGets thedwAccessTypeparameter to be passed toInternetOpen()used by WinInet/WinHTTP.To set the
dwAccessTypeparameter, call thesetAccess(int, String, String)method.- Returns:
- the
dwAccessTypeparameter - Throws:
com.facilita.exception.NotSupportedException- either the WinInet or WinHTTP handler is currently in use, for which this method is not supported- See Also:
setAccess(int, String, String)
-
getProxyServer
public java.lang.String getProxyServer() throws com.facilita.exception.NotSupportedExceptionGets thelpszProxyNameparameter to be passed toInternetOpen()used by WinInet/WinHTTP.To set the
lpszProxyNameparameter, call thesetAccess(int, String, String)method.- Returns:
- the
lpszProxyNameparameter - Throws:
com.facilita.exception.NotSupportedException- either the WinInet or WinHTTP handler is currently in use, for which this method is not supported- See Also:
setAccess(int, String, String)
-
getProxyBypass
public java.lang.String getProxyBypass() throws com.facilita.exception.NotSupportedExceptionGets thelpszProxyBypassparameter to be passed toInternetOpen()used by WinInet/WinHTTP.To set the
lpszProxyBypassparameter, call thesetAccess(int, String, String)method.- Returns:
- the
lpszProxyBypassparameter - Throws:
com.facilita.exception.NotSupportedException- either the WinInet or WinHTTP handler is currently in use, for which this method is not supported- See Also:
setAccess(int, String, String)
-
getConnectionsPerServer
public int getConnectionsPerServer() throws com.facilita.exception.NotSupportedExceptionGets the maximum number of connections allowed per server for a WinHTTP handler. The default value is INFINITE.- Returns:
- the maximum number of connections allowed per server for a WinHTTP handler
- Throws:
com.facilita.exception.NotSupportedException- this method is only supported if the WinHTTP handler is currently in use- See Also:
setConnectionsPerServer(int)
-
setConnectionsPerServer
public void setConnectionsPerServer(int connections) throws com.facilita.exception.NotSupportedExceptionSets the maximum number of connections allowed per server for a WinHTTP handler. The default value is INFINITE.- Parameters:
connections- the maximum number of connections allowed per server for a WinHTTP handler- Throws:
com.facilita.exception.NotSupportedException- this method is only supported if the WinHTTP handler is currently in use- See Also:
getConnectionsPerServer()
-
closeAllConnections
public void closeAllConnections()
Closes all of the open TCP/IP connections to the web server.
-
getDefaultCharactersAllowedInPostedForm
public java.lang.String getDefaultCharactersAllowedInPostedForm()
Get the characters that, by default, will NOT be percent-encoded when aFormis sent to the web server using a POST request.By default, a character will be percent-encoded within a form if it is:
- Outside the ASCII range OR
- Not an alpha-numeric character AND not in this list of allowed characters
' '- space'-'- hyphen'_'- underscore'.'- full stop'*'- asterisk
- Returns:
- the characters that will not be encoded
- See Also:
Coder.getDefaultCharactersAllowedInPostedForm(),setDefaultCharactersAllowedInPostedForm(String),Request.getCharactersAllowedInPostedForm(),Request.setMessageBody(Form)
-
setDefaultCharactersAllowedInPostedForm
public void setDefaultCharactersAllowedInPostedForm(java.lang.String charactersAllowedInPostedForm)
Set the characters that, by default, will NOT be percent-encoded when aFormis sent to the web server using a POST request.By default, a character will be percent-encoded within a form if it is:
- Outside the ASCII range OR
- Not an alpha-numeric character AND not in this list of allowed characters
' '- space'-'- hyphen'_'- underscore'.'- full stop'*'- asterisk
- Parameters:
charactersAllowedInPostedForm- the list of characters not to percent-encode- See Also:
Coder.getDefaultCharactersAllowedInPostedForm(),getDefaultCharactersAllowedInPostedForm(),Request.setCharactersAllowedInPostedForm(String),Request.setMessageBody(Form)
-
isLoggingSuspended
public boolean isLoggingSuspended()
Returnstrueif detailed HTTP logging has been suspended for this Virtual User.- Returns:
trueif detailed HTTP logging has been suspended for this Virtual User- See Also:
suspendLogging(),resumeLogging()
-
suspendLogging
public void suspendLogging()
Suspends detailed HTTP logging for this Virtual User.- See Also:
resumeLogging()
-
resumeLogging
public void resumeLogging()
Resumes detailed HTTP logging for this Virtual User.- See Also:
suspendLogging()
-
isDynatraceIntegrationEnabled
public boolean isDynatraceIntegrationEnabled()
Returnstrueif dynaTrace integration is enabled. When dynaTrace integration is enabled, a special dynaTrace HTTP header is sent with each HTTP request.- Returns:
trueif dynaTrace integration is enabled- See Also:
setDynatraceIntegrationEnabled(boolean)
-
setDynatraceIntegrationEnabled
public void setDynatraceIntegrationEnabled(boolean value)
Sets whether or not dynaTrace integration is enabled. When dynaTrace integration is enabled, a special dynaTrace HTTP header is sent with each HTTP request.- Parameters:
value-trueto enable dynaTrace integration,falseto disable it- See Also:
isDynatraceIntegrationEnabled()
-
responseWithNoExpiryInformationIsFresh
public boolean responseWithNoExpiryInformationIsFresh()
Gets a value that indicates whether a response from a web server that does not contains any expiry information (such as an "Expires" or "Cache-Control, max-age" header) is treated as expired or not.Usually, a response from a web server will have an "Expires" header, which gives the date/time after which the response is considered stale. However, if a response does not contain any expiry information, then it is up to the browser to decide whether or not a response should be considered fresh or not. Most browsers wil consider the response to be stale, and so will re-request it from the server. However, there may be cases where you want th opposite behaviour (i.e. consider the response to be fresh and so do not re-request it). This can be achieved by setting this property to
true. The default value for this property isfalse.- Returns:
trueif a response with no expiry information is considered to be fresh.- See Also:
setResponseWithNoExpiryInformationIsFresh(boolean)
-
setResponseWithNoExpiryInformationIsFresh
public void setResponseWithNoExpiryInformationIsFresh(boolean value)
Sets a value that indicates whether a response from a web server that does not contains any expiry information (such as an "Expires" or "Cache-Control, max-age" header) is treated as expired or not.Usually, a response from a web server will have an "Expires" header, which gives the date/time after which the response is considered stale. However, if a response does not contain any expiry information, then it is up to the browser to decide whether or not a response should be considered fresh or not. Most browsers will consider the response to be stale, and so will re-request it from the server. However, there may be cases where you want the opposite behaviour (i.e. consider the response to be fresh and so do not re-request it). This can be achieved by setting this property to
true. The default value for this property isfalse.- Parameters:
value-trueif a response with no expiry information should be considered to be fresh.- See Also:
responseWithNoExpiryInformationIsFresh()
-
createWebSocketMessage
public WebSocketMessage createWebSocketMessage(java.lang.String data)
Creates aWebSocketMessageobject that can be sent to the server.Note that this method will create a text message.
- Parameters:
data- The text to use as the contents of the message.- Returns:
- The new
WebSocketMessageobject. - See Also:
createWebSocketMessage(byte[], boolean),createWebSocketMessage(byte[])
-
createWebSocketMessage
public WebSocketMessage createWebSocketMessage(byte[] data)
Creates aWebSocketMessageobject that can be sent to the server.Note that this method will create a binary message.
- Parameters:
data- The binary data to use as the contents of the message.- Returns:
- The new
WebSocketMessageobject. - See Also:
createWebSocketMessage(String),createWebSocketMessage(byte[], boolean)
-
createWebSocketMessage
public WebSocketMessage createWebSocketMessage(byte[] data, boolean isBinary)
Creates aWebSocketMessageobject that can be sent to the server.- Parameters:
data- The binary data to use as the contents of the message.isBinary- set totrueif the message should be treated as binary data.- Returns:
- The new
WebSocketMessageobject. - See Also:
createWebSocketMessage(byte[]),createWebSocketMessage(String)
-
createWebSocket
public WebSocket createWebSocket(Url url, int reference)
Creates aWebSocketobject that can be used to send/receive WebSocket messages to/from the web server.The WebSocket is not opened until the
WebSocket.open()method is called.
-
-