Mule 3.8.3을 사용하여 URL에 URI 매개 변수가 있는지 확인하고 Anypoint Studio 6.2 및 Mule 3.8.3에서 Choice 구성 요소를 사용할 때도 inboundProperties가 비어 있지 않은지 확인해야합니다.
나는 시도했다 :
#[message.inboundProperties.'http.uri.params'.code != empty]
#[org.mule.util.StringUtils.isNotEmpty(message.inboundProperties.'http.uri.params'.code)]
둘 다 나는 얻는다
org.mule.api.expression.ExpressionRuntimeException : "org.mule.util.StringUtils.isNotEmpty (message.inboundProperties.'http.query.params'.code)"표현식 실행에 실패했습니다.
시도 할 다른 방법이 있습니까?
미각에는 두 가지 "표현"이 있습니다.
1. 식 변환기
Example : <expression-transformer expression="#[message.inboundProperties.'http.uri.params'.param != empty]" doc:name="Expression"/>
2. 식 구성 요소
Example : <expression-component doc:name="Expression"/>
아래와 같이 " Expression-transformer " 를 사용해야 합니다.
Anypoint Studio에서 아래의 흐름을 시도해보십시오.
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8082" basePath="/testapi" doc:name="HTTP Listener Configuration"/>
<flow name="uri">
<http:listener path="uri/{param}/resource" config-ref="HTTP_Listener_Configuration" doc:name="HTTP"/>
<expression-transformer expression="#[message.inboundProperties.'http.uri.params'.param != empty]" doc:name="Expression"/>
<object-to-string-transformer doc:name="Object to String"/>
<set-payload value="#[payload]" doc:name="Set Payload"/>
</flow>
브라우저에서 아래 URL로 위 테스트
http : // localhost : 8082 / testapi / uri / testUriParam / resource
Choice 구성 요소 와 함께 사용할 수도 있습니다 . 아래 코드를 시도하십시오.
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8082" basePath="/testapi" doc:name="HTTP Listener Configuration"/>
<flow name="uri">
<http:listener path="uri/{param}/resource" config-ref="HTTP_Listener_Configuration" doc:name="HTTP"/>
<choice doc:name="Choice">
<when expression="#[message.inboundProperties.'http.uri.params'.param != empty]">
<logger message="Found URI Param" level="INFO" doc:name="Logger"/>
<set-payload value="Found URI Param" doc:name="Set Payload"/>
</when>
<otherwise>
<logger level="INFO" doc:name="Logger" message="URI Param not found"/>
<set-payload value="URI Param not found" doc:name="Set Payload"/>
</otherwise>
</choice>
</flow>
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다