QHttpServerResponse Class

HTTP 응답을 캡슐화합니다. 더 보기...

헤더: #include <QHttpServerResponse>
CMake: find_package(Qt6 REQUIRED COMPONENTS HttpServer)
target_link_libraries(mytarget PRIVATE Qt6::HttpServer)
qmake: QT += httpserver
이후: Qt 6.4

공용 형

공용 함수

QHttpServerResponse(QHttpServerResponse::StatusCode statusCode)
QHttpServerResponse(QByteArray &&data, QHttpServerResponse::StatusCode status = StatusCode::Ok)
QHttpServerResponse(const QByteArray &data, QHttpServerResponse::StatusCode status = StatusCode::Ok)
QHttpServerResponse(const QJsonArray &data, QHttpServerResponse::StatusCode status = StatusCode::Ok)
QHttpServerResponse(const QJsonObject &data, QHttpServerResponse::StatusCode status = StatusCode::Ok)
QHttpServerResponse(const QString &data, QHttpServerResponse::StatusCode status = StatusCode::Ok)
QHttpServerResponse(const char *data, QHttpServerResponse::StatusCode status = StatusCode::Ok)
QHttpServerResponse(const QByteArray &mimeType, QByteArray &&data, QHttpServerResponse::StatusCode status = StatusCode::Ok)
QHttpServerResponse(const QByteArray &mimeType, const QByteArray &data, QHttpServerResponse::StatusCode status = StatusCode::Ok)
QHttpServerResponse(QHttpServerResponse &&other)
~QHttpServerResponse()
QByteArray data() const
(since 6.8) QHttpHeaders headers() const
QByteArray mimeType() const
(since 6.8) void setHeaders(QHttpHeaders &&newHeaders)
(since 6.8) void setHeaders(const QHttpHeaders &newHeaders)
QHttpServerResponse::StatusCode statusCode() const
void swap(QHttpServerResponse &other)
QHttpServerResponse &operator=(QHttpServerResponse &&other)

정적 공용 멤버

QHttpServerResponse fromFile(const QString &fileName)

상세 설명

HTTP 서버로부터 응답을 생성, 읽기, 수정하고 그 내용을 QHttpServerResponder 에 쓰기 위한 API로, 다양한 생성자와 파일 내용으로부터 응답을 생성하는 static 함수 fromFile 가 있습니다. 헤더를 설정, 가져오기, 제거하기 위한 함수와 데이터, 상태 코드, 마임 타입을 가져오기 위한 함수가 있습니다.

멤버 타입 문서

[alias] QHttpServerResponse::StatusCode

에 대한 유형 별칭 QHttpServerResponder::StatusCode

멤버 함수 문서

QHttpServerResponse::QHttpServerResponse(const QByteArray &mimeType, QByteArray &&data, QHttpServerResponse::StatusCode status = StatusCode::Ok)

QHttpServerResponse::QHttpServerResponse(const QByteArray &mimeType, const QByteArray &data, QHttpServerResponse::StatusCode status = StatusCode::Ok)

QHttpServer 응답을 생성합니다.

응답은 주어진 status 코드를 사용하여 data 을 본문으로 전달하며, ContentType 헤더는 MIME 유형임을 설명하는 mimeType 을 사용합니다.

QHttpServerResponse::QHttpServerResponse(QHttpServerResponse::StatusCode statusCode)

상태 코드 statusCode 로 QHttpServerResponse 객체를 생성합니다.

QHttpServerResponse::QHttpServerResponse(QByteArray &&data, QHttpServerResponse::StatusCode status = StatusCode::Ok)

Move - 상태 코드 status 와 함께 주어진 data 을 포함하는 QHttpServerResponse를 본문으로 구성합니다.

QHttpServerResponse::QHttpServerResponse(const QByteArray &data, QHttpServerResponse::StatusCode status = StatusCode::Ok)

상태 코드 status 를 사용하여 data 에서 QHttpServerResponse 객체를 생성합니다.

QHttpServerResponse::QHttpServerResponse(const QJsonArray &data, QHttpServerResponse::StatusCode status = StatusCode::Ok)

상태 코드 status 를 사용하여 data 에서 QHttpServerResponse 객체를 생성합니다.

QHttpServerResponse::QHttpServerResponse(const QJsonObject &data, QHttpServerResponse::StatusCode status = StatusCode::Ok)

상태 코드 status 를 사용하여 data 에서 QHttpServerResponse 객체를 생성합니다.

QHttpServerResponse::QHttpServerResponse(const QString &data, QHttpServerResponse::StatusCode status = StatusCode::Ok)

상태 코드 status 를 사용하여 data 에서 QHttpServerResponse 객체를 생성합니다.

QHttpServerResponse::QHttpServerResponse(const char *data, QHttpServerResponse::StatusCode status = StatusCode::Ok)

상태 코드 status 를 사용하여 data 에서 QHttpServerResponse 객체를 생성합니다.

[noexcept] QHttpServerResponse::QHttpServerResponse(QHttpServerResponse &&other)

이동 - other 에서 새 QHttpServerResponse를 구성합니다.

[noexcept] QHttpServerResponse::~QHttpServerResponse()

QHttpServerResponse 객체를 삭제합니다.

QByteArray QHttpServerResponse::data() const

응답 본문을 반환합니다.

[static] QHttpServerResponse QHttpServerResponse::fromFile(const QString &fileName)

fileName 파일의 내용에서 QHttpServerResponse 를 반환합니다.

파일 이름을 정상적으로 확인하고 서버가 요청할 파일에 대한 정책을 잘 정의하는 것은 호출자의 책임입니다.

[since 6.8] QHttpHeaders QHttpServerResponse::headers() const

현재 설정된 HTTP 헤더를 반환합니다.

이 함수는 Qt 6.8에 도입되었습니다.

setHeaders()도 참조하십시오 .

QByteArray QHttpServerResponse::mimeType() const

HTTP "Content-Type" 헤더의 값을 반환합니다.

참고: 기본값은 "text/html"입니다.

[since 6.8] void QHttpServerResponse::setHeaders(QHttpHeaders &&newHeaders)

newHeaders 을 HTTP 헤더로 설정하여 이전에 설정된 모든 헤더를 재정의합니다.

이 함수는 Qt 6.8에 도입되었습니다.

headers()도 참조하세요 .

[since 6.8] void QHttpServerResponse::setHeaders(const QHttpHeaders &newHeaders)

이 함수는 오버로드된 함수입니다.

이 함수는 Qt 6.8에 도입되었습니다.

QHttpServerResponse::StatusCode QHttpServerResponse::statusCode() const

상태 코드를 반환합니다.

[noexcept] void QHttpServerResponse::swap(QHttpServerResponse &other)

QHttpServerResponseother 으로 바꿉니다. 이 작업은 매우 빠르며 실패하지 않습니다.

[noexcept] QHttpServerResponse &QHttpServerResponse::operator=(QHttpServerResponse &&other)

이동-이 other 인스턴스를 QHttpServerResponse 인스턴스에 할당합니다.

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.