Package com.google.cloud.functions
Interface HttpRequest
- All Superinterfaces:
HttpMessage
Represents the contents of an HTTP request that is being serviced by a Cloud Function.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceRepresents one part inside a multipart (multipart/form-data) HTTP request. -
Method Summary
Modifier and TypeMethodDescriptiongetFirstQueryParameter(String name) The first query parameter with the given name, if any.The HTTP method of this request, such as"POST"or"GET".getParts()Returns the parts inside this multipart (multipart/form-data) HTTP request.getPath()The path part of the URI for this request, without any query.getQuery()The query part of the URI for this request.The query parameters of this request.getUri()The full URI of this request as it arrived at the server.Methods inherited from interface com.google.cloud.functions.HttpMessage
getCharacterEncoding, getContentLength, getContentType, getFirstHeader, getHeaders, getInputStream, getReader
-
Method Details
-
getMethod
The HTTP method of this request, such as"POST"or"GET".- Returns:
- the HTTP method of this request.
-
getUri
The full URI of this request as it arrived at the server.- Returns:
- the full URI of this request.
-
getPath
The path part of the URI for this request, without any query. If the full URI ishttp://foo.com/bar/baz?this=that, then this method will return/bar/baz.- Returns:
- the path part of the URI for this request.
-
getQuery
The query part of the URI for this request. If the full URI ishttp://foo.com/bar/baz?this=that, then this method will returnthis=that. If there is no query part, the returnedOptionalis empty.- Returns:
- the query part of the URI, if any.
-
getQueryParameters
The query parameters of this request. If the full URI ishttp://foo.com/bar?thing=thing1&thing=thing2&cat=hat, then the returned map will mapthingto the list["thing1", "thing2"]andcatto the list with the single element"hat".- Returns:
- a map where each key is the name of a query parameter and the corresponding
Listvalue indicates every value that was associated with that name.
-
getFirstQueryParameter
The first query parameter with the given name, if any. If the full URI ishttp://foo.com/bar?thing=thing1&thing=thing2&cat=hat, thengetFirstQueryParameter("thing")will returnOptional.of("thing1")andgetFirstQueryParameter("something")will returnOptional.empty(). This is a more convenient alternative togetQueryParameters().- Parameters:
name- a query parameter name.- Returns:
- the first query parameter value with the given name, if any.
-
getParts
Returns the parts inside this multipart (multipart/form-data) HTTP request. Each entry in the returned map has the name of the part as its key and the contents as the associated value.- Returns:
- a map from part names to part contents.
- Throws:
IllegalStateException- if thecontent typeis notmultipart/form-data.
-