Logo Search packages:      
Sourcecode: jakarta-jmeter version File versions  Download package

URL org::apache::jmeter::protocol::http::sampler::HTTPSamplerBase::getUrl (  )  throws MalformedURLException [inline, inherited]

Get the URL, built from its component parts.

As a special case, if the path starts with "http[s]://", then the path is assumed to be the entire URL.

The URL to be requested by this sampler.

Reimplemented in org::apache::jmeter::protocol::http::sampler::SoapSampler.

Definition at line 837 of file HTTPSamplerBase.java.

References org::apache::jmeter::protocol::http::sampler::HTTPSamplerBase::getPort(), org::apache::jmeter::protocol::http::sampler::HTTPSamplerBase::getProtocol(), org::apache::jmeter::protocol::http::sampler::HTTPSamplerBase::getQueryString(), and org::apache::jmeter::protocol::http::sampler::HTTPSamplerBase::isProtocolDefaultPort().

Referenced by sample(), and org::apache::jmeter::protocol::http::sampler::HTTPSamplerBase::sample().

        StringBuffer pathAndQuery = new StringBuffer(100);
        String path = this.getPath();
        // Hack to allow entire URL to be provided in host field
        if (path.startsWith(HTTP_PREFIX)
         || path.startsWith(HTTPS_PREFIX)){
            return new URL(path);
        if (!path.startsWith("/")){ // $NON-NLS-1$
            pathAndQuery.append("/"); // $NON-NLS-1$

        // Add the query string if it is a HTTP GET or DELETE request
        if(GET.equals(getMethod()) || DELETE.equals(getMethod())) {
            // Get the query string encoded in specified encoding
            // If no encoding is specified by user, we will get it
            // encoded in UTF-8, which is what the HTTP spec says
            String queryString = getQueryString(getContentEncoding());
            if(queryString.length() > 0) {
                if (path.indexOf(QRY_PFX) > -1) {// Already contains a prefix
                } else {
        // If default port for protocol is used, we do not include port in URL
        if(isProtocolDefaultPort()) {
            return new URL(getProtocol(), getDomain(), pathAndQuery.toString());
        return new URL(getProtocol(), getDomain(), getPort(), pathAndQuery.toString());

Generated by  Doxygen 1.6.0   Back to index