private HttpHandler validate(final HttpServletRequest request,
                               final HttpServletResponse response,
                               final ParsedHttpRequest parsedHttpRequest) throws IOException, ServletException {
    final String specification = parsedHttpRequest.getTargetSpecification();
    final String version = parsedHttpRequest.getVersion();

    if (specification == null) {
      writeMessage(response, "Specification is not provided in the request.", HttpServletResponse.SC_BAD_REQUEST);
      return null;
    }

    final HttpHandler handler = eventHandlers.get(specification.toLowerCase());
    if (handler == null) {
      writeMessage(response, String.format("No event handler registered for: [%s].", specification),
          HttpServletResponse.SC_NOT_FOUND);
      return null;
    }

    if (version == null) {
      writeMessage(response, "Version is not provided in the request.", HttpServletResponse.SC_BAD_REQUEST);
      return null;
    }
    return handler;
  }
private HttpHandler validate ( final HttpServletRequest request , final HttpServletResponse response , final ParsedHttpRequest parsedHttpRequest ) throws IOException , ServletException { final String specification = parsedHttpRequest . getTargetSpecification ( ) ; final String version = parsedHttpRequest . getVersion ( ) ; if ( specification == null ) { writeMessage ( response , "Specification is not provided in the request." , HttpServletResponse . SC_BAD_REQUEST ) ; return null ; } final HttpHandler handler = eventHandlers . get ( specification . toLowerCase ( ) ) ; if ( handler == null ) { writeMessage ( response , String . format ( "No event handler registered for: [%s]." , specification ) , HttpServletResponse . SC_NOT_FOUND ) ; return null ; } if ( version == null ) { writeMessage ( response , "Version is not provided in the request." , HttpServletResponse . SC_BAD_REQUEST ) ; return null ; } return handler ; }
Validate request and get http handler for the request.

@param request
@param response
@return
@throws IOException
@throws ServletException