Construct ftp reply from response message and write reply to given session.
@param session
@param response
973769
private void writeFtpReply(FtpSession session, FtpMessage response) {
        try {
            CommandResultType commandResult = response.getPayload(CommandResultType.class);
            FtpReply reply = new DefaultFtpReply(Integer.valueOf(commandResult.getReplyCode()), commandResult.getReplyString());

            session.write(reply);
        } catch (FtpException e) {
            throw new CitrusRuntimeException("Failed to write ftp reply", e);
        }
    }
537236
private function includeResponse(string $method, string $file, ResponseInterface $response) : ResponseInterface
    {
        ob_start();
        $content = ob_get_clean();
        $this->$method($file);
        $body = $response->getBody();
        $body->write($content);
        return $response->withBody($body);
    }
171874
private static void logResponse(StatusUpdate response) {
		String text = response.getStatus();
		String message = String.format(MESSAGE_RESPONSE, text);
		System.out.println(message);
	}
554487
private void respond(BufferedWriter out, String response) throws IOException {
        out.append(response);
        out.append("\n");
        out.flush();
    }
1180006
public static void makeStringResponse(HttpResponse response, String s) {
        StringEntity entity = new StringEntity(s, ContentType.TEXT_PLAIN);
        entity.setContentEncoding("utf-8");
        response.setEntity(entity);
    }
423638
private void writeNoContentResponse(final HttpServletResponse response) throws IOException {
		response.setStatus(HttpServletResponse.SC_NO_CONTENT);
		response.setContentType("image/gif");

		final PrintWriter out = response.getWriter();
		out.flush();
	}
960144
public synchronized void setResponse(HttpServletResponse response) {

        if (perThreadResponse == null) {
            perThreadResponse = new ThreadLocal<HttpServletResponse>();
        }
        perThreadResponse.set(response);
    }
638697
public void writeTo(HttpServletResponse response) {
		long time = System.currentTimeMillis();
		long processTime = time - contextTsCurrent.get();
		long processTimeTotal = contextMsProcess.get() + processTime;
		long networkTimeTotal = contextMsNetwork.get();
		
		StringBuilder cookiesDump = new StringBuilder();
		for (Entry<String, Cookie> entry : responseCookies.get().entrySet()) {
			javax.servlet.http.Cookie c = buildServletCookie(entry.getKey(), entry.getValue());
			response.addCookie(c);
			cookiesDump.append(c.toString()).append(";");
		}
		
		if (verbose) log.info("<<< Time total " + String.valueOf(time - contextTsStart.get()) + " (+" + processTime + "p " + processTimeTotal + "p " + networkTimeTotal + "n)" + " [" + contextUrl.get() + "]" + ". Set-Cookie to client: " + cookiesDump.toString());
	}
237702
public void releaseResponse(HttpResponseMessageImpl response) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "releaseResponse: " + response);
        }
        this.respPool.put(response);
    }
482911
public void sendResponse(int code, String response) {
        if(con.isClosed()) return;

        if(response == null || response.isEmpty()) {
            response = "Unknown";
        }

        try {
            if(response.charAt(0) == '-') {
                writer.write(code + response + "\r\n");
            } else {
                writer.write(code + " " + response + "\r\n");
            }
            writer.flush();
        } catch(IOException ex) {
            Utils.closeQuietly(this);
        }
        responseSent = true;
    }
364962
@Override
    synchronized public void sendResponse(ReplyHeader h, Record r, String tag) {
        try {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            // Make space for length
            BinaryOutputArchive bos = BinaryOutputArchive.getArchive(baos);
            try {
                baos.write(fourBytes);
                bos.writeRecord(h, "header");
                if (r != null) {
                    bos.writeRecord(r, tag);
                }
                baos.close();
            } catch (IOException e) {
                LOG.error("Error serializing response");
            }
            byte b[] = baos.toByteArray();
            ByteBuffer bb = ByteBuffer.wrap(b);
            bb.putInt(b.length - 4).rewind();
            sendBuffer(bb);
            if (h.getXid() > 0) {
                synchronized(this){
                    outstandingRequests--;
                }
                // check throttling
                synchronized (this.factory) {
                    if (zk.getInProcess() < factory.outstandingLimit
                            || outstandingRequests < 1) {
                        sk.selector().wakeup();
                        enableRecv();
                    }
                }
            }
         } catch(Exception e) {
            LOG.warn("Unexpected exception. Destruction averted.", e);
         }
    }
911999
@Transactional
	public void save(Response response) {
		Response merged = em.merge(response);
		em.flush();
		response.setId(merged.getId());
	}
225279
public static void write(HttpServletResponse response, InputStream in, String contentType) {
		response.setContentType(contentType);
		write(response, in);
	}
1026841
public static void write(HttpServletResponse response, InputStream in) {
		write(response, in, IoUtil.DEFAULT_BUFFER_SIZE);
	}
225126
private void reply(final String response, final boolean error,
            final String errorMessage, final String stackTrace,
            final String statusCode, final int statusCodeInt) {

        
        if (!sentReply) {
            
            //must update sentReply first to avoid duplicated msg.
            sentReply = true;
            // Close the connection. Make sure the close operation ends because
            // all I/O operations are asynchronous in Netty.
            if(channel!=null && channel.isOpen())
                channel.close().awaitUninterruptibly();
            final ResponseOnSingeRequest res = new ResponseOnSingeRequest(
                    response, error, errorMessage, stackTrace, statusCode,
                    statusCodeInt, PcDateUtils.getNowDateTimeStrStandard(), null);
            if (!getContext().system().deadLetters().equals(sender)) {
                sender.tell(res, getSelf());
            }
            if (getContext() != null) {
                getContext().stop(getSelf());
            }
        }

    }
781401
private function encodeUserSessionResponse(UserSessionResponseInterface $action_result, ServerRequestInterface $request, ResponseInterface $response)
    {
        if ($action_result->getAuthenticatedWith() instanceof  SessionInterface) {
            $response = $this->getCookiesProvider()->set($request, $response, $this->getUserSessionIdCookieName(), $action_result->getAuthenticatedWith()->getSessionId(), [
                'ttl' => 1209600,
                'http_only' => true,
            ])[1];
        }

        return $this->encodeArray($action_result->toArray(), $response);
    }
846915
protected void receiveClientResponse(HttpMessage response) {
        runner.http(action -> {
            HttpClientResponseActionBuilder responseBuilder = action.client(httpClient).receive()
                .response(response.getStatusCode())
                .message(response);

            for (Map.Entry<String, String> headerEntry : pathValidations.entrySet()) {
                responseBuilder.validate(headerEntry.getKey(), headerEntry.getValue());
            }
            pathValidations.clear();
        });
    }