当前位置: 首页>>代码示例>>Java>>正文


Java HTTPConstants.DEFAULT_HTTP_PORT属性代码示例

本文整理汇总了Java中org.apache.jmeter.protocol.http.util.HTTPConstants.DEFAULT_HTTP_PORT属性的典型用法代码示例。如果您正苦于以下问题:Java HTTPConstants.DEFAULT_HTTP_PORT属性的具体用法?Java HTTPConstants.DEFAULT_HTTP_PORT怎么用?Java HTTPConstants.DEFAULT_HTTP_PORT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.jmeter.protocol.http.util.HTTPConstants的用法示例。


在下文中一共展示了HTTPConstants.DEFAULT_HTTP_PORT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPort

/**
 * Get the port; apply the default for the protocol if necessary.
 *
 * @return the port number, with default applied if required.
 */
public int getPort() {
    final int port = getPortIfSpecified();
    if (port == UNSPECIFIED_PORT) {
        String prot = getProtocol();
        if (HTTPConstants.PROTOCOL_HTTPS.equalsIgnoreCase(prot)) {
            return HTTPConstants.DEFAULT_HTTPS_PORT;
        }
        if (!HTTPConstants.PROTOCOL_HTTP.equalsIgnoreCase(prot)) {
            log.warn("Unexpected protocol: " + prot);
            // TODO - should this return something else?
        }
        return HTTPConstants.DEFAULT_HTTP_PORT;
    }
    return port;
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:20,代码来源:HTTPSamplerBase.java

示例2: getPort

/**
 * Get the port; apply the default for the protocol if necessary.
 *
 * @return the port number, with default applied if required.
 */
public int getPort() {
    final int port = getPortIfSpecified();
    if (port == UNSPECIFIED_PORT) {
        String prot = getProtocol();
        if (HTTPConstants.PROTOCOL_HTTPS.equalsIgnoreCase(prot)) {
            return HTTPConstants.DEFAULT_HTTPS_PORT;
        }
        if (!HTTPConstants.PROTOCOL_HTTP.equalsIgnoreCase(prot)) {
            log.warn("Unexpected protocol: "+prot);
            // TODO - should this return something else?
        }
        return HTTPConstants.DEFAULT_HTTP_PORT;
    }
    return port;
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:20,代码来源:HTTPSamplerBase.java

示例3: isProtocolDefaultPort

/**
 * Tell whether the default port for the specified protocol is used
 *
 * @return true if the default port number for the protocol is used, false otherwise
 */
public boolean isProtocolDefaultPort() {
    final int port = getPortIfSpecified();
    final String protocol = getProtocol();
    boolean isDefaultHTTPPort = HTTPConstants.PROTOCOL_HTTP
            .equalsIgnoreCase(protocol)
            && port == HTTPConstants.DEFAULT_HTTP_PORT;
    boolean isDefaultHTTPSPort = HTTPConstants.PROTOCOL_HTTPS
            .equalsIgnoreCase(protocol)
            && port == HTTPConstants.DEFAULT_HTTPS_PORT;
    return port == UNSPECIFIED_PORT ||
            isDefaultHTTPPort ||
            isDefaultHTTPSPort;
}
 
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:18,代码来源:WebSocketAbstractSampler.java

示例4: getPort

/**
 * Get the port; apply the default for the protocol if necessary.
 *
 * @return the port number, with default applied if required.
 */
public int getPort() {
    final int port = getPortIfSpecified();
    if (port == UNSPECIFIED_PORT) {
        String prot = getProtocol();
        if (WSS_PROTOCOL.equalsIgnoreCase(prot)) {
            return HTTPConstants.DEFAULT_HTTPS_PORT;
        }
        if (!WS_PROTOCOL.equalsIgnoreCase(prot)) {
            log.warn("Unexpected protocol: " + prot);
        }
        return HTTPConstants.DEFAULT_HTTP_PORT;
    }
    return port;
}
 
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:19,代码来源:WebSocketAbstractSampler.java

示例5: getDefaultPort

/**
 * Get the port number for a URL, applying defaults if necessary.
 * (Called by CookieManager.)
 * @param protocol from {@link URL#getProtocol()}
 * @param port number from {@link URL#getPort()}
 * @return the default port for the protocol
 */
public static int getDefaultPort(String protocol, int port) {
    if (port == URL_UNSPECIFIED_PORT) {
        if (protocol.equalsIgnoreCase(HTTPConstants.PROTOCOL_HTTP)) {
            return HTTPConstants.DEFAULT_HTTP_PORT;
        } else if (protocol.equalsIgnoreCase(HTTPConstants.PROTOCOL_HTTPS)) {
            return HTTPConstants.DEFAULT_HTTPS_PORT;
        }
    }
    return port;
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:17,代码来源:HTTPSamplerBase.java

示例6: isProtocolDefaultPort

/**
 * Tell whether the default port for the specified protocol is used
 *
 * @return true if the default port number for the protocol is used, false
 * otherwise
 */
public boolean isProtocolDefaultPort() {
	final int port = Integer.parseInt(getServerPort());
	final String protocol = getProtocol();
	return ("ws".equalsIgnoreCase(protocol) && port == HTTPConstants.DEFAULT_HTTP_PORT)
			|| ("wss".equalsIgnoreCase(protocol) && port == HTTPConstants.DEFAULT_HTTPS_PORT);
}
 
开发者ID:Fyro-Ing,项目名称:JMeter-WebSocket-StompSampler,代码行数:12,代码来源:WebSocketSampler.java

示例7: isProtocolDefaultPort

/**
 * Tell whether the default port for the specified protocol is used
 *
 * @return true if the default port number for the protocol is used, false
 * otherwise
 */
public boolean isProtocolDefaultPort() {
    final int port = Integer.parseInt(getServerPort());
    final String protocol = getProtocol();
    return ("ws".equalsIgnoreCase(protocol) && port == HTTPConstants.DEFAULT_HTTP_PORT)
            || ("wss".equalsIgnoreCase(protocol) && port == HTTPConstants.DEFAULT_HTTPS_PORT);
}
 
开发者ID:maciejzaleski,项目名称:JMeter-WebSocketSampler,代码行数:12,代码来源:WebSocketSampler.java

示例8: getDefaultPort

public static int getDefaultPort(String protocol,int port){
    if (port==URL_UNSPECIFIED_PORT){
        return
                protocol.equalsIgnoreCase(HTTPConstants.PROTOCOL_HTTP)  ? HTTPConstants.DEFAULT_HTTP_PORT :
                        protocol.equalsIgnoreCase(HTTPConstants.PROTOCOL_HTTPS) ? HTTPConstants.DEFAULT_HTTPS_PORT :
                                port;
    }
    return port;
}
 
开发者ID:kawasima,项目名称:jmeter-websocket,代码行数:9,代码来源:WebSocketSampler.java

示例9: isProtocolDefaultPort

/**
 * Tell whether the default port for the specified protocol is used
 *
 * @return true if the default port number for the protocol is used, false otherwise
 */
public boolean isProtocolDefaultPort() {
    final int port = getPortIfSpecified();
    final String protocol = getProtocol();
    return port == UNSPECIFIED_PORT ||
            ("ws".equalsIgnoreCase(protocol) && port == HTTPConstants.DEFAULT_HTTP_PORT) ||
            ("wss".equalsIgnoreCase(protocol) && port == HTTPConstants.DEFAULT_HTTPS_PORT);
}
 
开发者ID:kawasima,项目名称:jmeter-websocket,代码行数:12,代码来源:WebSocketSampler.java

示例10: getPort

public int getPort() {
    final int port = getPortIfSpecified();
    if (port == UNSPECIFIED_PORT) {
        String prot = getProtocol();
        if ("wss".equalsIgnoreCase(prot)) {
            return HTTPConstants.DEFAULT_HTTPS_PORT;
        }
        if (!"ws".equalsIgnoreCase(prot)) {
            log.warn("Unexpected protocol: "+prot);
            // TODO - should this return something else?
        }
        return HTTPConstants.DEFAULT_HTTP_PORT;
    }
    return port;
}
 
开发者ID:kawasima,项目名称:jmeter-websocket,代码行数:15,代码来源:WebSocketSampler.java

示例11: getDefaultPort

/**
 * Get the port number for a URL, applying defaults if necessary.
 * (Called by CookieManager.)
 * @param protocol from {@link URL#getProtocol()}
 * @param port number from {@link URL#getPort()}
 * @return the default port for the protocol
 */
public static int getDefaultPort(String protocol,int port){
    if (port==URL_UNSPECIFIED_PORT){
        return
            protocol.equalsIgnoreCase(HTTPConstants.PROTOCOL_HTTP)  ? HTTPConstants.DEFAULT_HTTP_PORT :
            protocol.equalsIgnoreCase(HTTPConstants.PROTOCOL_HTTPS) ? HTTPConstants.DEFAULT_HTTPS_PORT :
                port;
    }
    return port;
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:16,代码来源:HTTPSamplerBase.java

示例12: isProtocolDefaultPort

/**
 * Tell whether the default port for the specified protocol is used
 *
 * @return true if the default port number for the protocol is used, false otherwise
 */
public boolean isProtocolDefaultPort() {
    final int port = getPortIfSpecified();
    final String protocol = getProtocol();
    if (port == UNSPECIFIED_PORT ||
            (HTTPConstants.PROTOCOL_HTTP.equalsIgnoreCase(protocol) && port == HTTPConstants.DEFAULT_HTTP_PORT) ||
            (HTTPConstants.PROTOCOL_HTTPS.equalsIgnoreCase(protocol) && port == HTTPConstants.DEFAULT_HTTPS_PORT)) {
        return true;
    }
    return false;
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:15,代码来源:HTTPSamplerBase.java

示例13: getAuthForURL

public Authorization getAuthForURL(URL url) {
    if (!isSupportedProtocol(url)) {
        return null;
    }

    // TODO: replace all this url2 mess with a proper method
    // "areEquivalent(url1, url2)" that
    // would also ignore case in protocol and host names, etc. -- use that
    // method in the CookieManager too.

    URL url2 = null;

    try {
        if (url.getPort() == -1) {
            // Obtain another URL with an explicit port:
            int port = url.getProtocol().equalsIgnoreCase("http") ? HTTPConstants.DEFAULT_HTTP_PORT : HTTPConstants.DEFAULT_HTTPS_PORT;
            // only http and https are supported
            url2 = new URL(url.getProtocol(), url.getHost(), port, url.getPath());
        } else if ((url.getPort() == HTTPConstants.DEFAULT_HTTP_PORT && url.getProtocol().equalsIgnoreCase("http"))
                || (url.getPort() == HTTPConstants.DEFAULT_HTTPS_PORT && url.getProtocol().equalsIgnoreCase("https"))) {
            url2 = new URL(url.getProtocol(), url.getHost(), url.getPath());
        }
    } catch (MalformedURLException e) {
        log.error("Internal error!", e); // this should never happen
        // anyway, we'll continue with url2 set to null.
    }

    String s1 = url.toString();
    String s2 = null;
    if (url2 != null) {
        s2 = url2.toString();
    }

    log.debug("Target URL strings to match against: "+s1+" and "+s2);
    // TODO should really return most specific (i.e. longest) match.
    for (JMeterProperty jMeterProperty : getAuthObjects()) {
        Authorization auth = (Authorization) jMeterProperty.getObjectValue();

        String uRL = auth.getURL();
        log.debug("Checking match against auth'n entry: "+uRL);
        if (s1.startsWith(uRL) || s2 != null && s2.startsWith(uRL)) {
            log.debug("Matched");
            return auth;
        }
        log.debug("Did not match");
    }
    return null;
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:48,代码来源:AuthManager.java

示例14: getAuthForURL

public Authorization getAuthForURL(URL url) {
    if (!isSupportedProtocol(url)) {
        return null;
    }

    // TODO: replace all this url2 mess with a proper method
    // "areEquivalent(url1, url2)" that
    // would also ignore case in protocol and host names, etc. -- use that
    // method in the CookieManager too.

    URL url2 = null;

    try {
        if (url.getPort() == -1) {
            // Obtain another URL with an explicit port:
            int port = url.getProtocol().equalsIgnoreCase("http") ? HTTPConstants.DEFAULT_HTTP_PORT : HTTPConstants.DEFAULT_HTTPS_PORT;
            // only http and https are supported
            url2 = new URL(url.getProtocol(), url.getHost(), port, url.getPath());
        } else if ((url.getPort() == HTTPConstants.DEFAULT_HTTP_PORT && url.getProtocol().equalsIgnoreCase("http"))
                || (url.getPort() == HTTPConstants.DEFAULT_HTTPS_PORT && url.getProtocol().equalsIgnoreCase("https"))) {
            url2 = new URL(url.getProtocol(), url.getHost(), url.getPath());
        }
    } catch (MalformedURLException e) {
        log.error("Internal error!", e); // this should never happen
        // anyway, we'll continue with url2 set to null.
    }

    String s1 = url.toString();
    String s2 = null;
    if (url2 != null) {
        s2 = url2.toString();
    }

        log.debug("Target URL strings to match against: "+s1+" and "+s2);
    // TODO should really return most specific (i.e. longest) match.
    for (PropertyIterator iter = getAuthObjects().iterator(); iter.hasNext();) {
        Authorization auth = (Authorization) iter.next().getObjectValue();

        String uRL = auth.getURL();
        log.debug("Checking match against auth'n entry: "+uRL);
        if (s1.startsWith(uRL) || s2 != null && s2.startsWith(uRL)) {
            log.debug("Matched");
            return auth;
        }
        log.debug("Did not match");
    }
    return null;
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:48,代码来源:AuthManager.java

示例15: isStripPort

/**
 * IE and Firefox will always strip port from the url before constructing
 * the SPN. Chrome has an option (<code>--enable-auth-negotiate-port</code>)
 * to include the port if it differs from <code>80</code> or
 * <code>443</code>. That behavior can be changed by setting the jmeter
 * property <code>kerberos.spnego.strip_port</code>.
 *
 * @param url to be checked
 * @return <code>true</code> when port should omitted in SPN
 */
private boolean isStripPort(URL url) {
    if (STRIP_PORT) {
        return true;
    }
    return (url.getPort() == HTTPConstants.DEFAULT_HTTP_PORT ||
            url.getPort() == HTTPConstants.DEFAULT_HTTPS_PORT);
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:17,代码来源:AuthManager.java


注:本文中的org.apache.jmeter.protocol.http.util.HTTPConstants.DEFAULT_HTTP_PORT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。