/** * Compute content encoding * * @param sampler {@link HTTPSamplerBase} * @param request {@link HttpRequestHdr} * @param pageEncodings Map<String, String> * @param formEncodings Map<String, String> * @throws MalformedURLException */ protected void computeContentEncoding( HTTPSamplerBase sampler, HttpRequestHdr request, Map<String, String> pageEncodings, Map<String, String> formEncodings) throws MalformedURLException { URL pageUrl = null; if (sampler.isProtocolDefaultPort()) { pageUrl = new URL(sampler.getProtocol(), sampler.getDomain(), request.getPath()); } else { pageUrl = new URL(sampler.getProtocol(), sampler.getDomain(), sampler.getPort(), request.getPath()); } String urlWithoutQuery = request.getUrlWithoutQuery(pageUrl); String contentEncoding = computeContentEncoding(request, pageEncodings, formEncodings, urlWithoutQuery); // Set the content encoding if (!StringUtils.isEmpty(contentEncoding)) { sampler.setContentEncoding(contentEncoding); } }
/** * Set domain on sampler * * @param sampler {@link HTTPSamplerBase} * @param request {@link HttpRequestHdr} */ protected void computeDomain(HTTPSamplerBase sampler, HttpRequestHdr request) { sampler.setDomain(request.serverName()); if (log.isDebugEnabled()) { log.debug("Proxy: setting server: " + sampler.getDomain()); } }