Class DialogHandler

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, Handler

public class DialogHandler extends Applet implements Handler
Sample handler for popping up a dialog box on the server. This is used for interactive authentication of web pages, allowing an operator on the server's computer to allow or deny access to pages on a per request basis. Input parameters examined in the request properties:
prefix, suffix, glob, match
Specify the URL that triggers this handler. (See MatchString).
default
The message to appear in the dialog box. Defaults to Request from Client.
denied
The message to appear in the "permission denied" spot.
If query data is present, it is used as the message.

Note: This is the only class in the entire system that requires AWT.

Version:
2.2, 06/11/13
Author:
Stephen Uhler
See Also:
  • Field Details

    • frame_1

      public Panel frame_1
    • ok

      public Button ok
    • title

      public Label title
    • cancel

      public Button cancel
  • Constructor Details

    • DialogHandler

      public DialogHandler()
  • Method Details

    • init

      public boolean init(Server server, String prefix)
      Do one time initialization.
      Specified by:
      init in interface Handler
      Parameters:
      server - The HTTP server that created this Handler. Typical Handlers 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.
      Returns:
      true if this Handler initialized successfully, false otherwise. If false is returned, this Handler should not be used.
    • respond

      public boolean respond(Request request) throws IOException
      Pop up a dialog box on the server machine. Allow the operator to select yes or no. If the request is allowed, it is passed on to the next handler.
      Specified by:
      respond in interface Handler
      Parameters:
      request - The Request object that represents the HTTP request.
      Returns:
      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.
      Throws:
      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.

    • dismiss

      public void dismiss(boolean how)
    • init

      public void init()
      Machine generated code. Everything after here was automatically generated SpecTcl generated class Dialog, version 1.0
      Overrides:
      init in class Applet
    • handleEvent

      public boolean handleEvent(Event event)
      Overrides:
      handleEvent in class Component