本文整理了Java中org.restlet.Request.setHostRef
方法的一些代码示例,展示了Request.setHostRef
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.setHostRef
方法的具体详情如下:
包路径:org.restlet.Request
类名称:Request
方法名:setHostRef
[英]Sets the host reference using an URI string. Note that when used with HTTP connectors, this property maps to the "Host" header.
[中]使用URI字符串设置主机引用。请注意,当与HTTP连接器一起使用时,此属性映射到“主机”头。
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Sets the host reference using an URI string.
*
* @param hostUri
* The host URI.
* @see Request#setHostRef(String)
*/
public void setHostRef(String hostUri) {
getRequest().setHostRef(hostUri);
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Sets the host reference.
*
* @param hostRef
* The host reference.
* @see Request#setHostRef(Reference)
*/
public void setHostRef(Reference hostRef) {
getRequest().setHostRef(hostRef);
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Sets the host reference.
*
* @param hostRef
* The host reference.
*/
@Override
public void setHostRef(Reference hostRef) {
getWrappedRequest().setHostRef(hostRef);
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Sets the host reference using an URI string.
*
* @param hostUri
* The host URI.
*/
@Override
public void setHostRef(String hostUri) {
getWrappedRequest().setHostRef(hostUri);
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Sets the host reference using an URI string. Note that when used with
* HTTP connectors, this property maps to the "Host" header.
*
* @param hostUri
* The host URI.
*/
public void setHostRef(String hostUri) {
setHostRef(new Reference(hostUri));
}
代码示例来源:origin: org.restlet.jse/org.restlet.example
/**
* Unit test for virtual hosts.
*
* @throws Exception
*/
public void testVirtualHost() throws Exception {
// Instantiate our Restlet component
MailServerComponent component = new MailServerComponent();
// Prepare a mock HTTP call
Request request = new Request();
request.setMethod(Method.GET);
request.setResourceRef("http://www.rmep.org/accounts/");
request.setHostRef("http://www.rmep.org");
Response response = new Response(request);
response.getServerInfo().setAddress("1.2.3.10");
response.getServerInfo().setPort(80);
component.handle(request, response);
// Test if response was successful
assertTrue(response.getStatus().isSuccess());
}
内容来源于网络,如有侵权,请联系作者删除!