/** * Create a new instance of the default sampler * * @return instance of default sampler */ public static HTTPSamplerBase newInstance() { return newInstance(DEFAULT_CLASSNAME); }
/** * {@inheritDoc} */ @Override public Object generateRequest() { SAMPLE = HTTPSamplerFactory.newInstance(); return SAMPLE; }
/** * 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; }
/** * * @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; }