private String generateMatchUrl(HTTPSamplerBase sampler) { StringBuilder buf = new StringBuilder(sampler.getDomain()); buf.append(':'); // $NON-NLS-1$ buf.append(sampler.getPort()); buf.append(sampler.getPath()); if (sampler.getQueryString().length() > 0) { buf.append('?'); // $NON-NLS-1$ buf.append(sampler.getQueryString()); } return buf.toString(); }
String path = this.getPath();
/** * * @see org.apache.jmeter.protocol.http.proxy.SamplerCreator#createSampler(org.apache.jmeter.protocol.http.proxy.HttpRequestHdr, * java.util.Map, java.util.Map) */ @Override public HTTPSamplerBase createSampler(HttpRequestHdr request, Map<String, String> pageEncodings, Map<String, String> formEncodings) { // Instantiate the sampler HTTPSamplerBase sampler = HTTPSamplerFactory.newInstance(request.getHttpSamplerName()); sampler.setProperty(TestElement.GUI_CLASS, HttpTestSampleGui.class.getName()); // Defaults sampler.setFollowRedirects(false); sampler.setUseKeepAlive(true); if (log.isDebugEnabled()) { log.debug("getSampler: sampler path = " + sampler.getPath()); } return sampler; }
if(!StringUtils.isEmpty(prefix)) { if (httpSampleNameMode==SAMPLER_NAME_NAMING_MODE_PREFIX) { sampler.setName(prefix + incrementRequestNumberAndGet() + " " + sampler.getPath()); } else if (httpSampleNameMode==SAMPLER_NAME_NAMING_MODE_COMPLETE) { sampler.setName(incrementRequestNumberAndGet() + " " + prefix); sampler.setName(incrementRequestNumberAndGet() + " " + sampler.getPath()); sampler.setName(prefix+sampler.getPath()); } else if (httpSampleNameMode==SAMPLER_NAME_NAMING_MODE_COMPLETE) { sampler.setName(prefix); sampler.setName(sampler.getPath());
/** * @see org.apache.jmeter.protocol.http.proxy.SamplerCreator#populateSampler(org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase, * org.apache.jmeter.protocol.http.proxy.HttpRequestHdr, java.util.Map, * java.util.Map) */ @Override public final void populateSampler(HTTPSamplerBase sampler, HttpRequestHdr request, Map<String, String> pageEncodings, Map<String, String> formEncodings) throws Exception{ computeFromHeader(sampler, request, pageEncodings, formEncodings); computeFromPostBody(sampler, request); if (log.isDebugEnabled()) { log.debug("sampler path = " + sampler.getPath()); } Arguments arguments = sampler.getArguments(); if(arguments.getArgumentCount() == 1 && arguments.getArgument(0).getName().length()==0) { sampler.setPostBodyRaw(true); } }
/** * Set path on sampler * @param sampler {@link HTTPSamplerBase} * @param request {@link HttpRequestHdr} */ protected void computePath(HTTPSamplerBase sampler, HttpRequestHdr request) { if(sampler.getContentEncoding() != null) { sampler.setPath(request.getPath(), sampler.getContentEncoding()); } else { // Although the spec says UTF-8 should be used for encoding URL parameters, // most browser use ISO-8859-1 for default if encoding is not known. // We use null for contentEncoding, then the url parameters will be added // with the value in the URL, and the "encode?" flag set to false sampler.setPath(request.getPath(), null); } if (log.isDebugEnabled()) { log.debug("Proxy: setting path: " + sampler.getPath()); } }
String value = getPath(); if(!StringUtils.isEmpty(value)) { Object[] result = JOrphanUtils.replaceAllWithRegex(value, regex, replaceBy, caseSensitive);
private void modify(HTTPSamplerBase sampler, String value) { if (isPathExtension()) { String oldPath = sampler.getPath(); int indexOfSessionId = oldPath.indexOf(SEMI_COLON + getArgumentName()); if(oldPath.indexOf(SEMI_COLON + getArgumentName())>=0) { int indexOfQuestionMark = oldPath.indexOf('?'); if(indexOfQuestionMark < 0) { oldPath = oldPath.substring(0, indexOfSessionId); } else { oldPath = oldPath.substring(0, indexOfSessionId)+ oldPath.substring(indexOfQuestionMark); } } if (isPathExtensionNoEquals()) { sampler.setPath(oldPath + SEMI_COLON + getArgumentName() + value); // $NON-NLS-1$ } else { sampler.setPath(oldPath + SEMI_COLON + getArgumentName() + "=" + value); // $NON-NLS-1$ // $NON-NLS-2$ } } else { sampler.getArguments().removeArgument(getArgumentName()); sampler.getArguments().addArgument(new HTTPArgument(getArgumentName(), value, !encode())); } }
sampler.setPath(url.getPath()); if (url.getMethod().equals(HTTPConstants.POST)) { for (JMeterProperty jMeterProperty : sampler.getArguments()) {
sampler.setPath(url.getPath()); if (url.getMethod().equals(HTTPConstants.POST)) { PropertyIterator iter = sampler.getArguments().iterator();