public class RePollHandler extends PollHandler
Properties:
If the name "X" is used, no property will be extracted for that match.
First remote content is obtained. Then each regular expression token is processed in turn for the purpose of extracting portions of that content into server properties. [re].sub is used to transform the content before attempting to extract properties.
Content is extracted into the following properties.
Modifier and Type | Class and Description |
---|---|
static class |
RePollHandler.Extract
A "bag" to store regular expression extraction instructions
|
interval, post, url
Constructor and Description |
---|
RePollHandler() |
Modifier and Type | Method and Description |
---|---|
void |
fillProps(java.util.Properties props,
HttpRequest target)
Fill the properties by extracting fields from the response.
|
boolean |
init(Server server,
java.lang.String prefix)
Set up the initial configuration, and kick off a thread
to periodically fetch the url.
|
void |
processText(java.util.Properties props,
java.lang.String data)
Process the contents as a string through the regular expressions.
|
boolean |
respond(Request request)
Allow The url and post data (if any) to be changed.
|
run
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
public boolean init(Server server, java.lang.String prefix)
PollHandler
init
in interface Handler
init
in class PollHandler
server
- The HTTP server that created this Handler
.
Typical Handler
s will use Server.props
to obtain run-time configuration information.prefix
- The handlers name.
The string this Handler
may prepend to all
of the keys that it uses to extract configuration information
from Server.props
. This is set (by the Server
and ChainHandler
) to help avoid configuration parameter
namespace collisions.true
if this Handler
initialized
successfully, false
otherwise. If
false
is returned, this Handler
should not be used.public boolean respond(Request request)
respond
in interface Handler
respond
in class PollHandler
request
- The Request
object that represents the HTTP
request.true
if the request was handled. A request was
handled if a response was supplied to the client, typically
by calling Request.sendResponse()
or
Request.sendError
.public void fillProps(java.util.Properties props, HttpRequest target) throws java.io.IOException
fillProps
in class PollHandler
java.io.IOException
public void processText(java.util.Properties props, java.lang.String data)