public class ERXDelayedRequestHandler extends WORequestHandler
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:
Modifier and Type | Class and Description |
---|---|
class |
ERXDelayedRequestHandler.DelayedRequest
Helper to wrap a future and the accompanying request.
|
Modifier and Type | Field and Description |
---|---|
static String |
KEY |
DidHandleRequestNotification
Constructor and Description |
---|
ERXDelayedRequestHandler()
Creates a handler with the default values of 5 second refresh and 5
seconds maxRequestTime.
|
ERXDelayedRequestHandler(int refreshTimeSeconds,
int maxRequestTimeSeconds)
Creates a handler with the supplied values for refreshTimeSeconds and
maxRequestTimeSeconds.
|
ERXDelayedRequestHandler(int refreshTimeSeconds,
int maxRequestTimeSeconds,
int cancelRequestAfterSeconds)
Creates a handler with the supplied values for refreshTimeSeconds, maxRequestTimeSeconds and
maxRequestTimeSeconds.
|
ERXDelayedRequestHandler(int refreshTimeSeconds,
int maxRequestTimeSeconds,
int cancelRequestAfterSeconds,
String cssUrl)
Creates a request handler instance.
|
Modifier and Type | Method and Description |
---|---|
NSArray<ERXDelayedRequestHandler.DelayedRequest> |
activeRequests()
Returns all active delayed requests.
|
protected boolean |
canHandleRequest(WORequest request)
Returns true if the request handler key can be handled.
|
protected WOResponse |
createErrorResponse(WORequest request)
Create an error page when the future wasn't found anymore.
|
protected WOResponse |
createRefreshResponse(WORequest request,
String url)
Create a refresh page.
|
protected WOResponse |
createStoppedResponse(WORequest request)
Create a "stopped" page.
|
protected String |
cssUrl(WORequest request) |
protected WOResponse |
handle(WORequest request,
ERXDelayedRequestHandler.DelayedRequest delayedRequest,
String id)
Override to handle specific actions for the current future.
|
WOResponse |
handleRequest(WORequest request)
Handles the request and returns the applicable response.
|
protected int |
maxRequestTimeMillis()
Returns the maximum time in milliseconds for allowed for a request before
returning the message page.
|
protected int |
refresh()
Returns the refresh time in seconds for the message page.
|
toString
public static String KEY
public ERXDelayedRequestHandler(int refreshTimeSeconds, int maxRequestTimeSeconds, int cancelRequestAfterSeconds, String cssUrl)
refreshTimeSeconds
- time in seconds for the refresh of the pagemaxRequestTimeSeconds
- time in seconds that a request can take at most before the delayed page
is returnedcancelRequestAfterSeconds
- time in seconds that a request can take at most before it is cancelledcssUrl
- url for a style sheet for the message pagepublic ERXDelayedRequestHandler(int refreshTimeSeconds, int maxRequestTimeSeconds, int cancelRequestAfterSeconds)
refreshTimeSeconds
- maxRequestTimeSeconds
- cancelRequestAfterSeconds
- public ERXDelayedRequestHandler(int refreshTimeSeconds, int maxRequestTimeSeconds)
refreshTimeSeconds
- maxRequestTimeSeconds
- public ERXDelayedRequestHandler()
public WOResponse handleRequest(WORequest request)
handleRequest
in class WORequestHandler
protected boolean canHandleRequest(WORequest request)
request
- protected WOResponse handle(WORequest request, ERXDelayedRequestHandler.DelayedRequest delayedRequest, String id)
request
- delayedRequest
- id
- protected WOResponse createErrorResponse(WORequest request)
request
- the current requestprotected WOResponse createStoppedResponse(WORequest request)
request
- the request objectprotected WOResponse createRefreshResponse(WORequest request, String url)
request
- the current requesturl
- URL to open after refreshprotected int refresh()
protected int maxRequestTimeMillis()
public NSArray<ERXDelayedRequestHandler.DelayedRequest> activeRequests()
Copyright © 2002 – 2024 Project Wonder.