84.6. 인라인 간단한 표현식
간단한 구문 ${xxx} 을 사용하여 JSONPath 표현식에서 간단한 언어를 인라인으로 지정할 수 있습니다.
예는 다음과 같습니다.
from("direct:start")
.choice()
.when().jsonpath("$.store.book[?(@.price < ${header.cheap})]")
.to("mock:cheap")
.when().jsonpath("$.store.book[?(@.price < ${header.average})]")
.to("mock:average")
.otherwise()
.to("mock:expensive");
XML DSL의 경우:
<route>
<from uri="direct:start"/>
<choice>
<when>
<jsonpath>$.store.book[?(@.price < ${header.cheap})]</jsonpath>
<to uri="mock:cheap"/>
</when>
<when>
<jsonpath>$.store.book[?(@.price < ${header.average})]</jsonpath>
<to uri="mock:average"/>
</when>
<otherwise>
<to uri="mock:expensive"/>
</otherwise>
</choice>
</route>
다음과 같이 allowSimple 을 false 로 설정하여 인라인 단순 표현식에 대한 지원을 해제할 수 있습니다.
.when().jsonpath("$.store.book[?(@.price < 10)]", false, false)
XML DSL의 경우:
<jsonpath allowSimple="false">$.store.book[?(@.price < 10)]</jsonpath>