Class ResponseCodeHandler

  • All Implemented Interfaces:
    HttpHandler

    public final class ResponseCodeHandler
    extends java.lang.Object
    implements HttpHandler
    A handler which simply sets a response code.
    Author:
    David M. Lloyd
    • Field Detail

      • HANDLE_200

        public static final ResponseCodeHandler HANDLE_200
        A handler which sets a 200 code. This is the default response code, so in most cases this simply has the result of finishing the request
      • HANDLE_403

        public static final ResponseCodeHandler HANDLE_403
        A handler which sets a 403 code.
      • HANDLE_404

        public static final ResponseCodeHandler HANDLE_404
        A handler which sets a 404 code.
      • HANDLE_405

        public static final ResponseCodeHandler HANDLE_405
        A handler which sets a 405 code.
      • HANDLE_406

        public static final ResponseCodeHandler HANDLE_406
        A handler which sets a 406 code.
      • HANDLE_500

        public static final ResponseCodeHandler HANDLE_500
        A handler which sets a 500 code.
    • Constructor Detail

      • ResponseCodeHandler

        public ResponseCodeHandler​(int responseCode)
        Construct a new instance.
        Parameters:
        responseCode - the response code to set
    • Method Detail

      • handleRequest

        public void handleRequest​(HttpServerExchange exchange)
                           throws java.lang.Exception
        Description copied from interface: HttpHandler
        Handle the request.
        Specified by:
        handleRequest in interface HttpHandler
        Parameters:
        exchange - the HTTP request/response exchange
        Throws:
        java.lang.Exception
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object