本文整理了Java中org.apache.commons.httpclient.URI.getScheme()
方法的一些代码示例,展示了URI.getScheme()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。URI.getScheme()
方法的具体详情如下:
包路径:org.apache.commons.httpclient.URI
类名称:URI
方法名:getScheme
[英]Get the scheme.
[中]得到这个计划。
代码示例来源:origin: commons-httpclient/commons-httpclient
/**
* URI constructor for HttpHost.
*
* @param uri the URI.
*/
public HttpHost(final URI uri) throws URIException {
this(uri.getHost(), uri.getPort(), Protocol.getProtocol(uri.getScheme()));
}
代码示例来源:origin: commons-httpclient/commons-httpclient
/**
* Sets the protocol, host and port from the given URI.
* @param uri the URI.
*/
public synchronized void setHost(final URI uri) {
try {
setHost(uri.getHost(), uri.getPort(), uri.getScheme());
} catch (URIException e) {
throw new IllegalArgumentException(e.toString());
}
}
代码示例来源:origin: org.zaproxy/zap
public static String getHostName(URI uri) throws URIException {
StringBuilder host = new StringBuilder();
String scheme = uri.getScheme().toLowerCase();
host.append(scheme).append("://").append(uri.getHost());
int port = uri.getPort();
if (port != -1 &&
((port == 80 && !"http".equals(scheme)) ||
(port == 443 && !"https".equals(scheme) ||
(port != 80 && port != 443)))) {
host.append(":").append(port);
}
return host.toString();
}
代码示例来源:origin: org.zaproxy/zap
private static String createBaseUri(org.apache.commons.httpclient.URI uri) throws URIException {
StringBuilder baseUriBuilder = new StringBuilder();
baseUriBuilder.append(uri.getScheme()).append("://").append(uri.getHost());
if (uri.getPort() != -1) {
baseUriBuilder.append(':').append(uri.getPort());
}
return baseUriBuilder.toString();
}
代码示例来源:origin: org.zaproxy/zap
private String getHostName(URI uri) throws URIException {
StringBuilder host = new StringBuilder();
String scheme = uri.getScheme();
if (scheme == null) {
scheme = "http";
} else {
scheme = scheme.toLowerCase();
}
host.append(scheme).append("://").append(uri.getHost());
int port = uri.getPort();
if (port != -1 &&
((port == 80 && !"http".equals(scheme)) ||
(port == 443 && !"https".equals(scheme) ||
(port != 80 && port != 443)))) {
host.append(":").append(port);
}
return host.toString();
}
代码示例来源:origin: org.zaproxy/zap
/**
* Sets the URI of this request header.
*
* @param uri the new request URI
* @throws URIException if an error occurred while setting the request URI
*/
public void setURI(URI uri) throws URIException {
if (uri.getScheme() == null || uri.getScheme().equals("")) {
mUri = new URI(HTTP + "://" + getHeader(HOST) + "/" + mUri.toString(), true);
} else {
mUri = uri;
}
if (uri.getScheme().equalsIgnoreCase(HTTPS)) {
mIsSecure = true;
} else {
mIsSecure = false;
}
setHostPort(mUri.getPort());
}
代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.httpclient
/**
* Sets the protocol, host and port from the given URI.
* @param uri the URI.
*/
public synchronized void setHost(final URI uri) {
try {
setHost(uri.getHost(), uri.getPort(), uri.getScheme());
} catch (URIException e) {
throw new IllegalArgumentException(e.toString());
}
}
代码示例来源:origin: org.apache.commons/httpclient
/**
* Sets the protocol, host and port from the given URI.
* @param uri the URI.
*/
public synchronized void setHost(final URI uri) {
try {
setHost(uri.getHost(), uri.getPort(), uri.getScheme());
} catch (URIException e) {
throw new IllegalArgumentException(e.toString());
}
}
代码示例来源:origin: org.wso2.commons-httpclient/commons-httpclient
/**
* Sets the protocol, host and port from the given URI.
* @param uri the URI.
*/
public synchronized void setHost(final URI uri) {
try {
setHost(uri.getHost(), uri.getPort(), uri.getScheme());
} catch (URIException e) {
throw new IllegalArgumentException(e.toString());
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient
/**
* URI constructor for HttpHost.
*
* @param uri the URI.
*/
public HttpHost(final URI uri) throws URIException {
this(uri.getHost(), uri.getPort(), Protocol.getProtocol(uri.getScheme()));
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient
/**
* Sets the protocol, host and port from the given URI.
* @param uri the URI.
*/
public synchronized void setHost(final URI uri) {
try {
setHost(uri.getHost(), uri.getPort(), uri.getScheme());
} catch (URIException e) {
throw new IllegalArgumentException(e.toString());
}
}
代码示例来源:origin: org.wso2.commons-httpclient/commons-httpclient
/**
* URI constructor for HttpHost.
*
* @param uri the URI.
*/
public HttpHost(final URI uri) throws URIException {
this(uri.getHost(), uri.getPort(), Protocol.getProtocol(uri.getScheme()));
}
代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.httpclient
/**
* URI constructor for HttpHost.
*
* @param uri the URI.
*/
public HttpHost(final URI uri) throws URIException {
this(uri.getHost(), uri.getPort(), Protocol.getProtocol(uri.getScheme()));
}
代码示例来源:origin: org.alfresco/alfresco-core
@SuppressWarnings("unused")
public synchronized void setHost(URI uri)
{
try {
setHost(uri.getHost(), uri.getPort(), uri.getScheme());
} catch(URIException e) {
throw new IllegalArgumentException(e.toString());
}
}
}
代码示例来源:origin: org.apache.commons/httpclient
/**
* URI constructor for HttpHost.
*
* @param uri the URI.
*/
public HttpHost(final URI uri) throws URIException {
this(uri.getHost(), uri.getPort(), Protocol.getProtocol(uri.getScheme()));
}
代码示例来源:origin: mguessan/davmail
protected void fixClientHost(HttpMethod method) {
try {
// update client host, workaround for Exchange 2003 mailbox with an Exchange 2007 frontend
URI currentUri = method.getURI();
if (currentUri != null && currentUri.getHost() != null && currentUri.getScheme() != null) {
httpClient.getHostConfiguration().setHost(currentUri.getHost(), currentUri.getPort(), currentUri.getScheme());
}
} catch (URIException e) {
LOGGER.warn("Unable to update http client host:" + e.getMessage(), e);
}
}
代码示例来源:origin: deas/alfresco
@SuppressWarnings("unused")
public synchronized void setHost(URI uri)
{
try {
setHost(uri.getHost(), uri.getPort(), uri.getScheme());
} catch(URIException e) {
throw new IllegalArgumentException(e.toString());
}
}
}
代码示例来源:origin: org.zaproxy/zap
/**
* Adds a file seed, with the given file name, at the root of the base URI.
* <p>
* For example, with base URI as {@code http://example.com/some/path/file.html} and file name as {@code sitemap.xml} it's
* added the seed {@code http://example.com/sitemap.xml}.
*
* @param baseUri the base URI.
* @param fileName the file name.
*/
private void addRootFileSeed(URI baseUri, String fileName) {
String seed = buildUri(baseUri.getScheme(), baseUri.getRawHost(), baseUri.getPort(), "/" + fileName);
try {
this.seedList.add(new URI(seed, true));
} catch (Exception e) {
log.warn("Error while creating [" + fileName + "] seed: " + seed, e);
}
}
代码示例来源:origin: org.zaproxy/zap
/**
* Sets whether or not the request is done using a secure scheme, HTTPS.
*
* @param isSecure {@code true} if the request should be secure, {@code false} otherwise
* @throws URIException if an error occurred while rebuilding the request URI
*/
public void setSecure(boolean isSecure) throws URIException {
mIsSecure = isSecure;
if (mUri == null) {
// mUri not yet set
return;
}
URI newUri = mUri;
// check if URI consistent
if (isSecure() && mUri.getScheme().equalsIgnoreCase(HTTP)) {
newUri = new URI(mUri.toString().replaceFirst(HTTP, HTTPS), true);
} else if (!isSecure() && mUri.getScheme().equalsIgnoreCase(HTTPS)) {
newUri = new URI(mUri.toString().replaceFirst(HTTPS, HTTP), true);
}
if (newUri != mUri) {
mUri = newUri;
setHostPort(mUri.getPort());
}
}
代码示例来源:origin: org.mule.transports/mule-transport-http
@Override
public synchronized void setHost(URI uri)
{
try
{
Protocol original = getProtocol();
if (uri.getScheme().equals(original.getScheme()))
{
Protocol newProtocol = new Protocol(uri.getScheme(), original.getSocketFactory(),
original.getDefaultPort());
super.setHost(uri.getHost(), uri.getPort(), newProtocol);
}
else
{
Protocol protoByName = Protocol.getProtocol(uri.getScheme());
super.setHost(uri.getHost(), uri.getPort(), protoByName);
}
}
catch (URIException uriException)
{
throw new IllegalArgumentException(uriException);
}
}
内容来源于网络,如有侵权,请联系作者删除!