List of usage examples for org.apache.http.client.methods HttpOptions METHOD_NAME
String METHOD_NAME
To view the source code for org.apache.http.client.methods HttpOptions METHOD_NAME.
Click Source Link
From source file:org.fcrepo.integration.http.api.FedoraLdpIT.java
License:asdf
private static void assertResourceOptionsHeaders(final HttpResponse httpResponse) { final List<String> methods = headerValues(httpResponse, "Allow"); assertTrue("Should allow GET", methods.contains(HttpGet.METHOD_NAME)); assertTrue("Should allow PUT", methods.contains(HttpPut.METHOD_NAME)); assertTrue("Should allow DELETE", methods.contains(HttpDelete.METHOD_NAME)); assertTrue("Should allow OPTIONS", methods.contains(HttpOptions.METHOD_NAME)); }
From source file:org.elasticsearch.client.RestClient.java
private static HttpRequestBase createHttpRequest(String method, URI uri, HttpEntity entity) { switch (method.toUpperCase(Locale.ROOT)) { case HttpDeleteWithEntity.METHOD_NAME: return addRequestBody(new HttpDeleteWithEntity(uri), entity); case HttpGetWithEntity.METHOD_NAME: return addRequestBody(new HttpGetWithEntity(uri), entity); case HttpHead.METHOD_NAME: return addRequestBody(new HttpHead(uri), entity); case HttpOptions.METHOD_NAME: return addRequestBody(new HttpOptions(uri), entity); case HttpPatch.METHOD_NAME: return addRequestBody(new HttpPatch(uri), entity); case HttpPost.METHOD_NAME: HttpPost httpPost = new HttpPost(uri); addRequestBody(httpPost, entity); return httpPost; case HttpPut.METHOD_NAME: return addRequestBody(new HttpPut(uri), entity); case HttpTrace.METHOD_NAME: return addRequestBody(new HttpTrace(uri), entity); default:/* w w w . ja va 2s.c om*/ throw new UnsupportedOperationException("http method not supported: " + method); } }
From source file:org.apache.nutch.protocol.httpclient.HttpClientRedirectStrategy.java
public HttpUriRequest getRedirect(final HttpRequest request, final HttpResponse response, final HttpContext context) throws ProtocolException { URI uri = getLocationURI(request, response, context); String method = request.getRequestLine().getMethod(); if (method.equalsIgnoreCase(HttpHead.METHOD_NAME)) { return new HttpHead(uri); } else if (method.equalsIgnoreCase(HttpGet.METHOD_NAME)) { return new HttpGet(uri); } else {//from ww w . j a v a 2 s.c om int status = response.getStatusLine().getStatusCode(); if (status == HttpStatus.SC_TEMPORARY_REDIRECT) { if (method.equalsIgnoreCase(HttpPost.METHOD_NAME)) { return copyEntity(new HttpPost(uri), request); } else if (method.equalsIgnoreCase(HttpPut.METHOD_NAME)) { return copyEntity(new HttpPut(uri), request); } else if (method.equalsIgnoreCase(HttpDelete.METHOD_NAME)) { return new HttpDelete(uri); } else if (method.equalsIgnoreCase(HttpTrace.METHOD_NAME)) { return new HttpTrace(uri); } else if (method.equalsIgnoreCase(HttpOptions.METHOD_NAME)) { return new HttpOptions(uri); } else if (method.equalsIgnoreCase(HttpPatch.METHOD_NAME)) { return copyEntity(new HttpPatch(uri), request); } } return new HttpGet(uri); } }
From source file:org.fcrepo.integration.http.api.FedoraVersioningIT.java
private static void assertMementoOptionsHeaders(final HttpResponse httpResponse) { final List<String> methods = headerValues(httpResponse, "Allow"); assertTrue("Should allow GET", methods.contains(HttpGet.METHOD_NAME)); assertTrue("Should allow HEAD", methods.contains(HttpHead.METHOD_NAME)); assertTrue("Should allow OPTIONS", methods.contains(HttpOptions.METHOD_NAME)); assertTrue("Should allow DELETE", methods.contains(HttpDelete.METHOD_NAME)); }