Class SignatureContext.Builder
- Enclosing class:
- SignatureContext
SignatureContext
objects-
Method Summary
Modifier and TypeMethodDescriptionbuild()
ConstructsPublicKeyInfo
object from this builderAdds an HTTP header of given name and valueheaders
(Collection<String> headerNames, Function<String, Collection<String>> headersGetter) Adds HTTP headers.headers
(Enumeration<String> headerNames, Function<String, Enumeration<String>> headersGetter) Adds HTTP headers.Adds HTTP headers from given mapSets HTTP method namerelatedRequest
(SignatureContext relatedRequestContext) Sets Signature Context of the Related Request (request that triggered generated response)status
(int status) Sets HTTP status codeSets target URItargetUri
(StringBuffer requestUrl, String queryString) Sets target URISets target URIAdds an HTTP trailer of given name and valueAdds HTTP trailers from given map
-
Method Details
-
status
Sets HTTP status code- Parameters:
status
- Status code- Returns:
- This builder
-
method
Sets HTTP method nameMethod is internally converted to uppercase
- Parameters:
method
- HTTP method.- Returns:
- This builder
-
targetUri
Sets target URItargetUri
is not the same as servlet'srequestUri
- Parameters:
targetUri
- Target URI given asURI
object- Returns:
- This builder
-
targetUri
Sets target URItargetUri
is not the same as servlet'srequestUri
.- Parameters:
targetUri
- Target URI given asString
- Returns:
- This builder
-
targetUri
Sets target URIMethod offers compatibility with
HttpServletRequest
methods.targetUri
is not the same as servlet'srequestUri
.Example:
SignatureContext.builder() ... .targetUri(request.getRequestURL(), request.getQueryString()) ... .build();
- Parameters:
requestUrl
- request URLqueryString
- query string- Returns:
- This builder
-
header
Adds an HTTP header of given name and valueInternally, the name is converted to lowercase, and the value is converted to its toString() representation. When called multiple times with the same headerName, header values are concatenated by using a single space and a single comma, with stripped leading and trailing whitespaces.
- Parameters:
headerName
- HTTP header (field) nameheaderValue
- Header value- Returns:
- This builder
- See Also:
-
headers
Adds HTTP headers from given mapMap keys are header names. Map values are header values. Internally, names is converted to lowercase, and values are converted to their toString() representation.
If the value is an instance of
Iterable
, like List or Set, it's treated as multiple values of the header. This way, multimap header holders, likejavax.ws.rs.core.MultivaluedMap
, can be used directly. Multiple header values are concatenated by using a single space and a single comma, with stripped leading and trailing whitespaces.- Parameters:
headers
- A map of HTTP header names and values- Returns:
- This builder
- See Also:
-
headers
public SignatureContext.Builder headers(Enumeration<String> headerNames, Function<String, Enumeration<String>> headersGetter) Adds HTTP headers.Method offers compatibility with
HttpServletRequest
methods.Example:
SignatureContext.builder() ... .headers(request.getHeaderNames(), request::getHeaders) ... .build();
- Parameters:
headerNames
- enumeration of HTTP servlet request header namesheadersGetter
- getter of HTTP servlet request headers enumeration- Returns:
- This builder
-
headers
public SignatureContext.Builder headers(Collection<String> headerNames, Function<String, Collection<String>> headersGetter) Adds HTTP headers.Method offers compatibility with
HttpServletResponse
methods.Example:
SignatureContext.builder() ... .headers(response.getHeaderNames(), response::getHeaders) ... .build();
- Parameters:
headerNames
- collection of HTTP servlet response header namesheadersGetter
- getter of HTTP servlet response headers collection- Returns:
- This builder
-
trailer
Adds an HTTP trailer of given name and valueInternally, the name is converted to lowercase, and the value is converted to its toString() representation. When called multiple times with the same trailerName, trailer values are concatenated by using a single space and a single comma, with stripped leading and trailing whitespaces.
- Parameters:
trailerName
- HTTP trailer (field) nametrailerValue
- Trailer value- Returns:
- This builder
- See Also:
-
trailers
Adds HTTP trailers from given mapMap keys are trailer names. Map values are trailer values. Internally, names is converted to lowercase, and values are converted to their toString() representation.
If the value is an instance of
Iterable
, like List or Set, it's treated as multiple values of the trailer. This way, multimap trailer holders, likejavax.ws.rs.core.MultivaluedMap
, can be used directly. Multiple trailer values are concatenated by using a single space and a single comma, with stripped leading and trailing whitespaces.- Parameters:
trailers
- A map of HTTP trailer names and values- Returns:
- This builder
- See Also:
-
build
ConstructsPublicKeyInfo
object from this builder- Returns:
- SignatureContext object
-