docs: @SuppressWarnings("unused")
      final void handlePath(ByteBuffer buffer, ParseState state, HttpServerExchange exchange) throws BadRequestException {
          StringBuilder stringBuilder = state.stringBuilder;
          int parseState = state.parseState;
          int canonicalPathStart = state.pos;
          boolean urlDecodeRequired = state.urlDecodeRequired;
  
          while (buffer.hasRemaining()) {
              char next = (char) (buffer.get() & 0xFF);
              if(!allowUnescapedCharactersInUrl && !ALLOWED_TARGET_CHARACTER[next]) {
                  throw new BadRequestException(UndertowMessages.MESSAGES.invalidCharacterInRequestTarget(next));
              }
              if (next == ' ' || next == '\t') {
                  if (stringBuilder.length() != 0) {
                      final String path = stringBuilder.toString();
                      if(parseState == SECOND_SLASH) {
                          exchange.setRequestPath("/");
                          exchange.setRelativePath("/");
                          exchange.setRequestURI(path);
                      } else if (parseState < HOST_DONE) {
                          String decodedPath = decode(path, urlDecodeRequired, state, allowEncodedSlash, false);
                          exchange.setRequestPath(decodedPath);
                          exchange.setRelativePath(decodedPath);
                          exchange.setRequestURI(path);
                      } else {
                          handleFullUrl(state, exchange, canonicalPathStart, urlDecodeRequired, path);
                      }
                      exchange.setQueryString("");
                      state.state = ParseState.VERSION;
                      state.stringBuilder.setLength(0);
                      state.parseState = 0;
                      state.pos = 0;
                      state.urlDecodeRequired = false;
                      return;
                  }
              } else if (next == '\r' || next == '\n') {
                  throw UndertowMessages.MESSAGES.failedToParsePath();
              } else if (next == '?' && (parseState == START || parseState == HOST_DONE || parseState == IN_PATH)) {
                  beginQueryParameters(buffer, state, exchange, stringBuilder, parseState, canonicalPathStart, urlDecodeRequired);
                  return;
              } else if (next == ';' && (parseState == START || parseState == HOST_DONE || parseState == IN_PATH)) {
                  beginPathParameters(state, exchange, stringBuilder, parseState, canonicalPathStart, urlDecodeRequired);
                  handlePathParameters(buffer, state, exchange);
                  return;
              } else {
  
                  if (decode && (next == '%' || next > 127)) {
                      urlDecodeRequired = true;
                  } else if (next == ':' && parseState == START) {
                      parseState = FIRST_COLON;
                  } else if (next == '/' && parseState == FIRST_COLON) {
                      parseState = FIRST_SLASH;
                  } else if (next == '/' && parseState == FIRST_SLASH) {
                      parseState = SECOND_SLASH;
                  } else if (next == '/' && parseState == SECOND_SLASH) {
                      parseState = HOST_DONE;
                      canonicalPathStart = stringBuilder.length();
                  } else if (parseState == FIRST_COLON || parseState == FIRST_SLASH) {
                      parseState = IN_PATH;
                  } else if (next == '/' && parseState != HOST_DONE) {
                      parseState = IN_PATH;
                  }
                  stringBuilder.append(next);
              }
  
          }
          state.parseState = parseState;
          state.pos = canonicalPathStart;
          state.urlDecodeRequired = urlDecodeRequired;
      }