2.59. 플랫폼 HTTP


이 확장 기능을 사용하면 HTTP 요청을 사용하도록 HTTP 끝점을 생성할 수 있습니다.

quarkus-vertx-http 확장에서 제공하는 Eclipse Vert.x HTTP 서버 상단에 빌드됩니다.

2.59.1. 내부 내용

사용 및 설정 세부 사항은 위의 링크를 참조하십시오.

2.59.2. Maven 조정

code.quarkus.redhat.com에서 이 확장 기능을 사용하여 새 프로젝트를 생성합니다.

또는 기존 프로젝트에 좌표를 추가합니다.

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-platform-http</artifactId>
</dependency>

2.59.3. 사용법

2.59.3.1. 기본 사용

/hello 끝점에서 모든 HTTP 메서드를 제공합니다.

from("platform-http:/hello").setBody(simple("Hello ${header.name}"));

/hello 끝점에서 GET 요청만 제공합니다.

from("platform-http:/hello?httpMethodRestrict=GET").setBody(simple("Hello ${header.name}"));

2.59.3.2. Camel REST DSL을 통한 platform-http 사용

platform-http 구성 요소와 함께 Camel REST DSL을 사용할 수 있으려면 pom.xmlcamel-quarkus-rest 를 추가합니다.

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-rest</artifactId>
</dependency>

그런 다음 Camel REST DSL을 사용할 수 있습니다.

rest()
    .get("/my-get-endpoint")
        .to("direct:handleGetRequest");

    .post("/my-post-endpoint")
        .to("direct:handlePostRequest");

2.59.3.3. 다중 파트/form-data 파일 업로드 처리

흰색으로 나열하여 특정 파일 확장으로 업로드를 제한할 수 있습니다.

from("platform-http:/upload/multipart?fileNameExtWhitelist=html,txt&httpMethodRestrict=POST")
    .to("log:multipart")
    .process(e -> {
        final AttachmentMessage am = e.getMessage(AttachmentMessage.class);
        if (am.hasAttachments()) {
            am.getAttachments().forEach((fileName, dataHandler) -> {
                try (InputStream in = dataHandler.getInputStream()) {
                    // do something with the input stream
                } catch (IOException ioe) {
                    throw new RuntimeException(ioe);
                }
            });
        }
    });

2.59.3.4. platform-http 끝점 보안

Quarkus는 platform-http 엔드포인트를 보호하는 데 사용할 수 있는 다양한 보안 및 인증 메커니즘을 제공합니다. 자세한 내용은 Quarkus 보안 설명서 를 참조하십시오.

경로 내에서 인증된 사용자 및 관련 SecurityIdentityPrincipal 를 가져올 수 있습니다.

from("platform-http:/secure")
    .process(e -> {
        Message message = e.getMessage();
        QuarkusHttpUser user = message.getHeader(VertxPlatformHttpConstants.AUTHENTICATED_USER, QuarkusHttpUser.class);
        SecurityIdentity securityIdentity = user.getSecurityIdentity();
        Principal principal = securityIdentity.getPrincipal();
        // Do something useful with SecurityIdentity / Principal. E.g check user roles etc.
    });

또한 Quarkus 설명서quarkus.http.body.* 구성 옵션(esp)을 확인합니다. Quarkus .http.body.handle-file-uploads,quarkus.http.body.uploads-directoryquarkus.http.body.delete-uploaded-files-on-end.

2.59.3.5. 역방향 프록시 구현

플랫폼 HTTP 구성 요소는 역방향 프록시 역할을 할 수 있습니다. 이 경우 exchange .HTTP_URI,Exchange.HTTP_HOST 헤더는 HTTP 요청의 요청 줄에서 수신되는 절대 URL에서 채워집니다.

다음은 Exchange를 원본 서버로 리디렉션하는 HTTP 프록시의 예입니다.

from("platform-http:proxy")
    .toD("http://"
        + "${headers." + Exchange.HTTP_HOST + "}");

2.59.4. 추가 Camel Quarkus 구성

2.59.4.1. 플랫폼 HTTP 서버 구성

플랫폼 HTTP 서버의 구성은 Quarkus에서 관리합니다. 전체 구성 옵션 목록은 Quarkus HTTP 구성 가이드를 참조하십시오.

플랫폼 HTTP 서버에 대한 SSL을 구성하려면 SSL 가이드를 통한 보안 연결을 따르십시오. SSLContextParameters 를 사용하여 SSL에 대한 서버를 구성하는 것은 현재 지원되지 않습니다.

2.59.4.2. 문자 인코딩

기본이 아닌 인코딩을 사용하여 요청을 보내거나 받을 것으로 예상되는 경우 네이티브 모드 가이드의 문자 인코딩 섹션 을 확인합니다.

Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2026 Red Hat
맨 위로 이동