|
Oracle | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectHttpServlet
weblogic.servlet.http.AbstractAsyncServlet
public abstract class AbstractAsyncServlet
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
AbstractAsyncServlet
s. 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
AbstractAsyncServlet
s, will not be able to take
advantage of post processing of the response.
Field Summary | |
---|---|
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. |
Constructor Summary | |
---|---|
AbstractAsyncServlet()
|
Method Summary | |
---|---|
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 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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_TIMEOUT
public static final int DEFAULT_SCAVANGE_INTERVAL
Constructor Detail |
---|
public AbstractAsyncServlet()
Method Detail |
---|
protected final void service(HttpServletRequest req, HttpServletResponse rsp) throws IOException, ServletException
HttpServlet
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)
.
IOException
ServletException
public 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 response
IOException
- - if an input or output error occurs
ServletException
- - 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 occurs
ServletException
- - 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 response
IOException
- - if an input or output error occurs
ServletException
- - if the HTTP request cannot be handledprotected void setTimeout(int period)
GenericServlet
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.
|
Documentation is available at http://download.oracle.com/docs/cd/E12839_01/web.1111 Copyright 1996,2009, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Part Number E13941-01 Oracle WebLogic Server 10.3.1 API Reference |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |