public abstract class AbstractAsyncServlet extends HttpServlet implements FutureResponseModel
Implementations of AbstractAsyncServlet decouple the
 receiving of a servlet request from the sending of its
 response. Responses may be sent in the future through the use of
 the AbstractAsyncServlet.notify(weblogic.servlet.http.RequestResponseKey, java.lang.Object) function. The servlet does not consume any
 threads while waiting for AbstractAsyncServlet.notify(weblogic.servlet.http.RequestResponseKey, java.lang.Object) to be called making it
 suitable for scalable proxying to remote systems. The servlet
 instance used for sending the response is only guaranteed to be the
 same as that used to process the request when
 SingleThreadModel is used.
Stale requests are scavanged based on timeout settings
 modifiable through AbstractAsyncServlet.setTimeout(int) and AbstractAsyncServlet.setScavangeInterval(int).
 The scavange interval is global to all
 AbstractAsyncServlets. The timeout period is
 per-servlet instance. If a timeout occurs then the AbstractAsyncServlet.doTimeout(weblogic.servlet.http.RequestResponseKey) method
 is called on an appropriate servlet instance, giving implementors a
 chance to feedback timeout information to the caller.
Only direct client requests can be used with
 AbstractAsyncServlet, it cannot be used as the target
 of request dispatching includes or forwards. It can however be used
 to dispatch to forwards and includes that are not instances of
 AbstractAsyncServlet
Servlet filters which get applied before
 AbstractAsyncServlets, will not be able to take
 advantage of post processing of the response.
| Modifier and Type | Field and Description | 
|---|---|
static int | 
DEFAULT_SCAVANGE_INTERVAL
The default interval period in milliseconds at which requests
 will be checked for timeouts. 
 | 
static int | 
DEFAULT_TIMEOUT
The default request timeout period in milliseconds. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
protected abstract boolean | 
doRequest(RequestResponseKey rrk)
Process the servlet request. 
 | 
protected abstract void | 
doResponse(RequestResponseKey rrk,
          Object context)
Process the servlet response. 
 | 
protected abstract void | 
doTimeout(RequestResponseKey rrk)
Send back a servlet response error when  
AbstractAsyncServlet.notify(weblogic.servlet.http.RequestResponseKey, java.lang.Object) is not
 called within the timeout period. | 
static void | 
notify(RequestResponseKey id,
      Object context)
notify the servlet implementation that a response should be sent
 for the key  
id. | 
protected void | 
service(HttpServletRequest req,
       HttpServletResponse rsp)
Implementation of the standard
  
HttpServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) method. | 
static void | 
setScavangeInterval(int period)
Sets the interval period in milliseconds at which requests will
 be checked for timeouts. 
 | 
protected void | 
setTimeout(int period)
Sets the request timeout period in milliseconds for this
 servlet. 
 | 
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, servicedestroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, logpublic static final int DEFAULT_TIMEOUT
public static final int DEFAULT_SCAVANGE_INTERVAL
protected final void service(HttpServletRequest req, HttpServletResponse rsp) throws IOException, ServletException
HttpServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) method. This method
 cannot be overridden, implementors should instead override
 AbstractAsyncServlet.doRequest(weblogic.servlet.http.RequestResponseKey) and AbstractAsyncServlet.doResponse(weblogic.servlet.http.RequestResponseKey, java.lang.Object).service in class HttpServletIOExceptionServletExceptionpublic static final void notify(RequestResponseKey id, Object context) throws IOException
id. id must be the key
 provided as an argument to AbstractAsyncServlet.doRequest(weblogic.servlet.http.RequestResponseKey). Then
 notify> synchronously sends out the servlet response
 after having called AbstractAsyncServlet.doResponse(weblogic.servlet.http.RequestResponseKey, java.lang.Object). Notify will pass the
 context object to AbstractAsyncServlet.doResponse(weblogic.servlet.http.RequestResponseKey, java.lang.Object), if provided
 with one.id - - the key used to identify the request/response that should be
                sent back.context - - object that will be passed onto AbstractAsyncServlet.doResponse(weblogic.servlet.http.RequestResponseKey, java.lang.Object)IOException - - if an input or output error occursprotected abstract boolean doRequest(RequestResponseKey rrk) throws IOException, ServletException
rrk - the RequestResponseKey, containing the servlet request
            and responseIOException - - if an input or output error occursServletException - - if the HTTP request cannot be handledprotected abstract void doResponse(RequestResponseKey rrk, Object context) throws IOException, ServletException
doResponse as AbstractAsyncServlet.doRequest(weblogic.servlet.http.RequestResponseKey). If an exception occurs during processing then the
 container will arrange for the error to be sent back to the
 client. The request and response streams are available in the
 RequestResponseKey. This method may get invoked on a different
 thread.rrk - - the RequestResponseKey, containing the servlet request
                and responsecontext - - the context object that was passed to AbstractAsyncServlet.notify(weblogic.servlet.http.RequestResponseKey, java.lang.Object)IOException - - if an input or output error occursServletException - - if the HTTP request cannot be handledprotected abstract void doTimeout(RequestResponseKey rrk) throws IOException, ServletException
AbstractAsyncServlet.notify(weblogic.servlet.http.RequestResponseKey, java.lang.Object) is not
 called within the timeout period. Implementors should override
 this method. There is no guarantee that the same servlet instance
 is used for processing doTimeout as AbstractAsyncServlet.doRequest(weblogic.servlet.http.RequestResponseKey). The request and response streams are available in
 the RequestResponseKey.rrk - - the RequestResponseKey, containing the servlet request and responseIOException - - if an input or output error occursServletException - - if the HTTP request cannot be handledprotected void setTimeout(int period)
GenericServlet.init(javax.servlet.ServletConfig) method. The new value applies
 only to requests started after this method call. To set the
 timeout for a specific servlet request, use RequestResponseKey.setTimeout(int)period - the timeout period in milliseconds. A timeout
               period <= 0 means that requests will never be timed out.public static final void setScavangeInterval(int period)
AbstractAsyncServlet.period - the interval period in milliseconds. A timeout
               period <= 0 is illegal.