/** * {@inheritDoc} */ @Override public void setPath(String path) { SAMPLE.setPath(path); }
/** * Sets the Path attribute of the UrlConfig object Also calls parseArguments * to extract and store any query arguments * * @param path * The new Path value */ public void setPath(String path) { // We know that URL arguments should always be encoded in UTF-8 according to spec setPath(path, EncoderCache.URL_ARGUMENT_ENCODING); }
/** * 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()); } }
/** * Create a new Sampler based on an HREF string plus a contextual URL * object. Given that an HREF string might be of three possible forms, some * processing is required. * * @param parsedUrlString * the url from the href * @param context * the context in which the href was found. This is used to * extract url information that might be missing in * <code>parsedUrlString</code> * @return sampler with filled in information about the fully parsed url * @throws MalformedURLException * when the given url (<code>parsedUrlString</code> plus * <code>context</code> is malformed) */ public static HTTPSamplerBase createUrlFromAnchor(String parsedUrlString, URL context) throws MalformedURLException { if (log.isDebugEnabled()) { log.debug("Creating URL from Anchor: " + parsedUrlString + ", base: " + context); } URL url = ConversionUtils.makeRelativeURL(context, parsedUrlString); HTTPSamplerBase sampler =HTTPSamplerFactory.newInstance(); sampler.setDomain(url.getHost()); sampler.setProtocol(url.getProtocol()); sampler.setPort(url.getPort()); sampler.setPath(url.getPath()); sampler.parseArguments(url.getQuery()); return sampler; }
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())); } }
if (nbReplaced>0) { String replacedText = (String) result[0]; setPath(replacedText); totalReplaced += nbReplaced;
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();