Class WebBrowser
- java.lang.Object
-
- com.facilita.fc.web.WebBrowser
-
public class WebBrowser extends java.lang.Object
TheWebBrowser
class is the starting point for sending web requests. It can be used to createRequest
objects to send to a web server (using thecreateRequest(HttpMethod, Url)
method).The
WebBrowser
class 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
WebBrowser
object 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 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 subsequentRequest
objects created by thisWebBrowser
.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 subsequentRequest
objects created by thisWebBrowser
.void
addResponseToCache(CachedResponse response)
Adds an entry to thisWebBrowser
object's cache.void
cacheContentTypeDirectory(java.lang.String contentTypeDirectory)
Adds a Content-Type media type for which cached content is stored.void
cacheContentTypeDirectory(java.lang.String contentTypeDirectory, boolean cache)
Adds or removes a Content-Type media type for which cached content is stored.boolean
cacheSecureData()
Returnstrue
if secure (HTTPS) data will be cached.void
clearCache()
Clears the HTTP cache.void
clearCookies()
Clears the cookie cache.void
clearDefaultHeaders()
Removes all of the default HTTP headers.void
closeAllConnections()
Closes all of the open TCP/IP connections to the web server.boolean
containsDefaultHeader(java.lang.String header)
Returnstrue
if the specified HTTP header is set by default onRequest
objects created by thisWebBrowser
.Request
createRequest(HttpMethod method, Url url)
Creates aRequest
object that can be used to send an HTTP request to the web server.Request
createRequest(HttpMethod method, Url url, int reference)
Creates aRequest
object 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.WebSocket
createWebSocket(Url url, int reference)
Creates aWebSocket
object that can be used to send/receive WebSocket messages to/from the web server.WebSocketMessage
createWebSocketMessage(byte[] data)
Creates aWebSocketMessage
object that can be sent to the server.WebSocketMessage
createWebSocketMessage(byte[] data, boolean isBinary)
Creates aWebSocketMessage
object that can be sent to the server.WebSocketMessage
createWebSocketMessage(java.lang.String data)
Creates aWebSocketMessage
object that can be sent to the server.void
delete()
void
excludeContentTypeFromCache(java.lang.String contentType)
Adds a Content-Type for which cached content is not stored.int
getAccessType()
Gets thedwAccessType
parameter to be passed toInternetOpen()
used by WinInet/WinHTTP.int
getBufferSize()
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.int
getCacheInMemoryContentLimit()
Gets the maximum size of resources that can be cached in memory.boolean
getCertificateDisplay()
Returnstrue
if client certificate names will be written to the event log.java.lang.String
getCertificateStoreName()
Gets the name of the system certificate store in which to search for client certificates.java.lang.String
getCertificateSubject()
Gets the subject to search for when selecting a client certificate.java.lang.String
getCertLocation()
Gets the location folder or file path for a client certificate.int
getConnectionsPerServer()
Gets the maximum number of connections allowed per server for a WinHTTP handler.ConnectionType
getConnectionType(boolean secure)
Gets theConnectionType
in use.int
getConnectRetries()
Gets the number of times to attempt to connect to a web server before reporting a failure.int
getConnectTimeout()
Gets the time in milliseconds to wait for a TCP connection to be opened, before reporting a failure.boolean
getCookiesSupported()
Returnstrue
if cookies will be handled automatically.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 specifieddomain
andpath
.static long
getCPtr(WebBrowser obj)
For internal use only.java.lang.String
getDefaultCharactersAllowedInPostedForm()
Get the characters that, by default, will NOT be percent-encoded when aForm
is sent to the web server using a POST request.int
getDefaultConnectionIdleTimeout()
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 subsequentRequest
objects 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 subsequentRequest
objects created by thisWebBrowser
.boolean
getDefaultFollowRedirects()
Returnstrue
if redirects will automatically be followed forRequest
objects 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 subsequentRequest
object created by thisWebBrowser
.java.lang.String
getDefaultHeaderValue(java.lang.String header)
Gets the value of the specified default HTTP header.boolean
getDefaultIncludeQueryDataInLabels()
Returnstrue
if URLs with different query data should be considered different from each other by default.boolean
getDefaultKeepAllSubRequestContent()
Returnstrue
if the content of responses to sub-requests will be kept, for any subsequentRequest
objects created by thisWebBrowser
.boolean
getDefaultKeepContent()
Returnstrue
if the content of responses will be kept, for any subsequentRequest
objects created by thisWebBrowser
.boolean
getDefaultRetrieveSubRequests()
Returnstrue
if sub-requests will be retrieved for any subsequentRequest
objects created by thisWebBrowser
.int
getDefaultSubRequestThreadCount()
Gets the number of threads that will be used to fetch sub-requests from the web server, for any subsequentRequest
objects created by thisWebBrowser
.boolean
getDefaultTimeEveryHttpRequest()
Returnstrue
if sub-requests will be timed as well as top-level HTTP requests, for any subsequentRequest
objects created by thisWebBrowser
.java.lang.String
getDefaultUserAgent()
Gets the value that the"User-Agent"
HTTP header defaults to inRequest
objects created by thisWebBrowser
.java.lang.String
getDefaultVersion()
Gets the HTTP version as aString
, as set by default for any subsequentRequest
objects created by thisWebBrowser
.int
getDnsRetries()
Gets the number of times that eggPlant Performance will retry a DNS lookup in the event of failure.int
getDnsTimeout()
Gets the time in milliseconds before a DNS lookup will time-out.boolean
getEnableOptionalClientCertificates()
Returnstrue
if client certificates can be optional, in case the server requests a client certificate but doesn't require one.HostFilteringMode
getHostFilteringMode()
Get theHostFilteringMode
.IpEndPoint
getLocalIpEndPoint()
Gets the localIpEndPoint
to use when making a connection to a web server.int
getMaxNetworkErrors()
Gets the maximum number of network errors to accept before the script is terminated.int
getMinorVersion()
Gets the minor HTTP version number.java.lang.String
getPassword()
Gets the password that will be used for HTTP authentication.java.lang.String
getProxy()
Gets the address of the proxy server used by thisWebBrowser
.java.lang.String
getProxyBypass()
Gets thelpszProxyBypass
parameter to be passed toInternetOpen()
used by WinInet/WinHTTP.int
getProxyPort()
Gets the port number used by the proxy server for thisWebBrowser
.java.lang.String
getProxyServer()
Gets thelpszProxyName
parameter to be passed toInternetOpen()
used by WinInet/WinHTTP.int
getReadRetries()
Gets the number of times to attempt to read data from the web server before reporting a failure.int
getReceiveTimeout()
Gets the time in milliseconds to wait for a web server to respond to a request before reporting a failure.int
getSendTimeout()
Gets the time in milliseconds before a sent TCP packet will time-out.int
getSSLrenegotiateTime()
Gets the time in milliseconds after which the SSL connection must be renegotiated.java.lang.String
getUser()
Gets the username that will be used for HTTP authentication.VirtualUser
getVirtualUser()
Gets theVirtualUser
instance that thisWebBrowser
is associated with.void
ignoreHost(java.lang.String domain)
Prevents requests from being sent to the specifieddomain
.void
ignoreHostRegexp(java.lang.String regexp)
Prevents requests from being sent to any domain that matches the specified regular expression.void
includeContentTypeInCache(java.lang.String contentType)
Adds a Content-Type for which cached content is stored.void
includeHost(java.lang.String domain)
Allows requests to be sent to the specifieddomain
.void
includeHostRegexp(java.lang.String regexp)
Allow requests to be sent to any host that matches the given regular expression.boolean
isCachingEnabled()
Returnstrue
if HTTP caching is enabled.boolean
isDynatraceIntegrationEnabled()
Returnstrue
if dynaTrace integration is enabled.boolean
isHostIgnored(java.lang.String domain)
Returnstrue
if the specifieddomain
is currently being ignored.boolean
isLoggingEnabled()
Returnstrue
if detailed HTTP logging has been enabled for this Virtual User.boolean
isLoggingSuspended()
Returnstrue
if detailed HTTP logging has been suspended for this Virtual User.boolean
isSetCertLocation()
Returnstrue
if a certificate location has been set.boolean
isSetProxy()
Returnstrue
if a proxy server has been defined for thisWebBrowser
.void
removeCookie(java.lang.String cookieName)
Removes all cookies with the given name from the cookie cachevoid
removeDefaultHeader(java.lang.String header)
Removes the specified default HTTP header.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 subsequentRequest
objects created by thisWebBrowser
.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 subsequentRequest
objects created by thisWebBrowser
.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.void
resumeLogging()
Resumes detailed HTTP logging for this Virtual User.void
saveCookie(java.lang.String host, java.lang.String data)
Saves cookie data for the specifiedhost
.void
setAccess(int accessType, java.lang.String proxyServer, java.lang.String proxyBypass)
Sets thedwAccessType
,lpszProxyName
andlpszProxyBypass
parameters to be passed toInternetOpen()
used by WinInet/WinHTTP.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.void
setBufferSize(int bufferSize)
Sets the size of the buffer used when reading TCP data from a socket.void
setCacheInMemoryContentLimit(int value)
Sets the maximum size of resources that can be cached in memory.void
setCacheSecureData(boolean cacheSecureData)
Sets whether secure (HTTPS) data should be cached (true
by default).void
setCachingEnabled(boolean value)
Sets whether HTTP caching should be enabled.void
setCertificateDisplay(boolean display)
Sets whether client certificate names should be written to the event log.void
setCertificateStoreName(java.lang.String storeName)
Sets the name of the system certificate store in which to search for client certificates.void
setCertificateSubject(java.lang.String subject)
Sets the subject to search for when selecting a client certificate.void
setCertLocation(java.lang.String path)
Sets the location folder or file path for a client certificate.void
setConnectionsPerServer(int connections)
Sets the maximum number of connections allowed per server for a WinHTTP handler.void
setConnectRetries(int retries)
Sets the number of times to attempt to connect to a web server before reporting a failure.void
setConnectTimeout(int timeout)
Sets the time in milliseconds to wait for a TCP connection to be opened, before reporting a failure.void
setCookiesSupported()
Sets automatic cookie handling to be enabled.void
setCookiesSupported(boolean on)
Sets whether cookies should be handled automatically.void
setDefaultCharactersAllowedInPostedForm(java.lang.String charactersAllowedInPostedForm)
Set the characters that, by default, will NOT be percent-encoded when aForm
is sent to the web server using a POST request.void
setDefaultConnectionIdleTimeout(int timeout)
Sets the time in milliseconds after which a TCP connection is considered to be idle, and automatically closed.void
setDefaultFollowRedirects()
Sets the behaviour of thisWebBrowser
so redirects will automatically be followed for any subsequentRequest
objects created.void
setDefaultFollowRedirects(boolean followRedirects)
Sets whether redirects will automatically be followed for any subsequentRequest
objects created by thisWebBrowser
.void
setDefaultHeader(java.lang.String header)
Sets a default HTTP request header for every subsequentRequest
object created by thisWebBrowser
, using the contents of the specifiedString
.void
setDefaultHeader(java.lang.String header, java.lang.String value)
Sets a default HTTP request header for every subsequentRequest
object created by thisWebBrowser
, as a name/value pair.void
setDefaultIncludeQueryDataInLabels(boolean includeQueryDataInLabels)
Sets whether URLs with different query data should be considered different from each other by default.void
setDefaultKeepAllSubRequestContent(boolean keep)
Sets whether the content of responses to sub-requests should be kept, for any subsequentRequest
objects created by thisWebBrowser
.void
setDefaultKeepContent(boolean keep)
Sets whether to keep the content of responses by default, for any subsequentRequest
objects created by thisWebBrowser
.void
setDefaultRetrieveSubRequests(boolean getDefaultEmbeddedUrls)
Sets whether sub-requests will be retrieved for any subsequentRequest
objects created by thisWebBrowser
.void
setDefaultSubRequestThreadCount(int subRequestThreadCount)
Sets the number of threads that will be used to fetch sub-requests from the web server, for any subsequentRequest
objects created by thisWebBrowser
.void
setDefaultTimeEveryHttpRequest(boolean timings)
Sets whether sub-requests should be timed as well as top-level HTTP requests, for any subsequentRequest
objects created by thisWebBrowser
.void
setDefaultUserAgent(java.lang.String userAgent)
Sets the value that the"User-Agent"
HTTP header defaults to inRequest
objects created by thisWebBrowser
.void
setDefaultVersion(java.lang.String version)
Sets the HTTP version for any subsequentRequest
objects created by thisWebBrowser
.void
setDnsRetries(int retries)
Sets the number of times that eggPlant Performance will retry a DNS lookup in the event of failure.void
setDnsTimeout(int timeout)
Sets the time in milliseconds before a DNS lookup will time-out.void
setDynatraceIntegrationEnabled(boolean value)
Sets whether or not dynaTrace integration is enabled.void
setEnableOptionalClientCertificates(boolean enable)
Sets whether client certificates can be optional, in case the server requests a client certificate but doesn't require one.void
setHostFilteringMode(HostFilteringMode mode)
Set theHostFilteringMode
.void
setLocalIpEndPoint(IpEndPoint localIpEndPoint)
Sets the localIpEndPoint
to use when making a connection to a web server.void
setMaxNetworkErrors(int n)
Sets the maximum number of network errors to accept before the script is terminated.void
setMinorVersion(int version)
Sets the minor HTTP version number.void
setPassword(java.lang.String password)
Sets the password that will be used for HTTP authentication.void
setProxy(java.lang.String proxy, int port)
Sets the proxy server address and port.void
setProxyUserPassword(java.lang.String username, java.lang.String password)
Sets the username and password that will be used for proxy authentication.void
setReadRetries(int n)
Sets the number of times to attempt to read data from the web server before reporting a failure.void
setReceiveTimeout(int timeout)
Sets the time in milliseconds to wait for a web server to respond to a request before reporting a failure.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.void
setSendTimeout(int timeout)
Sets the time in milliseconds before a sent TCP packet will time-out.void
setSSLrenegotiateTime(int time)
Sets the time in milliseconds after which the SSL connection must be renegotiated.void
setUser(java.lang.String user)
Sets the username that will be used for HTTP authentication.void
setUserPassword(java.lang.String username, java.lang.String password)
Sets the username and password that will be used for HTTP authentication.void
suspendLogging()
Suspends detailed HTTP logging for this Virtual User.boolean
unignoreHost(java.lang.String domain)
Stops preventing requests from being sent to the specifieddomain
.void
unignoreHostRegexp(java.lang.String regexp)
Stops preventing requests from being sent to the domains that match the specified regular expression.void
unincludeHost(java.lang.String domain)
Stop sending requests to the specifieddomain
.void
unincludeHostRegexp(java.lang.String regexp)
Stop sending requests to hosts that match the given regular expression.void
unsetProxy()
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 theVirtualUser
instance that thisWebBrowser
is associated with.- Returns:
- the
VirtualUser
instance that thisWebBrowser
is associated with
-
createRequest
public Request createRequest(HttpMethod method, Url url, int reference) throws com.facilita.exception.NotImplementedException, BadValueException
Creates aRequest
object 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
- theHttpMethod
to use when sending theRequest
to the web serverurl
- theUrl
that this request should be sent toreference
- a unique identifier that can be used to track thisRequest
- Returns:
- the new
Request
object - 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 aRequest
object 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
- theHttpMethod
to use when sending theRequest
to the web serverurl
- theUrl
that this request should be sent to- Returns:
- the new
Request
object - 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 subsequentRequest
object 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 subsequentRequest
object 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.Request
objects created by thisWebBrowser
will 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.Request
objects created by thisWebBrowser
will no longer have default headers set.
-
containsDefaultHeader
public boolean containsDefaultHeader(java.lang.String header)
Returnstrue
if the specified HTTP header is set by default onRequest
objects created by thisWebBrowser
.- Parameters:
header
- the header to check for- Returns:
true
if the specifiedheader
has 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.Request
objects created by thisWebBrowser
will 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 emptyString
if 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 inRequest
objects 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 inRequest
objects 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.InternalError
Gets a list of names of all the default HTTP request headers that will be set for every subsequentRequest
object 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 subsequentRequest
objects created by thisWebBrowser
.If the response to a request is an HTTP redirect code (e.g.
301
,302
), and theRequest
object 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
-true
if redirects should be followed automatically- See Also:
Request.setFollowRedirects(boolean)
-
setDefaultFollowRedirects
public void setDefaultFollowRedirects()
Sets the behaviour of thisWebBrowser
so redirects will automatically be followed for any subsequentRequest
objects created.If the response to a request is an HTTP redirect code (e.g.
301
,302
), and theRequest
object 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()
Returnstrue
if redirects will automatically be followed forRequest
objects created by thisWebBrowser
.If the response to a request is an HTTP redirect code (e.g.
301
,302
), and theRequest
object has been set to follow redirects, then the eggPlant Performance engine will automatically follow the redirect link.- Returns:
true
if redirects will automatically be followed forRequest
objects created- See Also:
setDefaultFollowRedirects(boolean)
,Request.getFollowRedirects()
-
setDefaultRetrieveSubRequests
public void setDefaultRetrieveSubRequests(boolean getDefaultEmbeddedUrls)
Sets whether sub-requests will be retrieved for any subsequentRequest
objects created by thisWebBrowser
. See theRequest.send()
method for more information.- Parameters:
getDefaultEmbeddedUrls
-true
if sub-requests should be retrieved by default- See Also:
Request.send()
,Request.setRetrieveSubRequests(boolean)
-
getDefaultRetrieveSubRequests
public boolean getDefaultRetrieveSubRequests()
Returnstrue
if sub-requests will be retrieved for any subsequentRequest
objects created by thisWebBrowser
. See theRequest.send()
method for more information.- Returns:
true
if sub-requests will be retrieved forRequest
objects by default- See Also:
Request.getRetrieveSubRequests()
,Request.send()
-
getDefaultIncludeQueryDataInLabels
public boolean getDefaultIncludeQueryDataInLabels()
Returnstrue
if 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=camera
http://localhost:32144/search?q=laptop
http://localhost:32144/search
.- Returns:
true
if 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=camera
http://localhost:32144/search?q=laptop
http://localhost:32144/search
.- Parameters:
includeQueryDataInLabels
-true
if 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 subsequentRequest
objects created by thisWebBrowser
. Top-level requests will always be timed, even if this is set tofalse
.- Parameters:
timings
-true
if sub-requests should be timed by default as well as top-level HTTP requests- See Also:
getDefaultTimeEveryHttpRequest()
,Request.setTimeEveryHttpRequest(boolean)
-
getDefaultTimeEveryHttpRequest
public boolean getDefaultTimeEveryHttpRequest()
Returnstrue
if sub-requests will be timed as well as top-level HTTP requests, for any subsequentRequest
objects created by thisWebBrowser
. Top-level requests will always be timed, even if this method returnsfalse
.- Returns:
true
if 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 subsequentRequest
objects 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 subsequentRequest
objects 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 subsequentRequest
objects 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 subsequentRequest
objects 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()
Returnstrue
if the content of responses to sub-requests will be kept, for any subsequentRequest
objects 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 totrue
if it is necessary to examine the content of sub-responses.- Returns:
true
if 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 subsequentRequest
objects 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 totrue
if it is necessary to examine the content of sub-responses.- Parameters:
keep
-true
if 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 subsequentRequest
objects created by thisWebBrowser
.If this value is set to
false
then the content of every response to thisRequest
will be discarded, and it will not be possible to examine the content using theResponse
class (but other information will still be accessible in theResponse
objects).- Parameters:
keep
-true
if the content of responses should be kept by default- See Also:
getDefaultKeepContent()
,setDefaultKeepAllSubRequestContent(boolean)
-
getDefaultKeepContent
public boolean getDefaultKeepContent()
Returnstrue
if the content of responses will be kept, for any subsequentRequest
objects created by thisWebBrowser
.If this returns
false
then the content of every response to thisRequest
will be discarded, and it will not be possible to examine the content using theResponse
class (but other information will still be accessible in theResponse
objects).- Returns:
true
if 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 subsequentRequest
objects 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 thistypeFragment
will 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 subsequentRequest
objects 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 thisurlFragment
will 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 subsequentRequest
objects 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 thistypeFragment
will 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 subsequentRequest
objects 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 thisurlFragment
will 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.InternalError
Gets a list of all the URL fragments for which the content of sub-request responses will be kept by default for any subsequentRequest
objects 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.InternalError
Gets a list of all the Content-Type fragments for which the content of sub-request responses will be kept by default for any subsequentRequest
objects 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
-true
if 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()
Returnstrue
if 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:
true
if 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 specifieddomain
andpath
. 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
domain
andpath
- See Also:
saveCookie(String, String)
,clearCookies()
-
clearCookies
public void clearCookies()
Clears the cookie cache. AWebBrowser
object 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
HostFilteringMode
is 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
HostFilteringMode
is set toHostFilteringMode.BLOCKLIST
.- Parameters:
domain
- the host name to be removed from the list of ignored hosts- Returns:
true
if the host name was removed from the list of ignored hosts, orfalse
if 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)
Returnstrue
if the specifieddomain
is currently being ignored.- Parameters:
domain
- the host to check- Returns:
true
if the specifieddomain
is 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
HostFilteringMode
is 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
HostFilteringMode
is 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
HostFilteringMode
is 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
HostFilteringMode
is 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
HostFilteringMode
is 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
HostFilteringMode
is 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. AWebBrowser
object 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()
Returnstrue
if 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:
true
if 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
-true
if HTTP caching should be enabled
-
getCachedContentTypeDirectories
public java.util.List<java.lang.String> getCachedContentTypeDirectories() throws com.facilita.exception.InternalError
Gets 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
-true
if 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.InternalError
Gets 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()
Returnstrue
if secure (HTTPS) data will be cached.- Returns:
true
if 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 (true
by default).- Parameters:
cacheSecureData
-true
if secure data should be cached- See Also:
cacheSecureData()
,setCachingEnabled(boolean)
-
addResponseToCache
public void addResponseToCache(CachedResponse response)
Adds an entry to thisWebBrowser
object's cache. This method can be used to pre-populate aWebBrowser
object'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
- aCachedResponse
representing 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()
Returnstrue
if 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:
true
if 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.0
has 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.0
has 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()
Returnstrue
if detailed HTTP logging has been enabled for this Virtual User.- Returns:
true
if detailed HTTP logging has been enabled for this Virtual User
-
getConnectionType
public ConnectionType getConnectionType(boolean secure)
Gets theConnectionType
in use.Note that it is possible to use different connection types for HTTP and HTTPS traffic; the
secure
parameter is used to distinguish between them.- Parameters:
secure
-true
to return theConnectionType
used for secure (HTTPS) connections, orfalse
for unsecure (HTTP) connections- Returns:
- the
ConnectionType
in 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 localIpEndPoint
to 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
IpEndPoint
objects. 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
IpEndPoint
to 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 localIpEndPoint
to 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
IpEndPoint
objects. 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 localIpEndPoint
to 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.NotSupportedException
Sets 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.NotSupportedException
Gets 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.NotSupportedException
Gets 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.NotSupportedException
Sets 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.NotSupportedException
Sets 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.NotSupportedException
Returnstrue
if a certificate location has been set.- Returns:
true
if 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.NotSupportedException
Gets 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.NotSupportedException
Gets 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.NotSupportedException
Sets 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.NotSupportedException
Sets 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 Computer
certificate 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.NotSupportedException
Sets 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.NotSupportedException
Sets whether client certificate names should be written to the event log. This can be useful for debugging SSL/TLS client certificate issues.- Parameters:
display
-true
if 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.NotSupportedException
Sets 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
-true
if 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.NotSupportedException
Gets 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 Computer
certificate 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.NotSupportedException
Gets 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.NotSupportedException
Returnstrue
if client certificate names will be written to the event log. This can be useful for debugging SSL/TLS client certificate issues.- Returns:
true
if 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.NotSupportedException
Returnstrue
if 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:
true
if 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.NotSupportedException
Sets thedwAccessType
,lpszProxyName
andlpszProxyBypass
parameters 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 emptyString
proxyBypass
- 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.NotSupportedException
Gets thedwAccessType
parameter to be passed toInternetOpen()
used by WinInet/WinHTTP.To set the
dwAccessType
parameter, call thesetAccess(int, String, String)
method.- Returns:
- the
dwAccessType
parameter - 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.NotSupportedException
Gets thelpszProxyName
parameter to be passed toInternetOpen()
used by WinInet/WinHTTP.To set the
lpszProxyName
parameter, call thesetAccess(int, String, String)
method.- Returns:
- the
lpszProxyName
parameter - 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.NotSupportedException
Gets thelpszProxyBypass
parameter to be passed toInternetOpen()
used by WinInet/WinHTTP.To set the
lpszProxyBypass
parameter, call thesetAccess(int, String, String)
method.- Returns:
- the
lpszProxyBypass
parameter - 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.NotSupportedException
Gets 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.NotSupportedException
Sets 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 aForm
is 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 aForm
is 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()
Returnstrue
if detailed HTTP logging has been suspended for this Virtual User.- Returns:
true
if 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()
Returnstrue
if dynaTrace integration is enabled. When dynaTrace integration is enabled, a special dynaTrace HTTP header is sent with each HTTP request.- Returns:
true
if 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
-true
to enable dynaTrace integration,false
to 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:
true
if 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
-true
if a response with no expiry information should be considered to be fresh.- See Also:
responseWithNoExpiryInformationIsFresh()
-
createWebSocketMessage
public WebSocketMessage createWebSocketMessage(java.lang.String data)
Creates aWebSocketMessage
object 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
WebSocketMessage
object. - See Also:
createWebSocketMessage(byte[], boolean)
,createWebSocketMessage(byte[])
-
createWebSocketMessage
public WebSocketMessage createWebSocketMessage(byte[] data)
Creates aWebSocketMessage
object 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
WebSocketMessage
object. - See Also:
createWebSocketMessage(String)
,createWebSocketMessage(byte[], boolean)
-
createWebSocketMessage
public WebSocketMessage createWebSocketMessage(byte[] data, boolean isBinary)
Creates aWebSocketMessage
object that can be sent to the server.- Parameters:
data
- The binary data to use as the contents of the message.isBinary
- set totrue
if the message should be treated as binary data.- Returns:
- The new
WebSocketMessage
object. - See Also:
createWebSocketMessage(byte[])
,createWebSocketMessage(String)
-
createWebSocket
public WebSocket createWebSocket(Url url, int reference)
Creates aWebSocket
object 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.
-
-