public class ERXDelayedRequestHandler
extends com.webobjects.appserver.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.
|
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(com.webobjects.appserver.WORequest request)
Returns true if the request handler key can be handled.
|
protected com.webobjects.appserver.WOResponse |
createErrorResponse(com.webobjects.appserver.WORequest request)
Create an error page when the future wasn't found anymore.
|
protected com.webobjects.appserver.WOResponse |
createRefreshResponse(com.webobjects.appserver.WORequest request,
String url)
Create a refresh page.
|
protected com.webobjects.appserver.WOResponse |
createStoppedResponse(com.webobjects.appserver.WORequest request)
Create a "stopped" page.
|
protected String |
cssUrl(com.webobjects.appserver.WORequest request) |
protected com.webobjects.appserver.WOResponse |
handle(com.webobjects.appserver.WORequest request,
ERXDelayedRequestHandler.DelayedRequest delayedRequest,
String id)
Override to handle specific actions for the current future.
|
com.webobjects.appserver.WOResponse |
handleRequest(com.webobjects.appserver.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.
|
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 com.webobjects.appserver.WOResponse handleRequest(com.webobjects.appserver.WORequest request)
handleRequest
in class com.webobjects.appserver.WORequestHandler
protected boolean canHandleRequest(com.webobjects.appserver.WORequest request)
request
- protected com.webobjects.appserver.WOResponse handle(com.webobjects.appserver.WORequest request, ERXDelayedRequestHandler.DelayedRequest delayedRequest, String id)
request
- delayedRequest
- id
- protected com.webobjects.appserver.WOResponse createErrorResponse(com.webobjects.appserver.WORequest request)
request
- the current requestprotected com.webobjects.appserver.WOResponse createStoppedResponse(com.webobjects.appserver.WORequest request)
request
- the request objectprotected String cssUrl(com.webobjects.appserver.WORequest request)
protected com.webobjects.appserver.WOResponse createRefreshResponse(com.webobjects.appserver.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 – 2020 Project Wonder.