This method doesn't save content of request but instead uses data from parameter.
This should be used in case that data from request was already read and therefore it is not possible to save them.

@param exchange
@param bytes
@param contentLength
179046
protected void storeInitialLocation(final HttpServerExchange exchange, byte[] bytes, int contentLength) {
        if(!saveOriginalRequest) {
            return;
        }
        final ServletRequestContext servletRequestContext = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY);
        HttpSessionImpl httpSession = servletRequestContext.getCurrentServletContext().getSession(exchange, true);
        Session session;
        if (System.getSecurityManager() == null) {
            session = httpSession.getSession();
        } else {
            session = AccessController.doPrivileged(new HttpSessionImpl.UnwrapSessionAction(httpSession));
        }
        SessionManager manager = session.getSessionManager();
        if (seenSessionManagers.add(manager)) {
            manager.registerSessionListener(LISTENER);
        }
        session.setAttribute(SESSION_KEY, RedirectBuilder.redirect(exchange, exchange.getRelativePath()));
        if(bytes == null) {
            SavedRequest.trySaveRequest(exchange);
        } else {
            SavedRequest.trySaveRequest(exchange, bytes, contentLength);
        }
    }
18450
@JsonIgnore
    public void encodeAndSetContent(String content) {
        encodeAndSetContent(content != null ? content.getBytes() : null);
    }
103321
public void setContent(final byte[] content,
                         final String contentType) throws HttpException {
    if (!(method instanceof HttpEntityEnclosingRequestBase)) {
      throw new HttpException("Invalid operation for method " +
                               method.getMethod());
    }

    final HttpEntityEnclosingRequestBase eem = (HttpEntityEnclosingRequestBase)method;

    ByteArrayEntity entity = new ByteArrayEntity(content);
    entity.setContentType(contentType);
    eem.setEntity(entity);
  }
151037
@Override
    public void handleRequest(final HttpServerExchange exchange) throws Exception {
        if(exchange.isInIoThread()) {
            exchange.dispatch(this);
            return;
        }
        SecurityContext context = exchange.getSecurityContext();
        if (context.authenticate()) {
            if(!exchange.isComplete()) {
               next.handleRequest(exchange);
            }
        } else {
            exchange.endExchange();
        }
    }
175354
void updateBytesSent(long bytes) {
        if(Connectors.isEntityBodyAllowed(this) && !getRequestMethod().equals(Methods.HEAD)) {
            responseBytesSent += bytes;
        }
    }
594908
@Override
    public void handleRequest(HttpServerExchange exchange) throws Exception {
        if ( exchange.getRequestMethod() != Methods.POST ) {
            exchange.setResponseCode(404);
            exchange.endExchange();
            return;
        }
        String rpath = exchange.getRelativePath();

        StreamSourceChannel requestChannel = exchange.getRequestChannel();
        String first = exchange.getRequestHeaders().getFirst(Headers.CONTENT_LENGTH);
        int len = Integer.parseInt(first);

        // read post data.
        ByteBuffer buf = ByteBuffer.allocate(len);
        requestChannel.getReadSetter().set( streamSourceChannel -> {
                try {
                    streamSourceChannel.read(buf);
                } catch (IOException e) {
                    Log.Warn(this,e);
                }
                if ( buf.remaining() == 0 ) {
                    try {
                        requestChannel.shutdownReads();
                    } catch (IOException e) {
                        Log.Warn(this,e);
                    }
                    facade.execute( () -> requestReceived( exchange, buf.array(), rpath ) );
                }
            }
        );
        requestChannel.resumeReads();
    }
863900
private static boolean shouldDecode(final HttpServerExchange exchange) {
        return !exchange.getConnection().getUndertowOptions().get(UndertowOptions.DECODE_URL, true)
                && exchange.putAttachment(ALREADY_DECODED, Boolean.TRUE) == null;
    }
1107288
public void setContent(Content content) {
        setSize(content.getContent().length);
        setAttachmentContentId(content.getId());
    }
451924
int getContentLength(HttpURLConnection conn) {
    String transferEncoding = conn.getHeaderField(TRANSFER_ENCODING);
    if (transferEncoding == null || transferEncoding.equalsIgnoreCase("chunked")) {
      return conn.getHeaderFieldInt(CONTENT_LENGTH, -1);
    } else {
      return -1;
    }
  }
992283
public void setContentType(String contentType) 
    {
        if (isCommitted() || contentType==null)
            return;
        
        int semi=contentType.indexOf(';');
        if (semi>0)
        {
            int charset0=contentType.indexOf("charset=",semi);
            if (charset0>0)
            {
                if (_outputState==WRITER_OUT)
                {
                    // need to strip charset= from params
                    int charset1=contentType.indexOf(' ',charset0);
                    
                    if ((charset0==semi+1 && charset1<0) ||
                        (charset0==semi+2 && charset1<0 && contentType.charAt(semi+1)==' ' ))
                        _httpResponse.setContentType(contentType.substring(0,semi));
                    else if (charset1<0)
                        _httpResponse.setContentType(contentType.substring(0, charset0).trim());
                    else
                        _httpResponse.setContentType(contentType.substring(0, charset0)+contentType.substring(charset1));
                }
                else
                {
                    _charEncodingSetInContentType=true;
                    _httpResponse.setContentType(contentType);
                }
            }
            else
                _httpResponse.setContentType(contentType);
        }
        else
            _httpResponse.setContentType(contentType);
        
        if (_locale!=null)
            setLocale(_locale);
    }
