Define a REST endpoint mapped to HTTP POST with default path "/" as url

@param endpoint   The endpoint handler
@param mediaTypes (Optional) The accepted and returned types for this endpoint
342685
public static void post(HttpConsumer<HttpExchange> endpoint, MediaTypes... mediaTypes) {
        addResource(Methods.POST, HandlerUtil.BASE_PATH, endpoint, mediaTypes);
    }
1119357
@VisibleForTesting
    static String makeEndPointPath(ServiceEndPoint endPoint) {
        String servicePath = makeServicePath(endPoint.getServiceName());
        String id = endPoint.getId();
        return ZKPaths.makePath(servicePath, id);
    }
681348
public Route accepts(String... types) {
        Preconditions.checkNotNull(types);
        final ImmutableSet.Builder<MediaType> builder = new ImmutableSet.Builder<>();
        builder.addAll(this.acceptedMediaTypes);
        for (String s : types) {
            builder.add(MediaType.parse(s));
        }
        this.acceptedMediaTypes = builder.build();
        return this;
    }
539016
private static String getHost(final String endpoint) {
        String host = URI.create(endpoint).getHost();
        if (host == null) {
            host = URI.create("http://" + endpoint).getHost();
        }
        return host;
    }
1258706
public void setEndpointDescriptions(java.util.Collection<EndpointDescription> endpointDescriptions) {
        if (endpointDescriptions == null) {
            this.endpointDescriptions = null;
            return;
        }

        this.endpointDescriptions = new java.util.ArrayList<EndpointDescription>(endpointDescriptions);
    }
149507
public <T> String postObject(
                    final String url,
                    final T object,
                    final Class<T> type
                    )
    {
        _LOG_.debug( "HTTP POST: URL=" + url
                        + ", request type=" + type );

        HttpHeaders  request_headers = new HttpHeaders();
        request_headers.setContentType( getObjectMediaType() );
        HttpEntity<T> request_entity = new HttpEntity<T>( object, request_headers );

        URI  location = null;
        try {
            location= _newRestTemplate().postForLocation( url, request_entity );
            //throws RestClientException
        } catch (Exception ex) {
            throw new HttpException( ex );
        }

        return location.toString();
    }
1253645
public static void options(String url, HttpConsumer<HttpExchange> endpoint, MediaTypes... mediaTypes) {
        addResource(Methods.OPTIONS, url, endpoint, mediaTypes);
    }
1369811
protected function buildUrl($endpoint = '', $type = 'api')
    {
        //Get the base path
        $base = $this->getBasePath();

        //If the endpoint type is 'upload'
        if ($type === 'upload') {
            //Get the Content Path
            $base = $this->getUploadPath();
        }

        //Join and return the base and api path/endpoint
        return $base . $endpoint;
    }
589157
public static URI toUri(String endpoint, ClientConfiguration config) {

        if (config == null) {
            throw new IllegalArgumentException("ClientConfiguration cannot be null");
        }
        return toUri(endpoint, config.getProtocol());
    }
1113567
function badRequestEndpoint(path, query, body) {
  return function () {
    body = body || getJSON(path);
    createEndpointFromObject(path, query, body).status(400);
    console.log('  registered error path %s', path);
  }
}
1038926
public static void put(HttpConsumer<HttpExchange> endpoint, MediaTypes... mediaTypes) {
        addResource(Methods.PUT, HandlerUtil.BASE_PATH, endpoint, mediaTypes);
    }
277352
public static synchronized void multipart(String url, HttpConsumer<MultipartExchange> endpoint) {
        multipart(Methods.POST, url, endpoint, -1);
    }
694917
public void setEndpoints(java.util.Collection<Endpoint> endpoints) {
        if (endpoints == null) {
            this.endpoints = null;
            return;
        }

        this.endpoints = new com.amazonaws.internal.SdkInternalList<Endpoint>(endpoints);
    }
342719
public void changeEndpoint(String endpoint) throws ConnectionEndpointArray.UnknownSchemeException {
        if (endpoint != null && !endpoint.isEmpty()) {
            modules.getApiModule().changeEndpoint(endpoint);
        } else {
            modules.getApiModule().resetToDefaultEndpoints();
        }
    }
45668
void configureEndpoints(Reflections reflections) {

        // [Re]initialise the api:
        api = new HashMap<>();

        log.info("Scanning for endpoint classes..");
        Set<Class<?>> endpoints = reflections.getTypesAnnotatedWith(Api.class);
        // log.info(reflections.getConfiguration().getUrls());

        log.info("Found {} endpoint classes.", endpoints.size());
        log.info("Examining endpoint class methods:");

        // Configure the classes:
        for (Class<?> endpointClass : endpoints) {

            Route route = getEndpoint(endpointClass);
            route.endpointClass = endpointClass;

            for (Method method : endpointClass.getMethods()) {

                // Skip Object methods
                if (method.getDeclaringClass() == Object.class) {
                    continue;
                }

                // Find public methods:
                if (Modifier.isPublic(method.getModifiers())) {

                    // Which HTTP method(s) will this method respond to?
                    annotation:
                    for (Annotation annotation : method.getAnnotations()) {
                        HttpMethod httpMethod = HttpMethod.method(annotation);
                        if (httpMethod != null) {
                            log.info("Http method: {}", httpMethod);

                            RequestHandler requestHandler = new RequestHandler();
                            requestHandler.handlerMethod = method;
                            log.info("Java method: {}", method.getName());

                            // Look for an optional Json message type parameter:
                            for (Class<?> parameterType : method.getParameterTypes()) {
                                if (!HttpServletRequest.class.isAssignableFrom(parameterType)
                                        && !HttpServletResponse.class.isAssignableFrom(parameterType)) {
                                    if (requestHandler.requestMessageType != null) {
                                        log.error("Too many parameters on {} method {}. " +
                                                        "Message type already set to {} but also found a {} parameter.",
                                                httpMethod, method.getName(),
                                                requestHandler.requestMessageType.getSimpleName(), parameterType.getSimpleName());
                                        break annotation;
                                    }
                                    requestHandler.requestMessageType = parameterType;
                                    log.info("request Json: {}", requestHandler.requestMessageType.getSimpleName());
                                }
                            }

                            // Check the response Json message type:
                            if (method.getReturnType() != void.class) {
                                requestHandler.responseMessageType = method.getReturnType();
                                log.info("Response Json: {}", requestHandler.responseMessageType.getSimpleName());
                            }

                            route.requestHandlers.put(httpMethod, requestHandler);

                        }
                    }
                }
            }
        }

    }
453657
static PathMappingContext of(VirtualHost virtualHost, String hostname,
                                 String path, @Nullable String query,
                                 HttpHeaders headers, @Nullable MediaTypeSet producibleMediaTypes,
                                 boolean isCorsPreflight) {
        final MediaType consumeType = resolveConsumeType(headers);
        final List<MediaType> produceTypes = resolveProduceTypes(headers, producibleMediaTypes);
        return new DefaultPathMappingContext(virtualHost, hostname, headers.method(), path, query,
                                             consumeType, produceTypes, isCorsPreflight);
    }
883501
public void setEndpoints(java.util.Collection<Endpoint> endpoints) {
        if (endpoints == null) {
            this.endpoints = null;
            return;
        }

        this.endpoints = new java.util.ArrayList<Endpoint>(endpoints);
    }