|
![]() |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsunlabs.brazil.handler.ReflectHandler (view source)
public class ReflectHandler
Handler for reflecting query data back to the client. This is the example handler to demonstrate how a typical handler is witten. If query data is present, it is formatted into an HTML table, and displayed to the user.
Constructor Summary | |
---|---|
ReflectHandler()
|
Method Summary | |
---|---|
static String |
formatTable(Dictionary data,
String caption)
Turn a hash table into html format. |
boolean |
init(Server server,
String prefix)
Initialize the handler. |
boolean |
respond(Request request)
Dispatch and handle the request. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ReflectHandler()
Method Detail |
---|
public boolean init(Server server, String prefix)
init
in interface Handler
server
- A reference to the server.prefix
- A string identifying this instance of the
handler. It is used by the
ChainHandler
to
provide the prefix to be prepended onto each
property intended for this handler.
public boolean respond(Request request) throws IOException
CgiHandler
to allow HTML forms to be tested before
the cgi script is written.
respond
in interface Handler
request
- The request object contains all of the information
about the request, as well as methods to manipulate
it. Although multiple threads may call this method
connurrently, each will have its own request object.
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
.
IOException
- if there was an I/O error while sending the response to
the client. Typically, in that case, the Server
will (try to) send an error message to the client and then
close the client's connection.
The IOException
should not be used to silently
ignore problems such as being unable to access some
server-side resource (for example getting a
FileNotFoundException
due to not being able
to open a file). In that case, the Handler
's
duty is to turn that IOException
into a
HTTP response indicating, in this case, that a file could
not be found.
public static String formatTable(Dictionary data, String caption)
data
- The table to formatcaption
- The table caption
|
Version Kenai-svn-r24, Generated 08/18/09 Copyright (c) 2001-2009, Sun Microsystems. |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |