locate operation based on uri and httpMethod
@param uri original uri of the request
@param httpMethod http method of the request
@return OpenApiOperation the wrapper of an api operation
971811
private OpenApiOperation getOpenApiOperation(String uri, String httpMethod) throws URISyntaxException {
        String uriWithoutQuery = new URI(uri).getPath();
        NormalisedPath requestPath = new ApiNormalisedPath(uriWithoutQuery);
        Optional<NormalisedPath> maybeApiPath = OpenApiHelper.findMatchingApiPath(requestPath);
        if (!maybeApiPath.isPresent()) {
            return null;
        }

        final NormalisedPath openApiPathString = maybeApiPath.get();
        final Path path = OpenApiHelper.openApi3.getPath(openApiPathString.original());

        final Operation operation = path.getOperation(httpMethod);
        return new OpenApiOperation(openApiPathString, path, httpMethod, operation);
    }
654862
private void callHandleMethod(Method method, Object instance, ApiZone apiZone,
            Object userAgent) {
        ReflectMethodUtil.invokeHandleMethod(method, instance, context, apiZone, userAgent);
    }
1207246
protected HttpUriRequest buildMethod(final String method, final String path, final Map<String, Object> params) {
        if (StringUtils.equalsIgnoreCase(method, HttpGet.METHOD_NAME)) {
            return generateGetRequest(path, params);
        } else if (StringUtils.equalsIgnoreCase(method, HttpPost.METHOD_NAME)) {
            return generatePostRequest(path, params);
        } else if (StringUtils.equalsIgnoreCase(method, HttpPut.METHOD_NAME)) {
            return generatePutRequest(path, params);
        } else if (StringUtils.equalsIgnoreCase(method, HttpDelete.METHOD_NAME)) {
            return generateDeleteRequest(path);
        } else {
            throw new RuntimeException("Must not be here.");
        }
    }
301631
public <T> HttpClientRequest.Builder<T> get(final URI uri, final HttpClientResponseHandler<T> httpHandler)
    {
        return new HttpClientRequest.Builder<T>(httpClientFactory, HttpClientMethod.GET, uri, httpHandler);
    }
317547
public B allowRequestMethods(HttpMethod... methods) {
        requireNonNull(methods, "methods");
        checkArgument(methods.length > 0, "methods should not be empty.");
        for (int i = 0; i < methods.length; i++) {
            if (methods[i] == null) {
                throw new NullPointerException("methods[" + i + ']');
            }
        }
        Collections.addAll(allowedRequestMethods, methods);
        return self();
    }
522052
void doMethod(HttpServletRequest request, HttpServletResponse response, HttpMethod httpMethod) {

        // Locate a request handler:
        String requestPath = mapRequestPath(request);
        Route route = api.get(requestPath);

        try {

            if (route != null && route.requestHandlers.containsKey(httpMethod)) {
                handleRequest(request, response, route, httpMethod);
            } else {
                handleNotFound(request, response);
            }

        } catch (Throwable t) {

            // Chances are the exception we've actually caught is the reflection
            // one from Method.invoke(...)
            Throwable caught = t;
            if (InvocationTargetException.class.isAssignableFrom(t.getClass())) {
                caught = t.getCause();
            }

            RequestHandler requestHandler = (route == null ? null : route.requestHandlers.get(httpMethod));
            handleError(request, response, requestHandler, caught);
        }

    }
149268
public Set<HttpMethod> allowedMethods(String uri) {
		QueryStringDecoder decoder = new QueryStringDecoder(uri);
		String[] tokens = PathPattern.removeSlashesAtBothEnds(decoder.path()).split("/");

		if (anyMethodRouter.anyMatched(tokens)) {
			return allAllowedMethods();
		}

		Set<HttpMethod> ret = new HashSet<HttpMethod>(routers.size());
		for (Map.Entry<HttpMethod, MethodlessRouter<T>> entry : routers.entrySet()) {
			MethodlessRouter<T> router = entry.getValue();
			if (router.anyMatched(tokens)) {
				HttpMethod method = entry.getKey();
				ret.add(method);
			}
		}

		return ret;
	}
314767
public static Map<Method, OperationId> getMethodMap(Class<?> serviceInterface) {
    if (!serviceInterface.isInterface()) {
      Map<Method, OperationId> operations = new HashMap<>();
      for (Class<?> iface : serviceInterface.getInterfaces()) {
        operations.putAll(findMethods(iface));
      }
      return operations;
    }
    return findMethods(serviceInterface);
  }
1304703
private ModuleFields loadAuth(URI relativeURI, String httpMethod) {

        ModuleFields authFields = new ModuleFields();

        for (PipeModule module : modules) {
            ModuleFields moduleFields = module.loadModule(relativeURI, httpMethod, new byte[] {});
            if (!moduleFields.getHeaders().isEmpty()) {
                for (Pair<String, String> header : moduleFields.getHeaders()) {
                    authFields.addHeader(header.first, header.second);
                }
            }

            if (!moduleFields.getQueryParameters().isEmpty()) {
                for (Pair<String, String> header : moduleFields.getQueryParameters()) {
                    authFields.addQueryParameter(header.first, header.second);
                }
            }

        }

        return authFields;

    }
