com.univocity.parsers.remote
Interface RemoteContext

All Known Subinterfaces:
PaginationContext

public interface RemoteContext

Contains information about the current results obtained by the parser, including the remote HTTP response obtained, and the next HTTP request to be performed by the parser. This is made available to the user through the NextInputHandler callback.

Author:
uniVocity Software Pty Ltd - dev@univocity.com
See Also:
RemoteFollower, Paginator, NextInputHandler, UrlReaderProvider

Method Summary
 String getCurrentPage()
          Returns the value parsed from the input that indicates the current page, or null if not available.
 int getCurrentPageNumber()
          Returns the value parsed from the input that indicates the current page number.
 com.univocity.api.net.HttpResponse getCurrentResponse()
          Returns the HttpResponse object with all information returned by the remote server in its HTTP response message (which generated the current page).
 String getNextPage()
          Returns the value parsed from the input that points to the next page.
 int getNextPageNumber()
          Returns the value parsed from the input, converted to a valid int number that indicates the next page number.
 com.univocity.api.net.UrlReaderProvider getNextRequest()
          Returns the UrlReaderProvider prepared by the parser to access the next URL.
 int getPageCount()
          Returns the number of the pages visited so far by the current Paginator.
 com.univocity.api.io.RateLimiter getRateLimiter()
          Returns the RateLimiter used by the parser to prevent multiple concurrent requests against the same server, using the interval defined by RemoteParserSettings.getRemoteInterval().
 boolean hasMorePages()
          Returns a flag indicating whether a next page is available from the current page.
 void stop()
          Stops the attempt to read the next input page.
 

Method Detail

getCurrentPage

String getCurrentPage()
Returns the value parsed from the input that indicates the current page, or null if not available.

Returns:
the content extracted from the input that provides information about the current page.

getCurrentPageNumber

int getCurrentPageNumber()
Returns the value parsed from the input that indicates the current page number. If undefined, and getCurrentPage() returns a valid numeric String it will be converted to an int number that indicates the current page. If the information is unparseable/unavailable, -1 will be returned.

Returns:
the actual page number available from the input, or -1 if unavailable.

getNextPage

String getNextPage()
Returns the value parsed from the input that points to the next page. This is usually a link to the next page or simply a numeric value representing the next page.

Returns:
the content extracted from the input that provides information about the next page.

getNextPageNumber

int getNextPageNumber()
Returns the value parsed from the input, converted to a valid int number that indicates the next page number. If undefined, and getNextPage() returns a valid numeric String it will be converted to an int number that indicates the next page. If the information is unparseable/unavailable, -1 will be returned.

Returns:
the next page number if available from the input, -1 otherwise.

hasMorePages

boolean hasMorePages()
Returns a flag indicating whether a next page is available from the current page. It tests if getNextPage() returns a non-null value OR getNextPageNumber() returns a non-negative number and returns true. If no information about a next page is available, false will be returned

Returns:
true if information about a next page is available, otherwise false

getPageCount

int getPageCount()
Returns the number of the pages visited so far by the current Paginator.

Returns:
the current page count.

getCurrentResponse

com.univocity.api.net.HttpResponse getCurrentResponse()
Returns the HttpResponse object with all information returned by the remote server in its HTTP response message (which generated the current page).

Returns:
the HttpResponse received for the current page. Will be null if the process is running over local files.

getNextRequest

com.univocity.api.net.UrlReaderProvider getNextRequest()
Returns the UrlReaderProvider prepared by the parser to access the next URL. It inherits all configuration options defined in the call to the current page. Cookies set in the HttpResponse of the current page are automatically set into this request. You can alter its configuration before its HttpRequest is executed to fetch the next page.

Returns:
the UrlReaderProvider which will be used to execute a new HTTP request. Will be null if the process is running over local files.

stop

void stop()
Stops the attempt to read the next input page.


getRateLimiter

com.univocity.api.io.RateLimiter getRateLimiter()
Returns the RateLimiter used by the parser to prevent multiple concurrent requests against the same server, using the interval defined by RemoteParserSettings.getRemoteInterval(). You can decrease or increase the wait time with RateLimiter.increaseWaitTime(long) and RateLimiter.decreaseWaitTime(long). Calling rateLimiter.setInterval(0) disables the rate limiter and unblocks all threads.

Returns:
the active RateLimiter


Copyright © 2018 uniVocity Software Pty Ltd. All rights reserved.