Class RequestHandler

java.lang.Object
com.pixelservices.flash.components.http.RequestHandler
Direct Known Subclasses:
BaseHandler, SimpleHandlerWrapper

public abstract class RequestHandler extends Object
Base class for all request handlers
  • Field Details

  • Constructor Details

    • RequestHandler

      public RequestHandler(Request req, Response res)
      Constructor for RequestHandler
      Parameters:
      req - The Request object
      res - The Response object
  • Method Details

    • getHandlerName

      public String getHandlerName()
    • isEnforcedNonNullBody

      public boolean isEnforcedNonNullBody()
      Check if the enforceNonNullBody flag is set in the RouteInfo annotation
      Returns:
      True if the enforceNonNullBody flag is set, false otherwise
    • getRequestBody

      public org.json.JSONObject getRequestBody()
      Get the request body as a JSONObject
      Returns:
      The request body as a JSONObject
    • getRouteParameters

      public Map<String,String> getRouteParameters()
    • getRequestBody

      public static org.json.JSONObject getRequestBody(Request req)
      Get the request object
      Returns:
      The request object
    • expectedRequestParameter

      public ExpectedRequestParameter expectedRequestParameter(String parameterName, String description)
      Specify an expected request parameter with description
      Parameters:
      parameterName - The name of the parameter
      description - The description of the parameter
      Returns:
      The ExpectedRequestParameter object
    • expectedRequestParameter

      public ExpectedRequestParameter expectedRequestParameter(String parameterName)
      Specify an expected request parameter
      Parameters:
      parameterName - The name of the parameter
      Returns:
      The ExpectedRequestParameter object
    • expectedBodyField

      public ExpectedBodyField expectedBodyField(String fieldName, String description)
      Specify an expected body field with description
      Parameters:
      fieldName - The name of the field
      description - The description of the field
      Returns:
      The ExpectedBodyField object
    • expectedBodyField

      public ExpectedBodyField expectedBodyField(String fieldName)
      Specify an expected body field
      Parameters:
      fieldName - The name of the field
      Returns:
      The ExpectedBodyField object
    • expectedBodyFile

      public ExpectedBodyFile expectedBodyFile(String fieldName, String description)
      Specify an expected body file with description
      Parameters:
      fieldName - The name of the file
      description - The description of the file
      Returns:
      The ExpectedBodyFile object
    • expectedBodyFile

      public ExpectedBodyFile expectedBodyFile(String fieldName)
      Specify an expected body file
      Parameters:
      fieldName - The name of the file
      Returns:
      The ExpectedBodyFile object
    • getRequest

      public Request getRequest()
      Get the request object
      Returns:
      The request object
    • getResponse

      public Response getResponse()
      Get the response object
      Returns:
      The response object
    • getExpectedRequestParameters

      public Map<String,ExpectedRequestParameter> getExpectedRequestParameters()
      Returns:
      The expected request parameters
    • getExpectedBodyFields

      public Map<String,ExpectedBodyField> getExpectedBodyFields()
      Returns:
      The expected body fields
    • getExpectedBodyFiles

      public Map<String,ExpectedBodyFile> getExpectedBodyFiles()
      Returns:
      The expected body files
    • setRequestResponse

      public void setRequestResponse(Request req, Response res)
      Set the request and response objects
      Parameters:
      req - The request object
      res - The response object
    • getSpecification

      public HandlerSpecification getSpecification()
      Get the handler specification
      Returns:
      The handler specification
    • setSpecification

      public void setSpecification(HandlerSpecification specification)
      Sets the handler specification
      Parameters:
      specification - The handler specification
    • getHandlerType

      public HandlerType getHandlerType()
      Get the handler type
      Returns:
      The handler type
    • setHandlerType

      public void setHandlerType(HandlerType handlerType)
      Sets the handler type (package-private)
      Parameters:
      handlerType - The handler type
    • handle

      public abstract Object handle()
      Handle the request
      Returns:
      The response object