All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.microsoft.azure.functions.HttpRequestMessage Maven / Gradle / Ivy

Go to download

This package contains core Java classes to interact with Microsoft Azure functions runtime.

There is a newer version: 1.3.0
Show newest version
/**
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License. See License.txt in the project root for
 * license information.
 */

package com.microsoft.azure.functions;

import java.net.URI;
import java.util.Map;

/**
 * An HttpRequestMessage instance is provided to Azure functions that use
 * {https://github.com/Azure/azure-functions-java-library/blob/dev/src/main/java/com/microsoft/azure/functions/annotation/HttpTrigger.java HTTP Triggers}. For an example of how
 * to use the http functionality of Azure Functions, refer to the example in the
 * {https://github.com/Azure/azure-functions-java-library/blob/dev/src/main/java/com/microsoft/azure/functions/annotation/HttpTrigger.java}
 *
 * {https://github.com/Azure/azure-functions-java-library/blob/dev/src/main/java/com/microsoft/azure/functions/annotation/HttpTrigger.java}
 * @see HttpResponseMessage
 * @param  The type of the body content that is expected to be received as part of this HTTP
 *        request.
 * @since 1.0.0
 */
public interface HttpRequestMessage {
    /**
     * Returns the URI that was called that resulted in this HTTP request being submitted.
     * 
     * @return the URI that was called that resulted in this HTTP request being submitted.
     */
    URI getUri();

    /**
     * Returns the HTTP method name as Enum
     * 
     * @return type of HttpMethod
     */
    HttpMethod getHttpMethod();

    /**
     * Returns a map of headers that were contained within this HTTP request.
     * 
     * @return a map of headers that were contained within this HTTP request.
     */
    Map getHeaders();

    /**
     * Returns a map of query parameters that were included with this HTTP request.
     * 
     * @return a map of query parameters that were included with this HTTP request.
     */
    Map getQueryParameters();

    /**
     * Returns any body content that was included with this HTTP request.
     * 
     * @return any body content that was included with this HTTP request.
     */
    T getBody();

   /**
     * Returns a {@link HttpResponseMessage.Builder} instance to build a HttpResponseMessage with
     * standard HTTP status code and no response body.
     *
     * @param status The HTTP status code to return to the caller of the function.
     * @return An {@link HttpResponseMessage.Builder} instance containing the provided status and
     *         empty body.
     */
    HttpResponseMessage.Builder createResponseBuilder(HttpStatus status);

    /**
     * Returns a {@link HttpResponseMessage.Builder} instance to build a HttpResponseMessage with
     * custome HTTP status code and no response body.
     *
     * @param status The HTTP status code to return to the caller of the function.
     * @return An {@link HttpResponseMessage.Builder} instance containing the provided status and
     *         empty body.
     */
    HttpResponseMessage.Builder createResponseBuilder(HttpStatusType status);

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy