public class HypermediaPagingProvider extends RestPagingProvider
RestPagingProvider for APIs which do paging based on a next URL provided in the response of each
request.
Request number 1 will obtain the first page plus the next URL embedded in the response. Said URL will be the request number 2, which will reply with the next page and a new URL which overwrites the prior one. The process continues until no new URL is provided or the next page comes back empty.
defaultMediaType, expressionLanguage, responseTimeout| Constructor and Description |
|---|
HypermediaPagingProvider(String nextUrlExpression,
Function<RestConnection,RestRequestBuilder> requestFactory,
org.mule.runtime.api.el.ExpressionLanguage expressionLanguage,
org.mule.runtime.extension.api.runtime.streaming.StreamingHelper streamingHelper,
String payloadExpression,
org.mule.runtime.api.metadata.MediaType defaultMediaType,
int responseTimeout)
Creates a new instance
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
configureRequest(RestRequestBuilder requestBuilder)
Depending on the paging strategy, different parameters or headers may need to be passed.
|
protected void |
onPage(List<org.mule.runtime.api.metadata.TypedValue<String>> page,
org.mule.runtime.api.metadata.TypedValue<String> rawPage,
HttpResponseAttributes responseAttributes)
Invoked each time a page is obtained.
|
protected org.mule.runtime.api.el.BindingContext |
toBindingContext(org.mule.runtime.api.metadata.TypedValue<?> content,
HttpResponseAttributes httpResponseAttributes) |
close, doClose, evaluate, getPage, getTotalResults, stopPaging, withResponseBindingpublic HypermediaPagingProvider(String nextUrlExpression, Function<RestConnection,RestRequestBuilder> requestFactory, org.mule.runtime.api.el.ExpressionLanguage expressionLanguage, org.mule.runtime.extension.api.runtime.streaming.StreamingHelper streamingHelper, String payloadExpression, org.mule.runtime.api.metadata.MediaType defaultMediaType, int responseTimeout)
nextUrlExpression - the DW expression used to extract the next URL from the responserequestFactory - a Function to generate the request to be used on each page request. Each invocation should
yield a different instanceexpressionLanguage - the app's ExpressionLanguagestreamingHelper - the StreamingHelper associated to the executing operationpayloadExpression - a DW expression to extract the data from the responsedefaultMediaType - the MediaType for the page items if the server doesn't specify oneresponseTimeout - the timeout for each requestprotected void configureRequest(RestRequestBuilder requestBuilder)
RestPagingProviderRestPagingProvider.requestFactory in order to configure the custom parameters that apply/configureRequest in class RestPagingProviderrequestBuilder - a RestRequestBuilderprotected void onPage(List<org.mule.runtime.api.metadata.TypedValue<String>> page, org.mule.runtime.api.metadata.TypedValue<String> rawPage, HttpResponseAttributes responseAttributes)
RestPagingProvideronPage in class RestPagingProviderpage - the obtained pageprotected org.mule.runtime.api.el.BindingContext toBindingContext(org.mule.runtime.api.metadata.TypedValue<?> content,
HttpResponseAttributes httpResponseAttributes)
toBindingContext in class RestPagingProviderCopyright © 2024. All rights reserved.