2011-11-16 3 views
2

나는 Mule HTTP Inbound Endpoint를 다음과 같이 정의했다 :기본 Mule 오류 메시지를 편집하는 방법 ..?

<flow name="jfeed_fill_data"> 
    <http:inbound-endpoint address="http://localhost:1212/jcore/insert/feed/"> 
    </http:inbound-endpoint> 
<component class="main.java.com.joshlabs.jcore.Feed"/> 
</flow> 

이제이 서비스는 훌륭하게 작동한다.

하지만 "http : // localhost : 1212/jcore/insert/feedasdasdAwes /"와 같은 형식의 URL을 입력하면 MULE에서 다음 메시지가 나타납니다.

Cannot bind to address "http://localhost:1212/jcore/insert/feedasdasdAwes/" 
No component registered on that endpoint 

내 질문 : 어떻게 내가 위의 기본 메시지를 내 자신의 무언가로 변경할 수 있습니까?

참고 : 실제로 JSON String을 오류 메시지로 반환하고 싶습니다. 뭔가 같은 :

{ 
    Exception: "Invalid URL" 
} 

그리고 가능하다면, "MULE 던져 수 HTTP 404 : 오류 위의 경우".. ??

답변

2

당신은 당신의 엔드 포인트는 모든 하위 경로를 수용하고 메시지 라우팅과 잘못된 것들을 처리 할 수 ​​있도록해야합니다

<flow name="jfeed_fill_data"> 
    <http:inbound-endpoint address="http://localhost:1212" /> 
    <choice> 
     <when evaluator="header" expression="INBOUND:http.request.path=/jcore/insert/feed/"> 
      <component class="main.java.com.joshlabs.jcore.Feed"/> 
     </when> 
     <otherwise> 
      <message-properties-transformer> 
       <add-message-property key="http.status" value="404"/> 
      </message-properties-transformer> 
      <expression-transformer> 
       <return-argument evaluator="string" expression="{Exception: &quot;Invalid URL&quot;}"/> 
      </expression-transformer> 
     </otherwise> 
    </choice> 
</flow> 
+0

WOW .. !! .. 정말 일했다 .. !! .. 고맙습니다 데이비드. !! !! :) ... N 한 가지 더, 어디에서 MULE (mule-config)와 같은 개념을 공부할 좋은 문서를 찾을 수 있을까요? .. 사실 나는 항상 뮬 설정 파일을 만드는 데 어려움이 있습니다 .. !! –

+0

계속 사용중인 참조는 다음과 같습니다. http://www.mulesoft.org/documentation/display/MULE3USER –