926898
protected <T> T _execute(
                    final String string_url,
                    final HttpMethod method,
                    final RequestCallback callback,
                    final ResponseExtractor<T> extractor
                    )
    {
        _LOG_.debug( "HTTP: method = " + method + ", URL=" + string_url );

        URI  uri = null;
        try {
            URL  url = new URL( string_url );   //throws MalformedURLException
            uri = url.toURI();                  //throws URISyntaxException
        } catch (Exception ex) {
            _LOG_.error( "HTTP client error: " + ex );
            throw new HttpException( ex );
        }

        T  response = null;
        try {
            RestTemplate  rest = new RestTemplate();
            response = rest.execute( uri, method, callback, extractor );
                            //throws RestClientException
        } catch (Exception ex) {
            _LOG_.error( "HTTP client error: " + ex );
            throw new HttpException( ex );
        }

        return response;
    }
1119297
public static HttpRequestHeader changeMethod(String method, String header, String body) throws URIException, HttpMalformedHeaderException {
		HttpRequestHeader hrh = new HttpRequestHeader(header);
		URI uri = hrh.getURI();
		String prevMethod = hrh.getMethod();
		if (prevMethod.equalsIgnoreCase(method)) {
			return hrh;
		}
		if (prevMethod.equals(HttpRequestHeader.POST)) {
			// Was POST, move all params onto the URL
			if (body != null && body.length() > 0) {
				StringBuilder sb = new StringBuilder();
				if (uri.getQuery() != null) {
					sb.append(uri.getQuery());
				}

				String [] params = body.split("&");
				for (String param : params) {
					if (sb.length() > 0) {
						sb.append('&');
					}
					String[] nv = param.split("=");
					if (nv.length == 1) {
						// This effectively strips out the equals if theres no value 
						sb.append(nv[0]);
					} else {
						sb.append(param);
					}
				}
				uri.setQuery(sb.toString());

			}
			hrh.setURI(uri);
			// Clear the body
			body = "";

		} else if (method.equals(HttpRequestHeader.POST)) {
			// To be a port, move all URL query params into the body
			String query = uri.getQuery();
			if (query != null) {
				StringBuilder sb = new StringBuilder();
				String [] params = query.split("&");
				for (String param : params) {
					if (sb.length() > 0) {
						sb.append('&');
					}
					sb.append(param);
					String[] nv = param.split("=");
					if (nv.length == 1) {
						// Cope with URL params with no values e.g. http://www.example.com/test?key
						sb.append('=');
					}
				}
				// fixed: dead store to variable body by commenting the following line
				// body = sb.toString();
				uri.setQuery(null);
				hrh.setURI(uri);
			}
		}
		hrh.setMethod(method);
		
		return hrh;
	}
537327
def _get_action_from_method_and_request_uri(self, method, request_uri):
        

        # service response class should have 'SERVICE_NAME' class member,
        # if you want to get action from method and url
        if not hasattr(self, 'SERVICE_NAME'):
            return None
        service = self.SERVICE_NAME
        conn = boto3.client(service, region_name=self.region)

        # make cache if it does not exist yet
        if not hasattr(self, 'method_urls'):
            self.method_urls = defaultdict(lambda: defaultdict(str))
            op_names = conn._service_model.operation_names
            for op_name in op_names:
                op_model = conn._service_model.operation_model(op_name)
                _method = op_model.http['method']
                uri_regexp = self.uri_to_regexp(op_model.http['requestUri'])
                self.method_urls[_method][uri_regexp] = op_model.name
        regexp_and_names = self.method_urls[method]
        for regexp, name in regexp_and_names.items():
            match = re.match(regexp, request_uri)
            self.uri_match = match
            if match:
                return name
        return None
1016384
private RequestMethodsRequestCondition getRequestMethodsRequestCondition(
			String[] httpMethods) {
		RequestMethod[] requestMethods = new RequestMethod[httpMethods.length];
		for (int i = 0; i < requestMethods.length; i++) {
			requestMethods[i] = RequestMethod.valueOf(httpMethods[i]);
		}
		return new RequestMethodsRequestCondition(requestMethods);
	}
693241
public List<JvmOperation> getJvmOperationsFromURIs(XtendTypeDeclaration container, String... operationUris) {
		// Collect the JvmOperation prior to any modification for ensuring that
		// URI are pointing the JvmOperations.
		final List<JvmOperation> operations = new ArrayList<>();
		final ResourceSet resourceSet = container.eResource().getResourceSet();
		for (final String operationUriAsString : operationUris) {
			final URI operationURI = URI.createURI(operationUriAsString);
			final EObject overridden = resourceSet.getEObject(operationURI, true);
			if (overridden instanceof JvmOperation) {
				final JvmOperation operation = (JvmOperation) overridden;
				if (this.annotationFinder.findAnnotation(operation, DefaultValueUse.class) == null) {
					operations.add(operation);
				}
			}
		}
		return operations;
	}
1209480
public static SamlEndpoint ofHttpRedirect(String uri) {
        requireNonNull(uri, "uri");
        try {
            return ofHttpRedirect(new URI(uri));
        } catch (URISyntaxException e) {
            return Exceptions.throwUnsafely(e);
        }
    }
167444
public <T> HttpClientRequest.Builder<T> get(final String uri, final HttpClientResponseHandler<T> httpHandler)
    {
        return get(URI.create(uri), httpHandler);
    }
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;
  }