本文整理了Java中org.eclipse.jetty.client.api.Request.getMethod
方法的一些代码示例,展示了Request.getMethod
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.getMethod
方法的具体详情如下:
包路径:org.eclipse.jetty.client.api.Request
类名称:Request
方法名:getMethod
暂无
代码示例来源:origin: spring-projects/spring-framework
@Override
public HttpMethod getMethod() {
HttpMethod method = HttpMethod.resolve(this.jettyRequest.getMethod());
Assert.state(method != null, "Method must not be null");
return method;
}
代码示例来源:origin: org.springframework/spring-web
@Override
public HttpMethod getMethod() {
HttpMethod method = HttpMethod.resolve(this.jettyRequest.getMethod());
Assert.state(method != null, "Method must not be null");
return method;
}
代码示例来源:origin: census-instrumentation/opencensus-java
@Override
public String getMethod(Request request) {
return request.getMethod();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-web
@Override
public HttpMethod getMethod() {
HttpMethod method = HttpMethod.resolve(this.jettyRequest.getMethod());
Assert.state(method != null, "Method must not be null");
return method;
}
代码示例来源:origin: apache/servicemix-bundles
@Override
public HttpMethod getMethod() {
HttpMethod method = HttpMethod.resolve(this.jettyRequest.getMethod());
Assert.state(method != null, "Method must not be null");
return method;
}
代码示例来源:origin: org.eclipse.jetty/jetty-client
String path = request.getPath();
String uri = (query == null) ? path : path + "?" + query;
String A2 = request.getMethod() + ":" + uri;
if ("auth-int".equals(qop))
A2 += ":" + toHexString(digester.digest(content));
代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9
String hashA1 = toHexString(digester.digest(A1.getBytes(charset)));
String A2 = request.getMethod().asString() + ":" + request.getURI();
if ("auth-int".equals(qop))
A2 += ":" + toHexString(digester.digest(content));
代码示例来源:origin: org.eclipse.jetty/jetty-client
HttpFields headers = response.getHeaders();
long length = headers.getLongField(HttpHeader.CONTENT_LENGTH.asString());
if (HttpMethod.HEAD.is(request.getMethod()))
length = 0;
if (length > maxLength)
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
String hashA1 = toHexString(digester.digest(A1.getBytes(charset)));
String A2 = request.getMethod().asString() + ":" + request.getURI();
if ("auth-int".equals(qop))
A2 += ":" + toHexString(digester.digest(content));
代码示例来源:origin: io.digdag/digdag-standards
private String requestStatus(Request request, Response r, boolean uriIsSecret)
{
String safeUri = safeUri(request, uriIsSecret);
return request.getMethod() + " " + safeUri + ": " + r.getStatus() + " " + HttpStatus.getMessage(r.getStatus());
}
代码示例来源:origin: io.digdag/digdag-standards
logger.info("Sending HTTP request: {} {}", req.getMethod(), safeUri);
ContentResponse res;
try {
logger.warn("Exception without response: {} {}", req.getMethod(), safeUri);
if (retry) {
throw e;
logger.info("Received HTTP response: {} {}: {}", req.getMethod(), safeUri, res);
代码示例来源:origin: airlift/airlift
String method = request.getMethod();
if (method != null) {
method = method.toUpperCase(Locale.US);
代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9
if (request.getMethod() == HttpMethod.GET || request.getMethod() == HttpMethod.HEAD)
redirect(result, request.getMethod(), newURI);
else
fail(result, new HttpResponseException("HTTP protocol violation: received 301 for non GET or HEAD request", response));
redirect(result, request.getMethod(), newURI);
break;
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
if (request.getMethod() == HttpMethod.GET || request.getMethod() == HttpMethod.HEAD)
redirect(result, request.getMethod(), newURI);
else
fail(result, new HttpResponseException("HTTP protocol violation: received 301 for non GET or HEAD request", response));
redirect(result, request.getMethod(), newURI);
break;
代码示例来源:origin: census-instrumentation/opencensus-java
@Test
public void testExtraction() {
HttpFields fields = new HttpFields();
fields.add(new HttpField("User-Agent", "Test 1.0"));
Request request = mock(Request.class);
Response response = mock(Response.class);
OcJettyHttpClientExtractor extractor = new OcJettyHttpClientExtractor();
when(request.getHost()).thenReturn("localhost");
when(request.getMethod()).thenReturn("GET");
when(request.getHeaders()).thenReturn(fields);
when(request.getPath()).thenReturn("/test");
when(request.getURI()).thenReturn(uri);
when(response.getStatus()).thenReturn(0);
assertThat(extractor.getHost(request)).contains("localhost");
assertThat(extractor.getMethod(request)).contains("GET");
assertThat(extractor.getPath(request)).contains("/test");
assertThat(extractor.getUrl(request)).contains(URI_STR);
assertThat(extractor.getRoute(request)).contains("");
assertThat(extractor.getUserAgent(request)).contains("Test 1.0");
assertThat(extractor.getStatusCode(response)).isEqualTo(0);
}
}
代码示例来源:origin: org.eclipse.jetty/jetty-client
String method = request.getMethod();
if (HttpMethod.GET.is(method) || HttpMethod.HEAD.is(method) || HttpMethod.PUT.is(method))
return redirect(request, response, listener, newURI, method);
String method = request.getMethod();
if (HttpMethod.HEAD.is(method) || HttpMethod.PUT.is(method))
return redirect(request, response, listener, newURI, method);
String method = request.getMethod();
if (HttpMethod.HEAD.is(method))
return redirect(request, response, listener, newURI, method);
return redirect(request, response, listener, newURI, request.getMethod());
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
protected Request copyRequest(Request oldRequest, URI newURI)
{
Request newRequest = new HttpRequest(this, oldRequest.getConversationID(), newURI);
newRequest.method(oldRequest.getMethod())
.version(oldRequest.getVersion())
.content(oldRequest.getContent());
for (HttpField header : oldRequest.getHeaders())
{
// We have a new URI, so skip the host header if present
if (HttpHeader.HOST == header.getHeader())
continue;
// Remove expectation headers
if (HttpHeader.EXPECT == header.getHeader())
continue;
// Remove cookies
if (HttpHeader.COOKIE == header.getHeader())
continue;
// Remove authorization headers
if (HttpHeader.AUTHORIZATION == header.getHeader() ||
HttpHeader.PROXY_AUTHORIZATION == header.getHeader())
continue;
newRequest.header(header.getName(), header.getValue());
}
return newRequest;
}
代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9
protected Request copyRequest(Request oldRequest, URI newURI)
{
Request newRequest = new HttpRequest(this, oldRequest.getConversationID(), newURI);
newRequest.method(oldRequest.getMethod())
.version(oldRequest.getVersion())
.content(oldRequest.getContent());
for (HttpField header : oldRequest.getHeaders())
{
// We have a new URI, so skip the host header if present
if (HttpHeader.HOST == header.getHeader())
continue;
// Remove expectation headers
if (HttpHeader.EXPECT == header.getHeader())
continue;
// Remove cookies
if (HttpHeader.COOKIE == header.getHeader())
continue;
// Remove authorization headers
if (HttpHeader.AUTHORIZATION == header.getHeader() ||
HttpHeader.PROXY_AUTHORIZATION == header.getHeader())
continue;
newRequest.header(header.getName(), header.getValue());
}
return newRequest;
}
代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9
@Override
public boolean startResponse(HttpVersion version, int status, String reason)
{
if (updateState(State.IDLE, State.RECEIVE))
{
HttpExchange exchange = connection.getExchange();
// The exchange may be null if it failed concurrently
if (exchange != null)
{
HttpConversation conversation = exchange.getConversation();
HttpResponse response = exchange.getResponse();
parser.setHeadResponse(exchange.getRequest().getMethod() == HttpMethod.HEAD);
response.version(version).status(status).reason(reason);
// Probe the protocol handlers
HttpClient client = connection.getHttpClient();
ProtocolHandler protocolHandler = client.findProtocolHandler(exchange.getRequest(), response);
Response.Listener handlerListener = null;
if (protocolHandler != null)
{
handlerListener = protocolHandler.getResponseListener();
LOG.debug("Found protocol handler {}", protocolHandler);
}
exchange.getConversation().updateResponseListeners(handlerListener);
LOG.debug("Receiving {}", response);
ResponseNotifier notifier = connection.getDestination().getResponseNotifier();
notifier.notifyBegin(conversation.getResponseListeners(), response);
}
}
return false;
}
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
@Override
public boolean startResponse(HttpVersion version, int status, String reason)
{
if (updateState(State.IDLE, State.RECEIVE))
{
HttpExchange exchange = connection.getExchange();
// The exchange may be null if it failed concurrently
if (exchange != null)
{
HttpConversation conversation = exchange.getConversation();
HttpResponse response = exchange.getResponse();
parser.setHeadResponse(exchange.getRequest().getMethod() == HttpMethod.HEAD);
response.version(version).status(status).reason(reason);
// Probe the protocol handlers
HttpClient client = connection.getHttpClient();
ProtocolHandler protocolHandler = client.findProtocolHandler(exchange.getRequest(), response);
Response.Listener handlerListener = null;
if (protocolHandler != null)
{
handlerListener = protocolHandler.getResponseListener();
LOG.debug("Found protocol handler {}", protocolHandler);
}
exchange.getConversation().updateResponseListeners(handlerListener);
LOG.debug("Receiving {}", response);
ResponseNotifier notifier = connection.getDestination().getResponseNotifier();
notifier.notifyBegin(conversation.getResponseListeners(), response);
}
}
return false;
}
内容来源于网络,如有侵权,请联系作者删除!