Class RootResponder

java.lang.Object
net.targetr.rc.RootResponder
All Implemented Interfaces:
HttpInterception, ResponseGenerator

public class RootResponder extends Object implements ResponseGenerator, HttpInterception
Responds to HTTP requests base on URI.
Author:
Dr Michael Gardiner
  • Field Details

  • Constructor Details

    • RootResponder

      public RootResponder()
      Constructs the RootResponder, initializing supplementary handlers.
  • Method Details

    • generate

      public HttpResponse generate(HttpRequest httpReq) throws Exception
      Dispatches the incoming HTTP request and returns an appropriate response. Performs top-level routing based primarily on path semantics.
      Specified by:
      generate in interface ResponseGenerator
      Parameters:
      httpReq - the incoming request
      Returns:
      the generated web response
      Throws:
      Exception - if response processing encounters an error
    • isValidApp

      public static boolean isValidApp(String app)
      Verifies whether the specified app is recognized.
      Parameters:
      app - the app name to test
      Returns:
      true if the app index.html file exists
    • getAppIndexPage

      public static String getAppIndexPage(String app)
      Returns the location of an apps index page.
      Parameters:
      app - the app name to search for
      Returns:
      location of index page
    • getInterceptor

      public HttpInterceptor getInterceptor()
      Description copied from interface: HttpInterception
      Used by HTTPHandler to get an HttpInterceptor to handle callbacks during HTTP communications.
      Specified by:
      getInterceptor in interface HttpInterception
      Returns:
      for intercepting communications