本文整理汇总了Java中org.eclipse.jetty.client.HttpExchange.setRequestHeader方法的典型用法代码示例。如果您正苦于以下问题:Java HttpExchange.setRequestHeader方法的具体用法?Java HttpExchange.setRequestHeader怎么用?Java HttpExchange.setRequestHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jetty.client.HttpExchange
的用法示例。
在下文中一共展示了HttpExchange.setRequestHeader方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: postContents
import org.eclipse.jetty.client.HttpExchange; //导入方法依赖的package包/类
private static void postContents(HttpExchange httpConn, byte[] request) throws IOException {
httpConn.setRequestContentType("application/json");
httpConn.setRequestHeader("Accept", "application/json");
httpConn.setRequestHeader("Referer", "https://somewhere.com");
httpConn.setRequestContentSource(new ByteArrayInputStream(request));
}
示例2: postContents
import org.eclipse.jetty.client.HttpExchange; //导入方法依赖的package包/类
private static void postContents(HttpExchange httpConn, byte[] request) throws IOException {
httpConn.setRequestContentType("application/json");
httpConn.setRequestHeader("Accept", "application/json");
httpConn.setRequestContentSource(new ByteArrayInputStream(request));
}
示例3: customizeExchange
import org.eclipse.jetty.client.HttpExchange; //导入方法依赖的package包/类
@Override
protected void customizeExchange(HttpExchange exchange, HttpServletRequest request) {
exchange.setRequestHeader("Authorization", _basicAuth);
}