Class ClientConfiguration.Builder
- Enclosing class:
ClientConfiguration
-
Method Summary
Modifier and TypeMethodDescriptionAdd aDocumentBundleProcessorwhich will be passed the generated zipped document bundle together with thejobit was created for.apacheHttpClient(Consumer<? super ApacheHttpClientConfigurer> apacheHttpClientConfigurer) This method allows for custom configuration of the createdHttpClientif anything is needed that is not already supported by other methods inClientConfiguration.apacheHttpClientForDocumentDownloads(Consumer<? super ApacheHttpClientConfigurer> apacheHttpClientConfigurer) This method allows for custom configuration of the createdHttpClientif anything is needed that is not already supported by other methods inClientConfiguration.build()Allows for overriding whichClockis used to convert between Java and XML, may be useful for e.g.connectionPool(Consumer<? super ConnectionPoolConfigurer> connectionPool) Configure the pool used by the client to manage connections used for integrating with the API.connectionPoolForDocumentDownloads(Consumer<? super ConnectionPoolConfigurer> connectionPool) Configure the pool used by the client to manage connections used specifically for downloading documents.defaultSender(Sender sender) Set the defaultSenderto use if not specifying sender per signature job.enableDocumentBundleDiskDump(Path directory) Have the library dump the generated document bundle zip files to disk before they are sent to the service to create signature jobs.httpProxyHost(String hostname, int port) Set the http proxy host used by the client.includeInUserAgent(String userAgentCustomPart) Customize theUser-Agentheader value to include the given string.Set URI to proxy host to be used by the client.serverCertificateTrustStrategy(CertificateChainValidation certificateChainValidation) Override the validation of the server's certificate.serverOrganizationNumber(String serverOrganizationNumber) Override which organization number which is expected from the server's certificate.serviceEnvironment(UnaryOperator<ServiceEnvironment> updateServiceEnvironment) timeouts(Consumer<? super TimeoutsConfigurer> timeouts) Configure timeouts used for integrating with the API.timeoutsForDocumentDownloads(Consumer<? super TimeoutsConfigurer> timeouts) Configure timeouts used for downloading documents.
-
Method Details
-
serviceEnvironment
-
serviceEnvironment
public ClientConfiguration.Builder serviceEnvironment(UnaryOperator<ServiceEnvironment> updateServiceEnvironment) -
httpProxyHost
Set the http proxy host used by the client.- Parameters:
hostname- the hostnameport- the port
-
proxyHost
Set URI to proxy host to be used by the client. Only the scheme, host, and port of the URI is used, any other parts are ignored.- Parameters:
proxyHostUri- the proxy host URI
-
defaultSender
Set the defaultSenderto use if not specifying sender per signature job.Use
PortalJob.Builder.withSender(..)orDirectJob.Builder.withSender(..)if you need to specify different senders per signature job (typically when acting as a broker on behalf of multiple other organizations) -
includeInUserAgent
Customize theUser-Agentheader value to include the given string.- Parameters:
userAgentCustomPart- The custom part to include in the User-Agent HTTP header.
-
timeouts
Configure timeouts used for integrating with the API.- Parameters:
timeouts- the timeouts to set
-
timeoutsForDocumentDownloads
public ClientConfiguration.Builder timeoutsForDocumentDownloads(Consumer<? super TimeoutsConfigurer> timeouts) Configure timeouts used for downloading documents. The values for these timeouts should in general be configured higher than fordefault timeouts.- Parameters:
timeouts- the timeouts to set
-
connectionPool
public ClientConfiguration.Builder connectionPool(Consumer<? super ConnectionPoolConfigurer> connectionPool) Configure the pool used by the client to manage connections used for integrating with the API.- Parameters:
connectionPool- theconnection pool configuration API
-
connectionPoolForDocumentDownloads
public ClientConfiguration.Builder connectionPoolForDocumentDownloads(Consumer<? super ConnectionPoolConfigurer> connectionPool) Configure the pool used by the client to manage connections used specifically for downloading documents.- Parameters:
connectionPool- theconnection pool configuration API
-
apacheHttpClient
public ClientConfiguration.Builder apacheHttpClient(Consumer<? super ApacheHttpClientConfigurer> apacheHttpClientConfigurer) This method allows for custom configuration of the createdHttpClientif anything is needed that is not already supported by other methods inClientConfiguration.If you still need to use this method, consider requesting first-class support for your requirement on the library's web site on GitHub.
-
apacheHttpClientForDocumentDownloads
public ClientConfiguration.Builder apacheHttpClientForDocumentDownloads(Consumer<? super ApacheHttpClientConfigurer> apacheHttpClientConfigurer) This method allows for custom configuration of the createdHttpClientif anything is needed that is not already supported by other methods inClientConfiguration.If you still need to use this method, consider requesting first-class support for your requirement on the library's web site on GitHub.
-
enableDocumentBundleDiskDump
Have the library dump the generated document bundle zip files to disk before they are sent to the service to create signature jobs.The files will be given names on the format
The timestamp part may use a clock of your choosing, make sure to override the system clock withtimestamp-[reference_from_job-]asice.zipclock(Clock)before calling this method if that is desired.The reference_from_job part is only included if the job is given such a reference using
DirectJob.Builder.withReference(..)orPortalJob.Builder.withReference(..).- Parameters:
directory- the directory to dump to. This directory must already exist, or creating new signature jobs will fail. Miserably.
-
addDocumentBundleProcessor
Add aDocumentBundleProcessorwhich will be passed the generated zipped document bundle together with thejobit was created for. The processor is not responsible for closing the stream, as this is handled by the library itself.A note on performance: The processor is free to do what it want with the passed stream, but bear in mind that the time used by a processor adds to the processing time to create signature jobs.
- Parameters:
processor- theDocumentBundleProcessorwhich will be passed the generated zipped document bundle together with thejobit was created for.
-
serverOrganizationNumber
Override which organization number which is expected from the server's certificate. By default, this is the organization number of Posten Bring AS, and should not be overridden unless you have a specific need such as doing testing against your own stubbed implementation of the Posten signering API.- Parameters:
serverOrganizationNumber- the organization number expected in the server's enterprise certificate
-
serverCertificateTrustStrategy
public ClientConfiguration.Builder serverCertificateTrustStrategy(CertificateChainValidation certificateChainValidation) Override the validation of the server's certificate. This method is mainly intended for tests if you need to override (or even disable) the default validation that the server identifies itself as "Posten Bring AS". Calling this method for a production deployment is probably not what you intend to do!- Parameters:
certificateChainValidation- the validation for the server's certificate
-
clock
Allows for overriding whichClockis used to convert between Java and XML, may be useful for e.g. automated tests.Uses the
system clock with default time zoneif not specified. -
build
-