本文整理了Java中org.simpleframework.http.Address.getDomain()
方法的一些代码示例,展示了Address.getDomain()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Address.getDomain()
方法的具体详情如下:
包路径:org.simpleframework.http.Address
类名称:Address
方法名:getDomain
[英]This is used to retrieve the domain of this URI. The domain part in the URI is an optional part, an example http://domain/path?querypart
. This will return the value of the domain part. If there is no domain part then this will return null otherwise the domain value found in the uniform resource identifier.
[中]这用于检索此URI的域。URI中的域部分是可选部分,例如http://domain/path?querypart
。这将返回域部件的值。如果没有域部分,则将返回null,否则将返回在统一资源标识符中找到的域值。
代码示例来源:origin: jersey/jersey
private URI getBaseUri(final Request request) {
try {
final String hostHeader = request.getValue("Host");
if (hostHeader != null) {
final String scheme = request.isSecure() ? "https" : "http";
return new URI(scheme + "://" + hostHeader + "/");
} else {
final Address address = request.getAddress();
return new URI(address.getScheme(), null, address.getDomain(), address.getPort(), "/", null,
null);
}
} catch (final URISyntaxException ex) {
throw new IllegalArgumentException(ex);
}
}
代码示例来源:origin: com.sun.jersey.contribs/jersey-simple-server
private URI getBaseUri(Request request) {
try {
final Address address = request.getAddress();
return new URI(
address.getScheme(),
null,
address.getDomain(),
address.getPort(),
"/",
null, null);
} catch (URISyntaxException ex) {
throw new IllegalArgumentException(ex);
}
}
代码示例来源:origin: org.glassfish.jersey.containers/jersey-container-simple-http
private URI getBaseUri(final Request request) {
try {
final String hostHeader = request.getValue("Host");
if (hostHeader != null) {
final String scheme = request.isSecure() ? "https" : "http";
return new URI(scheme + "://" + hostHeader + "/");
} else {
final Address address = request.getAddress();
return new URI(address.getScheme(), null, address.getDomain(), address.getPort(), "/", null,
null);
}
} catch (final URISyntaxException ex) {
throw new IllegalArgumentException(ex);
}
}
代码示例来源:origin: miltonio/milton2
Address a = baseRequest.getAddress();
if (host == null) {
host = a.getDomain();
代码示例来源:origin: kristofa/mock-http-server
public static FullHttpRequest convert(final Request request) {
byte[] data = null;
try {
final InputStream inputStream = request.getInputStream();
try {
data = IOUtils.toByteArray(inputStream);
} finally {
inputStream.close();
}
} catch (final IOException e) {
LOGGER.error("IOException when getting request content.", e);
}
final FullHttpRequestImpl httpRequest = new FullHttpRequestImpl();
httpRequest.domain(request.getAddress().getDomain());
httpRequest.port(request.getAddress().getPort());
httpRequest.method(Method.valueOf(request.getMethod()));
httpRequest.path(request.getPath().getPath());
if (data.length > 0) {
httpRequest.content(data);
}
for (final String headerField : request.getNames()) {
for (final String headerFieldValue : request.getValues(headerField)) {
httpRequest.httpMessageHeader(headerField, headerFieldValue);
}
}
for (final Entry<String, String> entry : request.getQuery().entrySet()) {
httpRequest.queryParameter(entry.getKey(), entry.getValue());
}
return httpRequest;
}
内容来源于网络,如有侵权,请联系作者删除!