Create a Commons HttpMethodBase object for the given HTTP method and URI
specification.
@param httpMethod the HTTP method
@param uri the URI
@return the Commons HttpMethodBase object
762236
protected HttpUriRequest createHttpUriRequest(HttpMethod httpMethod, URI uri) {
		switch (httpMethod) {
		case GET:
			return new HttpGetHC4(uri);
		case DELETE:
			return new HttpDeleteHC4(uri);
		case HEAD:
			return new HttpHeadHC4(uri);
		case OPTIONS:
			return new HttpOptionsHC4(uri);
		case POST:
			return new HttpPostHC4(uri);
		case PUT:
			return new HttpPutHC4(uri);
		case TRACE:
			return new HttpTraceHC4(uri);
		case PATCH:
			return new HttpPatch(uri);
		default:
			throw new IllegalArgumentException("Invalid HTTP method: " + httpMethod);
		}
	}
79432
@Override
	public Collection<HttpMethod> getRequestMethod(Class<?> type, Method method) {
		return METHODS.computeIfAbsent(key(type, method), __ -> delegate.getRequestMethod(type, method));
	}
1004999
private static HttpUriRequest createHttpUriRequest(String method, URI uri) {
        switch (method) {
            case "GET":
                return new HttpGet(uri);
            case "HEAD":
                return new HttpHead(uri);
            case "POST":
                return new HttpPost(uri);
            case "PUT":
                return new HttpPut(uri);
            case "PATCH":
                return new HttpPatch(uri);
            case "DELETE":
                return new HttpDelete(uri);
            case "OPTIONS":
                return new HttpOptions(uri);
            case "TRACE":
                return new HttpTrace(uri);
            default:
                throw new IllegalArgumentException("Invalid HTTP method: " + method);
        }
    }
231125
private HttpUriRequest makeRequest(URI uri, final String requestBody)
    {
        HttpUriRequest request;
        if (m_method == HttpMethod.GET) {
            request = new HttpGet(uri + "?" + requestBody);
        } else if (m_method == HttpMethod.POST) {
            if (m_isHdfs) {
                try {
                    uri = HDFSUtils.opAdder(uri, "APPEND");
                } catch (IllegalArgumentException e) {
                    rateLimitedLogError(m_logger, "Invalid URI %s %s", uri.toString(), Throwables.getStackTraceAsString(e));
                    return null;
                }
            }
            final HttpPost post = new HttpPost(uri);
            post.setEntity(new StringEntity(requestBody, m_contentType));
            request = post;

        } else if (m_method == HttpMethod.PUT) {
            final HttpPut put = new HttpPut(uri);
            put.setEntity(new StringEntity(requestBody, m_contentType));
            request = put;
        } else {
            // Should never reach here
            request = null;
        }

        if (m_isHdfs && request != null) {
            request.setHeader("Expect", "100-continue");
        }

        return request;
    }
1361963
protected Object httpRequest(HttpRequestMethod method, ApiParams apiParams) throws IOException {
        ApiAction action = apiParams.getApiCall();
        String url = apiUrl + "/" + action.toString().toLowerCase();
        String json = GSON.toJson(apiParams, apiParams.getType());
        Map<String, String> params = buildPayload(json);
        Object response = httpClient.executeHttpRequest(url, method, params, handler, customHeaders);
        recordRateLimitInfo(action, method, response);
        return response;
    }
1247829
public static HttpWorkerAbstract getWorkerStrategy(final String requestMethod, final HttpClient client) {

        if (requestMethod.equals(HEAD)) {
            return new HttpWorkerHead(client);
        } else if (requestMethod.equals(GET)) {
            return new HttpWorkerGet(client);
        } else if (requestMethod.equals(POST)) {
            return new HttpWorkerPost(client);
        } else if (requestMethod.equals(PUT)) {
            return new HttpWorkerPut(client);
        } else if (requestMethod.equals(DELETE)) {
            return new HttpWorkerDelete(client);
        }

        return new HttpWorkerGet(client);
    }
