本文整理汇总了Java中org.eclipse.jetty.client.HttpRequest类的典型用法代码示例。如果您正苦于以下问题:Java HttpRequest类的具体用法?Java HttpRequest怎么用?Java HttpRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HttpRequest类属于org.eclipse.jetty.client包,在下文中一共展示了HttpRequest类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: beforeMethod
import org.eclipse.jetty.client.HttpRequest; //导入依赖的package包/类
@Override
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
MethodInterceptResult result) throws Throwable {
HttpRequest request = (HttpRequest)objInst;
ContextCarrier contextCarrier = new ContextCarrier();
AbstractSpan span = ContextManager.createExitSpan(request.getURI().getPath(), contextCarrier, request.getHost() + ":" + request.getPort());
span.setComponent(ComponentsDefine.JETTY_CLIENT);
Tags.HTTP.METHOD.set(span, getHttpMethod(request));
Tags.URL.set(span, request.getURI().toString());
SpanLayer.asHttp(span);
CarrierItem next = contextCarrier.items();
HttpFields field = request.getHeaders();
while (next.hasNext()) {
next = next.next();
field.add(next.getHeadKey(), next.getHeadValue());
}
}
开发者ID:apache,项目名称:incubator-skywalking,代码行数:20,代码来源:SyncHttpRequestSendInterceptor.java
示例2: JettyClientCall
import org.eclipse.jetty.client.HttpRequest; //导入依赖的package包/类
/**
* Constructor.
*
* @param helper
* The parent HTTP client helper.
* @param method
* The method name.
* @param requestUri
* The request URI.
* @throws IOException
* In case of an I/O error
*/
public JettyClientCall( JettyHttpClientHelper helper, final String method, final String requestUri ) throws IOException
{
super( helper, method, requestUri );
clientHelper = helper;
if( requestUri.startsWith( "http:" ) || requestUri.startsWith( "https:" ) )
{
httpRequest = (HttpRequest) helper.getHttpClient().newRequest( requestUri );
httpRequest.method( method );
setConfidential( httpRequest.getURI().getScheme().equalsIgnoreCase( Protocol.HTTPS.getSchemeName() ) );
}
else
{
throw new IllegalArgumentException( "Only HTTP or HTTPS resource URIs are allowed here" );
}
}
开发者ID:tliron,项目名称:restlet-jetty9,代码行数:30,代码来源:JettyClientCall.java
示例3: newHttpRequest
import org.eclipse.jetty.client.HttpRequest; //导入依赖的package包/类
@Override
protected HttpRequest newHttpRequest(HttpConversation conversation, URI uri) {
final HttpRequest req = super.newHttpRequest(conversation, uri);
final InstrumentedListener listener = new InstrumentedListener(metricRegistry, nameStrategy);
req.listener(listener);
req.onResponseBegin((response) -> listener.onResponseBegin());
req.onResponseSuccess((result) -> listener.onResponseComplete(null, result));
req.onResponseFailure((x, exn) -> listener.onResponseComplete(exn, x));
return req;
}
开发者ID:arteam,项目名称:dropwizard-http2-client,代码行数:11,代码来源:InstrumentedHttpClient.java
示例4: getHttpMethod
import org.eclipse.jetty.client.HttpRequest; //导入依赖的package包/类
public String getHttpMethod(HttpRequest request) {
String method = request.getMethod();
if (method == null || method.length() == 0) {
method = "GET";
}
return method;
}
开发者ID:apache,项目名称:incubator-skywalking,代码行数:10,代码来源:SyncHttpRequestSendInterceptor.java
示例5: getHttpMethod
import org.eclipse.jetty.client.HttpRequest; //导入依赖的package包/类
public String getHttpMethod(HttpRequest request) {
HttpMethod httpMethod = HttpMethod.GET;
/**
* The method is null if the client using GET method.
*
* @see org.eclipse.jetty.client.HttpRequest#GET(String uri)
* @see org.eclipse.jetty.client.HttpRequest( org.eclipse.jetty.client.HttpClient client, long conversation, java.net.URI uri)
*/
if (request.getMethod() != null) {
httpMethod = request.getMethod();
}
return httpMethod.name();
}
开发者ID:apache,项目名称:incubator-skywalking,代码行数:16,代码来源:SyncHttpRequestSendInterceptor.java
示例6: fixQueryString
import org.eclipse.jetty.client.HttpRequest; //导入依赖的package包/类
/**
* <p>
* ライブラリのバグを修正します<br>
* URLにマルチバイト文字が含まれている場合にURLが正しく組み立てられないバグを修正します
* </p>
*/
private static void fixQueryString(Request proxyRequest, String queryString) {
if (!StringUtils.isEmpty(queryString)) {
if (proxyRequest instanceof HttpRequest) {
try {
QUERY_FIELD.set(proxyRequest, queryString);
} catch (IllegalArgumentException | IllegalAccessException e) {
throw new RuntimeException(e);
}
}
}
}
开发者ID:kyuntx,项目名称:logbookpn,代码行数:18,代码来源:ReverseProxyServlet.java
示例7: newHttpRequest
import org.eclipse.jetty.client.HttpRequest; //导入依赖的package包/类
@Override
public HttpRequest newHttpRequest(HttpConversation conversation, URI uri) {
final SalesforceHttpRequest request = new SalesforceHttpRequest(this, conversation, uri);
request.timeout(timeout, TimeUnit.MILLISECONDS);
return request;
}
开发者ID:HydAu,项目名称:Camel,代码行数:7,代码来源:SalesforceHttpClient.java
示例8: copyRequest
import org.eclipse.jetty.client.HttpRequest; //导入依赖的package包/类
@Override
public Request copyRequest(HttpRequest oldRequest, URI newURI) {
return super.copyRequest(oldRequest, newURI);
}
开发者ID:HydAu,项目名称:Camel,代码行数:5,代码来源:SalesforceHttpClient.java
示例9: getHttpRequest
import org.eclipse.jetty.client.HttpRequest; //导入依赖的package包/类
/**
* Returns the HTTP request.
*
* @return The HTTP request.
*/
public HttpRequest getHttpRequest()
{
return httpRequest;
}
开发者ID:tliron,项目名称:restlet-jetty9,代码行数:10,代码来源:JettyClientCall.java
注:本文中的org.eclipse.jetty.client.HttpRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论