754571
public static HttpResponse request(HttpRequest request, String body, String contentType) {
        return request.contentType(contentType).body(body).contentLength(body.length()).execute();
    }
663227
@Override
	protected void addContent(URLConnection con) throws IOException {
		con.setDoOutput(true);
		con.addRequestProperty("Content-Type", mime);
		con.addRequestProperty("Content-Length", String.valueOf(content.length));
		OutputStream os = con.getOutputStream();
		writeContent(os);
		os.close();
	}
777928
public static void sendContinueResponseBlocking(final HttpServerExchange exchange) throws IOException {
        if (!exchange.isResponseChannelAvailable()) {
            throw UndertowMessages.MESSAGES.cannotSendContinueResponse();
        }
        if(exchange.getAttachment(ALREADY_SENT) != null) {
            return;
        }
        HttpServerExchange newExchange = exchange.getConnection().sendOutOfBandResponse(exchange);
        exchange.putAttachment(ALREADY_SENT, true);
        newExchange.setStatusCode(StatusCodes.CONTINUE);
        newExchange.getResponseHeaders().put(Headers.CONTENT_LENGTH, 0);
        newExchange.startBlocking();
        newExchange.getOutputStream().close();
        newExchange.getInputStream().close();
    }
848328
public static void put(String extension, String contentType) {
        if (extension != null && extension.length() != 0
                && contentType != null && contentType.length() != 0) {

            contentTypes.put(extension, contentType);
        }
    }
218709
def _init_length(self, request_method):
        
        length = self.headers.get('content-length')

        if length is not None:
            if self.chunked:
                # This Response will fail with an IncompleteRead if it can't be
                # received as chunked. This method falls back to attempt reading
                # the response before raising an exception.
                log.warning("Received response with both Content-Length and "
                            "Transfer-Encoding set. This is expressly forbidden "
                            "by RFC 7230 sec 3.3.2. Ignoring Content-Length and "
                            "attempting to process response as Transfer-Encoding: "
                            "chunked.")
                return None

            try:
                # RFC 7230 section 3.3.2 specifies multiple content lengths can
                # be sent in a single Content-Length header
                # (e.g. Content-Length: 42, 42). This line ensures the values
                # are all valid ints and that as long as the `set` length is 1,
                # all values are the same. Otherwise, the header is invalid.
                lengths = set([int(val) for val in length.split(',')])
                if len(lengths) > 1:
                    raise InvalidHeader("Content-Length contained multiple "
                                        "unmatching values (%s)" % length)
                length = lengths.pop()
            except ValueError:
                length = None
            else:
                if length < 0:
                    length = None

        # Convert status to int for comparison
        # In some cases, httplib returns a status of "_UNKNOWN"
        try:
            status = int(self.status)
        except ValueError:
            status = 0

        # Check for responses that shouldn't include a body
        if status in (204, 304) or 100 <= status < 200 or request_method == 'HEAD':
            length = 0

        return length
29654
protected void handleRegularRequest(HttpServerExchange exchange, HttpObjectSocket httpObjectSocket, Object[] received, StreamSinkChannel sinkchannel) {
        ArrayList<IPromise> futures = new ArrayList<>();
        httpObjectSocket.getSink().receiveObject(received, futures, exchange.getRequestHeaders().getFirst("JWT") );

        Runnable reply = () -> {
            // piggy back outstanding lp messages, outstanding lp request is untouched
            Pair<byte[], Integer> nextQueuedMessage = httpObjectSocket.getNextQueuedMessage();
            byte response[] = nextQueuedMessage.getFirst();
            exchange.setResponseContentLength(response.length);
            if (response.length == 0) {
                exchange.endExchange();
            } else {
                httpObjectSocket.storeLPMessage(nextQueuedMessage.cdr(), response);

                //FIXME: ASYNC !!!
                long tim = System.nanoTime();
                ByteBuffer responseBuf = ByteBuffer.wrap(response);
                try {
                    while (responseBuf.remaining()>0) {
                        sinkchannel.write(responseBuf);
                    }
                } catch (IOException e) {
                    Log.Warn(this,e);
                }
//                System.out.println("syncwrite time micros:"+(System.nanoTime()-tim)/1000);
                exchange.endExchange();
            }
        };
        if ( futures == null || futures.size() == 0 ) {
            reply.run();
        } else {
            Actors.all((List) futures).timeoutIn(REQUEST_RESULTING_FUTURE_TIMEOUT).then( () -> {
                reply.run();
            }).onTimeout( () -> reply.run() );
            sinkchannel.resumeWrites();
        }
    }
1358117
private void setLength(long newLength) throws IOException {
    // Set new file length (considered metadata) and sync it to storage.
    raf.setLength(newLength);
    raf.getChannel().force(true);
  }