public final class SignatureBuilder extends Object implements Serializable
| Modifier and Type | Field and Description |
|---|---|
static String |
DATE_FORMAT |
| Constructor and Description |
|---|
SignatureBuilder() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addDate(Calendar calendar)
IMPORTANT: If you call this overload instead of
addHeader(String, String), be sure to retrieve the
generated header value to add to your client request using a subsequent call to getDate(). |
boolean |
addDate(Date dateGMT)
IMPORTANT: If you call this overload instead of
addHeader(String, String), be sure to retrieve the
generated header value to add to your client request using a subsequent call to getDate(). |
boolean |
addDateNow()
IMPORTANT: If you call this overload instead of
addHeader(String, String), be sure to retrieve the
generated header value to add to your client request using a subsequent call to getDate(). |
boolean |
addHeader(String name,
String value)
Adds a header name and value pair
|
byte[] |
buildContent(List<String> headers,
Charset charset)
Returns the signature content as a byte array
|
String |
buildString(List<String> headers)
Returns the signature content as a String
|
String |
getDate() |
Date |
getDateGMT()
Returns the currently set date header value converted to a
Date object in the GMT time zone |
Calendar |
getDateTZ(TimeZone timeZone)
Returns the currently set date header value converted to a
Calendar in the specified timeZone, or in the
default timeZone if the parameter is null |
List<String> |
getHeaderNames() |
List<String> |
getHeaderValues(String name) |
String |
getRequestLine() |
boolean |
setRequestLine(String requestLine) |
String |
toString() |
boolean |
tryParseDate(String date)
Sets the literal date header value.
|
public static final String DATE_FORMAT
public byte[] buildContent(List<String> headers, Charset charset)
headers - the list of headers to be included in the signed contentbuildString(java.util.List) encoded using the provided Charsetpublic String buildString(List<String> headers)
headers - the list of headers to be included in the signed contentpublic List<String> getHeaderNames()
SignatureBuilder, in the order in which they were added, except
for request-line, which is listed first if presentpublic boolean setRequestLine(String requestLine)
public boolean addHeader(String name, String value)
name - value - public String getRequestLine()
public String getDate()
public List<String> getHeaderValues(String name)
name - the name of the headerpublic boolean tryParseDate(String date)
date - a date string conforming to DATE_FORMATDATE_FORMATpublic boolean addDate(Calendar calendar)
addHeader(String, String), be sure to retrieve the
generated header value to add to your client request using a subsequent call to getDate(). This is
merely a convenience method to generate a date header in the correct format.calendar - the Calendar to providepublic boolean addDate(Date dateGMT)
addHeader(String, String), be sure to retrieve the
generated header value to add to your client request using a subsequent call to getDate(). This is
merely a convenience method to generate a date header in the correct format.dateGMT - the current date in GMTpublic boolean addDateNow()
addHeader(String, String), be sure to retrieve the
generated header value to add to your client request using a subsequent call to getDate(). This is
merely a convenience method to generate a date header in the correct format.public Date getDateGMT()
Date object in the GMT time zoneDate object in GMT or null if header is not set or not validpublic Calendar getDateTZ(TimeZone timeZone)
Calendar in the specified timeZone, or in the
default timeZone if the parameter is nulltimeZone - some time zone or null to convert to the default time zoneCalendar in the specified time zone or in the default time zone if the timeZone parameter is nullCopyright © 2013. All Rights Reserved.