/** * {@inheritDoc} */ @Override public void setQueryString(String querystring) { SAMPLE.parseArguments(querystring); }
/** * Convert a single line into XML * * @param text to be converted * @param el {@link HTTPSamplerBase} which consumes the <code>text</code> */ public void convertStringToJMRequest(String text, TestElement el) { ((HTTPSamplerBase) el).parseArguments(text); }
public void parseArguments(String queryString) { // We do not know the content encoding of the query string parseArguments(queryString, null); }
/** * Sets the PATH property; if the request is a GET or DELETE (and the path * does not start with http[s]://) it also calls {@link #parseArguments(String, String)} * to extract and store any query arguments. * * @param path * The new Path value * @param contentEncoding * The encoding used for the querystring parameter values */ public void setPath(String path, String contentEncoding) { boolean fullUrl = path.startsWith(HTTP_PREFIX) || path.startsWith(HTTPS_PREFIX); String method = getMethod(); boolean getOrDelete = HTTPConstants.GET.equals(method) || HTTPConstants.DELETE.equals(method); if (!fullUrl && getOrDelete) { int index = path.indexOf(QRY_PFX); if (index > -1) { setProperty(PATH, path.substring(0, index)); // Parse the arguments in querystring, assuming specified encoding for values parseArguments(path.substring(index + 1), contentEncoding); } else { setProperty(PATH, path); } } else { setProperty(PATH, path); } }
/** * 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; }
sampler.parseArguments(postData.trim(), contentEncoding); //standard name=value postData } else if (postData.length() > 0) { if (isBinaryContent(contentType)) {