@Override
  public final void handleRequest(
      ServerHttpRequest request,
      ServerHttpResponse response,
      WebSocketHandler wsHandler,
      SockJsSession wsSession)
      throws SockJsException {

    AbstractHttpSockJsSession sockJsSession = (AbstractHttpSockJsSession) wsSession;

    String protocol = null; // https://github.com/sockjs/sockjs-client/issues/130
    sockJsSession.setAcceptedProtocol(protocol);

    // Set content type before writing
    response.getHeaders().setContentType(getContentType());

    handleRequestInternal(request, response, sockJsSession);
  }
  @Override
  public void handleRequestInternal(
      ServerHttpRequest request,
      ServerHttpResponse response,
      AbstractHttpSockJsSession sockJsSession)
      throws SockJsException {

    try {
      String callback = request.getQueryParams().getFirst("c");
      if (!StringUtils.hasText(callback)) {
        response.setStatusCode(HttpStatus.INTERNAL_SERVER_ERROR);
        response.getBody().write("\"callback\" parameter required".getBytes("UTF-8"));
        return;
      }
    } catch (Throwable t) {
      sockJsSession.tryCloseWithSockJsTransportError(t, CloseStatus.SERVER_ERROR);
      throw new SockJsTransportFailureException("Failed to send error", sockJsSession.getId(), t);
    }

    super.handleRequestInternal(request, response, sockJsSession);
  }