Class AbstractJerseyClient
java.lang.Object
org.apache.nifi.toolkit.client.impl.AbstractJerseyClient
- Direct Known Subclasses:
CRUDJerseyClient,JerseyAccessClient,JerseyConnectionClient,JerseyControllerClient,JerseyControllerServicesClient,JerseyCountersClient,JerseyFlowClient,JerseyParamContextClient,JerseyParamProviderClient,JerseyPoliciesClient,JerseyProcessGroupClient,JerseyProcessorClient,JerseyProvenanceClient,JerseyRemoteProcessGroupClient,JerseyReportingTasksClient,JerseySnippetClient,JerseySystemDiagnosticsClient,JerseyTenantsClient,JerseyVersionsClient
Base class for the client operations to share exception handling.
Sub-classes should always execute a request from getRequestBuilder(target) to
ensure proper headers are sent.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static interfaceAn action to execute with the given return type. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected <T> TexecuteAction(String errorMessage, AbstractJerseyClient.NiFiAction<T> action) Executes the given action and returns the result.protected StringgetContentDispositionFilename(jakarta.ws.rs.core.Response response) Gets the filename from the content disposition header.protected Throwableprotected jakarta.ws.rs.client.Invocation.BuildergetRequestBuilder(jakarta.ws.rs.client.WebTarget webTarget) Creates a new Invocation.Builder for the given WebTarget with the headers added to the builder.protected RequestConfig
-
Field Details
-
EMPTY_REQUEST_CONFIG
-
requestConfig
-
-
Constructor Details
-
AbstractJerseyClient
-
-
Method Details
-
getRequestConfig
-
getRequestBuilder
protected jakarta.ws.rs.client.Invocation.Builder getRequestBuilder(jakarta.ws.rs.client.WebTarget webTarget) Creates a new Invocation.Builder for the given WebTarget with the headers added to the builder.- Parameters:
webTarget- the target for the request- Returns:
- the builder for the target with the headers added
-
executeAction
protected <T> T executeAction(String errorMessage, AbstractJerseyClient.NiFiAction<T> action) throws NiFiClientException, IOException Executes the given action and returns the result.- Type Parameters:
T- the return type of the action- Parameters:
errorMessage- the message to use if a NiFiRegistryException is thrownaction- the action to execute- Returns:
- the result of the action
- Throws:
NiFiClientException- if any exception other than IOException is encounteredIOException- if an I/O error occurs communicating with the registry
-
getIOExceptionCause
- Parameters:
e- an exception that was encountered interacting with the registry- Returns:
- the IOException that caused this exception, or null if the an IOException did not cause this exception
-
getContentDispositionFilename
Gets the filename from the content disposition header.- Parameters:
response- a response- Returns:
- the filename value
-