本文整理了Java中org.apache.hc.core5.http.HttpRequest.getScheme()
方法的一些代码示例,展示了HttpRequest.getScheme()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpRequest.getScheme()
方法的具体详情如下:
包路径:org.apache.hc.core5.http.HttpRequest
类名称:HttpRequest
方法名:getScheme
[英]Returns scheme of this request message.
[中]返回此请求消息的方案。
代码示例来源:origin: apache/httpcomponents-client
final URIAuthority authority = request.getAuthority();
if (authority != null) {
final String scheme = request.getScheme();
buf.append(scheme != null ? scheme : URIScheme.HTTP.id).append("://");
buf.append(authority.getHostName());
代码示例来源:origin: org.apache.httpcomponents.core5/httpcore5
@Override
public String getScheme() {
return message.getScheme();
}
代码示例来源:origin: apache/httpcomponents-core
@Override
public String getScheme() {
return message.getScheme();
}
代码示例来源:origin: apache/httpcomponents-client
final String scheme = request.getScheme();
final HttpHost target = authority != null ? new HttpHost(scheme, authority) : route.getTargetHost();
final String via = generateViaHeader(request);
代码示例来源:origin: org.apache.httpcomponents.client5/httpclient5
public static HttpHost determineHost(final HttpRequest request) throws HttpException {
if (request == null) {
return null;
}
final URIAuthority authority = request.getAuthority();
if (authority != null) {
final String scheme = request.getScheme();
if (scheme == null) {
throw new ProtocolException("Protocol scheme is not specified");
}
return new HttpHost(scheme, authority);
}
return null;
}
代码示例来源:origin: org.apache.httpcomponents.client5/httpclient5-cache
final URIAuthority authority = request.getAuthority();
if (authority != null) {
final String scheme = request.getScheme();
buf.append(scheme != null ? scheme : URIScheme.HTTP.id).append("://");
buf.append(authority.getHostName());
代码示例来源:origin: org.apache.httpcomponents.client5/httpclient5
@Override
public HttpRequest copy(final HttpRequest original) {
if (original == null) {
return null;
}
final BasicHttpRequest copy = new BasicHttpRequest(original.getMethod(), original.getPath());
copy.setVersion(original.getVersion());
for (final Iterator<Header> it = original.headerIterator(); it.hasNext(); ) {
copy.addHeader(it.next());
}
copy.setScheme(original.getScheme());
copy.setAuthority(original.getAuthority());
return copy;
}
代码示例来源:origin: org.apache.httpcomponents.client5/httpclient5
public static SimpleHttpRequest copy(final HttpRequest original) {
Args.notNull(original, "HTTP request");
final SimpleHttpRequest copy = new SimpleHttpRequest(original.getMethod(), original.getRequestUri());
copy.setVersion(original.getVersion());
for (final Iterator<Header> it = original.headerIterator(); it.hasNext(); ) {
copy.addHeader(it.next());
}
copy.setScheme(original.getScheme());
copy.setAuthority(original.getAuthority());
return copy;
}
代码示例来源:origin: apache/httpcomponents-core
if (TextUtils.isBlank(message.getScheme())) {
throw new ProtocolException("Request scheme is not set");
headers.add(new BasicHeader(H2PseudoRequestHeaders.AUTHORITY, message.getAuthority(), false));
} else {
headers.add(new BasicHeader(H2PseudoRequestHeaders.SCHEME, message.getScheme(), false));
if (message.getAuthority() != null) {
headers.add(new BasicHeader(H2PseudoRequestHeaders.AUTHORITY, message.getAuthority(), false));
代码示例来源:origin: apache/httpcomponents-core
final HttpRequest request,
final EntityDetails entityDetails, final HttpContext httpContext) throws HttpException, IOException {
final String scheme = request.getScheme();
final URIAuthority authority = request.getAuthority();
if (authority == null) {
代码示例来源:origin: apache/httpcomponents-core
final HttpRequest request,
final EntityDetails entityDetails, final HttpContext requestContext) throws HttpException, IOException {
final String scheme = request.getScheme();
final URIAuthority authority = request.getAuthority();
if (authority == null) {
代码示例来源:origin: org.apache.httpcomponents.core5/httpcore5
final HttpRequest request,
final EntityDetails entityDetails, final HttpContext requestContext) throws HttpException, IOException {
final String scheme = request.getScheme();
final URIAuthority authority = request.getAuthority();
if (authority == null) {
代码示例来源:origin: org.apache.httpcomponents.client5/httpclient5
final CredentialsProvider credsProvider = clientContext.getCredentialsProvider();
if (credsProvider instanceof CredentialsStore) {
AuthSupport.extractFromAuthority(request.getScheme(), authority, (CredentialsStore) credsProvider);
代码示例来源:origin: apache/httpcomponents-core
@Test
public void testRequestWithUserInfo() throws Exception {
final HttpRequest request = new BasicHttpRequest("GET", new URI("https://user:pwd@host:9443/stuff?param=value"));
Assert.assertEquals("GET", request.getMethod());
Assert.assertEquals("/stuff?param=value", request.getPath());
Assert.assertEquals(new URIAuthority("user:pwd", "host", 9443), request.getAuthority());
Assert.assertEquals("https", request.getScheme());
Assert.assertEquals(new URI("https://host:9443/stuff?param=value"), request.getUri());
}
代码示例来源:origin: org.apache.httpcomponents.client5/httpclient5
if (authority != null) {
target = new HttpHost(
request.getScheme(),
authority.getHostName(),
authority.getPort() >= 0 ? authority.getPort() : route.getTargetHost().getPort());
代码示例来源:origin: org.apache.httpcomponents.client5/httpclient5
public static HttpHost resolveAuthTarget(final HttpRequest request, final HttpRoute route) {
Args.notNull(request, "Request");
Args.notNull(route, "Route");
final URIAuthority authority = request.getAuthority();
final String scheme = request.getScheme();
final HttpHost target = authority != null ? new HttpHost(scheme, authority) : route.getTargetHost();
if (target.getPort() < 0) {
return new HttpHost(
target.getSchemeName(),
target.getHostName(),
route.getTargetHost().getPort());
}
return target;
}
代码示例来源:origin: apache/httpcomponents-core
@Test
public void testRequestWithAbsoluteURI() throws Exception {
final HttpRequest request = new BasicHttpRequest("GET", new URI("https://host:9443/stuff?param=value"));
Assert.assertEquals("GET", request.getMethod());
Assert.assertEquals("/stuff?param=value", request.getPath());
Assert.assertEquals(new URIAuthority("host", 9443), request.getAuthority());
Assert.assertEquals("https", request.getScheme());
Assert.assertEquals(new URI("https://host:9443/stuff?param=value"), request.getUri());
}
代码示例来源:origin: apache/httpcomponents-core
@Test
public void testRequestWithNoPath() throws Exception {
final HttpRequest request = new BasicHttpRequest("GET", new URI("http://host"));
Assert.assertEquals("GET", request.getMethod());
Assert.assertEquals("/", request.getPath());
Assert.assertEquals(new URIAuthority("host"), request.getAuthority());
Assert.assertEquals("http", request.getScheme());
Assert.assertEquals(new URI("http://host/"), request.getUri());
}
代码示例来源:origin: apache/httpcomponents-core
@Test
public void testRequestWithAbsoluteURIAsPath() throws Exception {
final HttpRequest request = new BasicHttpRequest("GET", "https://host:9443/stuff?param=value");
Assert.assertEquals("GET", request.getMethod());
Assert.assertEquals("/stuff?param=value", request.getPath());
Assert.assertEquals(new URIAuthority("host", 9443), request.getAuthority());
Assert.assertEquals("https", request.getScheme());
Assert.assertEquals(new URI("https://host:9443/stuff?param=value"), request.getUri());
}
代码示例来源:origin: org.apache.httpcomponents.client5/httpclient5-cache
final String scheme = request.getScheme();
final HttpHost target = authority != null ? new HttpHost(scheme, authority) : route.getTargetHost();
final String via = generateViaHeader(request);
内容来源于网络,如有侵权,请联系作者删除!