14장. 상수

14.1. 개요

상수 언어는 일반 텍스트 문자열을 지정하는 데 사용되는 간단한 기본 제공 언어입니다. 이렇게 하면 표현식 유형이 예상되는 모든 컨텍스트에서 일반 텍스트 문자열을 제공할 수 있습니다.

14.2. XML 예

XML에서 username 헤더를 다음과 같이 값 Jane Doe 으로 설정할 수 있습니다.

<camelContext>
  <route>
    <from uri="SourceURL"/>
    <setHeader headerName="username">
      <constant>Jane Doe</constant>
    </setHeader>
    <to uri="TargetURL"/>
  </route>
</camelContext>

14.3. Java 예

Java에서는 다음과 같이 username 헤더를 값 Jane Doe 으로 설정할 수 있습니다.

from("SourceURL")
  .setHeader("username", constant("Jane Doe"))
  .to("TargetURL");