
Classes | |
| class | DelayedRequest |
Public Member Functions | |
| NSArray< DelayedRequest > | activeRequests () |
| ERXDelayedRequestHandler () | |
| ERXDelayedRequestHandler (int refreshTimeSeconds, int maxRequestTimeSeconds) | |
| ERXDelayedRequestHandler (int refreshTimeSeconds, int maxRequestTimeSeconds, int cancelRequestAfterSeconds) | |
| ERXDelayedRequestHandler (int refreshTimeSeconds, int maxRequestTimeSeconds, int cancelRequestAfterSeconds, String cssUrl) | |
| WOResponse | handleRequest (final WORequest request) |
Static Public Attributes | |
| static String | KEY = "_edr_" |
Protected Member Functions | |
| boolean | canHandleRequest (WORequest request) |
| WOResponse | createErrorResponse (WORequest request) |
| WOResponse | createRefreshResponse (WORequest request, String url) |
| WOResponse | createStoppedResponse (WORequest request) |
| String | cssUrl (WORequest request) |
| WOResponse | handle (WORequest request, DelayedRequest delayedRequest, String id) |
| int | maxRequestTimeMillis () |
| int | refresh () |
Static Protected Attributes | |
| static final Logger | log = Logger.getLogger(ERXDelayedRequestHandler.class) |
Private Attributes | |
| String | _cssUrl |
| ExecutorService | _executor |
| ERXExpiringCache< String, DelayedRequest > | _futures |
| int | _maxRequestTimeMillis |
| int | _refreshTimeSeconds |
| ERXExpiringCache< String, String > | _urls |
registerRequestHandlerForKey(new ERXDelayedRequestHandler(), ERXDelayedRequestHandler.KEY), then a request that takes too long is automatically detached and a poor man's long response is returned. It is pretty cool in that:
| ERXDelayedRequestHandler | ( | int | refreshTimeSeconds, | |
| int | maxRequestTimeSeconds, | |||
| int | cancelRequestAfterSeconds, | |||
| String | cssUrl | |||
| ) |
Creates a request handler instance.
| refreshTimeSeconds | time in seconds for the refresh of the page | |
| maxRequestTimeSeconds | time in seconds that a request can take at most before the delayed page is returned | |
| cancelRequestAfterSeconds | time in seconds that a request can take at most before it is cancelled | |
| cssUrl | url for a style sheet for the message page |
| ERXDelayedRequestHandler | ( | int | refreshTimeSeconds, | |
| int | maxRequestTimeSeconds, | |||
| int | cancelRequestAfterSeconds | |||
| ) |
Creates a handler with the supplied values for refreshTimeSeconds, maxRequestTimeSeconds and maxRequestTimeSeconds.
| refreshTimeSeconds | ||
| maxRequestTimeSeconds | ||
| cancelRequestAfterSeconds |
| ERXDelayedRequestHandler | ( | int | refreshTimeSeconds, | |
| int | maxRequestTimeSeconds | |||
| ) |
Creates a handler with the supplied values for refreshTimeSeconds and maxRequestTimeSeconds. cancelRequestAfterSeconds is set o 5*maxRequestTimeSeconds.
| refreshTimeSeconds | ||
| maxRequestTimeSeconds |
Creates a handler with the default values of 5 second refresh and 5 seconds maxRequestTime. Requests taking longer than 25 seconds are cancelled.
| NSArray<DelayedRequest> activeRequests | ( | ) |
Returns all active delayed requests.
| boolean canHandleRequest | ( | WORequest | request | ) | [protected] |
Returns true if the request handler key can be handled.
| request |
| WOResponse createErrorResponse | ( | WORequest | request | ) | [protected] |
Create an error page when the future wasn't found anymore. This happens hen the user backtracks and it is no longer in the cache. Note that the session has not been awakened.
| request |
| WOResponse createRefreshResponse | ( | WORequest | request, | |
| String | url | |||
| ) | [protected] |
Create a refresh page. Note that the session has not been awakened yet and you probably shouldn't do it either.
| request | ||
| url |
| WOResponse createStoppedResponse | ( | WORequest | request | ) | [protected] |
Create a "stopped" page. Note that the session has not been awakened yet and you probably shouldn't do it either. The default implementation redirect to the entry.
| request |
| String cssUrl | ( | WORequest | request | ) | [protected] |
| WOResponse handle | ( | WORequest | request, | |
| DelayedRequest | delayedRequest, | |||
| String | id | |||
| ) | [protected] |
Override to handle specific actions for the current future.
| request | ||
| delayedRequest | ||
| id |
| WOResponse handleRequest | ( | final WORequest | request | ) |
Handles the request and returns the applicable response.
| int maxRequestTimeMillis | ( | ) | [protected] |
Returns the maximum time in milliseconds for allowed for a request before returning the message page.
| int refresh | ( | ) | [protected] |
Returns the refresh time in seconds for the message page;
ExecutorService _executor [private] |
ERXExpiringCache<String, DelayedRequest> _futures [private] |
int _maxRequestTimeMillis [private] |
int _refreshTimeSeconds [private] |
final Logger log = Logger.getLogger(ERXDelayedRequestHandler.class) [static, protected] |
1.5.8