976079
public @Nullable Info lookup(String httpMethod, String url) {
    httpMethod = httpMethod.toLowerCase();
    if (url.startsWith("/")) {
      url = url.substring(1);
    }
    url = StringUtils.stripTrailingSlash(url);
    List<Info> infos = infosByHttpMethod.get(httpMethod);
    if (infos == null) {
      log.atFine().log(
          "no information about any urls for HTTP method %s when checking %s", httpMethod, url);
      return null;
    }
    for (Info info : infos) {
      log.atFine().log("trying %s with template %s", url, info.getTemplate());
      if (info.getTemplate().matches(url)) {
        log.atFine().log("%s matched %s", url, info.getTemplate());
        return info;
      } else {
        log.atFine().log("%s did not matched %s", url, info.getTemplate());
      }
    }

    return null;
  }
358923
public HttpPost createPostMethod(final String path, final Map<String, List<String>> params) {
        return new HttpPost(repositoryURL + path + queryString(params));
    }
369004
public <T> HttpClientRequest.Builder<T> options(final URI uri, final HttpClientResponseHandler<T> httpHandler)
    {
        return new HttpClientRequest.Builder<T>(httpClientFactory, HttpClientMethod.OPTIONS, uri, httpHandler);
    }
974209
@SneakyThrows
    public BaseHttpServletRequestXMLMessageDecoder getInstance(final HttpMethod method) {
        val decoder = get(method);
        return (BaseHttpServletRequestXMLMessageDecoder) BeanUtils.cloneBean(decoder);
    }
406641
public static MatchInfo fromUri(final URI uri, final HttpMethod method) {
        int newPort = uri.getPort();
        if (newPort < 0) {
            try {
                newPort = uri.toURL().getDefaultPort();
            } catch (MalformedURLException | IllegalArgumentException e) {
                newPort = ANY_PORT;
            }
        }

        return new MatchInfo(uri.getScheme(), uri.getHost(), newPort, uri.getPath(), uri.getQuery(),
                             uri.getFragment(), ANY_REALM, method);
    }
675453
public static HttpResponse execute(final String url, final String method,
                                       final Map<String, Object> headers) {
        return execute(url, method, null, null, new HashMap<>(), headers);
    }
772274
public static HttpMethod valueOf(String name) {
        if (name == null) {
            throw new NullPointerException("name");
        }

        name = name.trim().toUpperCase();
        if (name.length() == 0) {
            throw new IllegalArgumentException("empty name");
        }

        HttpMethod result = methodMap.get(name);
        if (result != null) {
            return result;
        } else {
            return new HttpMethod(name);
        }
    }
167444
public <T> HttpClientRequest.Builder<T> get(final String uri, final HttpClientResponseHandler<T> httpHandler)
    {
        return get(URI.create(uri), httpHandler);
    }
885437
public HttpMethod getRequestMethod() {
        final Object method = getHeader(HttpMessageHeaders.HTTP_REQUEST_METHOD);

        if (method != null) {
            return HttpMethod.valueOf(method.toString());
        }

        return null;
    }
576442
public Set<HttpMethod> allAllowedMethods() {
		if (anyMethodRouter.size() > 0) {
			Set<HttpMethod> ret = new HashSet<HttpMethod>(9);
			ret.add(HttpMethod.CONNECT);
			ret.add(HttpMethod.DELETE);
			ret.add(HttpMethod.GET);
			ret.add(HttpMethod.HEAD);
			ret.add(HttpMethod.OPTIONS);
			ret.add(HttpMethod.PATCH);
			ret.add(HttpMethod.POST);
			ret.add(HttpMethod.PUT);
			ret.add(HttpMethod.TRACE);
			return ret;
		} else {
			return new HashSet<HttpMethod>(routers.keySet());
		}
	}
301631
public <T> HttpClientRequest.Builder<T> get(final URI uri, final HttpClientResponseHandler<T> httpHandler)
    {
        return new HttpClientRequest.Builder<T>(httpClientFactory, HttpClientMethod.GET, uri, httpHandler);
    }