2017-10-08 2 views
0

코드에 위치 헤더와 http 상태 302가있을 때마다 mule http listener가 내부적으로 위치 URL을 호출하고 정상적인 동작처럼 보이는 http 상태 200의 응답을받습니다.http 청취자에 대한 리다이렉트 뮬 사용하지 않음

하지만보고 싶은 것은 302 http 상태와 우편함에 이름이있는 헤더입니다.

어떤 수단으로도 처리 할 수 ​​있습니까?

INFO 2017-10-08 10:41:35,800 [[demo].HTTP_Listener_Configuration.worker.01] org.mule.api.processor.LoggerMessageProcessor: inside 302 
INFO 2017-10-08 10:41:35,807 [[demo].HTTP_Listener_Configuration.worker.01] org.mule.api.processor.LoggerMessageProcessor: after property setting 
org.mule.DefaultMuleMessage 
{ 
    id=282de160-abe7-11e7-893f-dcc820524153 
    payload=org.mule.transport.NullPayload 
    correlationId=<not set> 
    correlationGroup=-1 
    correlationSeq=-1 
    encoding=UTF-8 
    exceptionPayload=<not set> 

Message properties: 
    INVOCATION scoped properties: 
    INBOUND scoped properties: 
    accept=*/* 
    accept-encoding=gzip, deflate, br 
    accept-language=en-US,en;q=0.8 
    cache-control=no-cache 
    connection=keep-alive 
    cookie=cookie2:123 
    host=localhost:8081 
    http.listener.path=/location302 
    http.method=GET 
    http.query.params=ParameterMap{[]} 
    http.query.string= 
    http.relative.path=/location302 
    http.remote.address=/127.0.0.1:36700 
    http.request.path=/location302 
    http.request.uri=/location302 
    http.scheme=http 
    http.uri.params=ParameterMap{[]} 
    http.version=HTTP/1.1 
    postman-token=d1cf089e-501f-aa9b-51b6-36a50b2b3806 
    user-agent=Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36 
    OUTBOUND scoped properties: 
    http.status=302 
    location=http://localhost:8081/xpath 
    SESSION scoped properties: 
} 
INFO 2017-10-08 10:41:35,819 [[demo].HTTP_Listener_Configuration.worker.01] org.mule.api.processor.LoggerMessageProcessor: inside another flow 

나뿐만 아니라 크롬 네트워크의 302을 볼 수 아니다 - 아래

<http:request-config name="HTTP_Request_Configuration2" host="localhost" port="8081" doc:name="HTTP Request Configuration"/> 
<flow name="xpathforeachFlow"> 
    <http:listener config-ref="HTTP_Listener_Configuration" path="/xpath" doc:name="HTTP"/> 
    <logger message="inside another flow" level="INFO" doc:name="Logger"/> 
    <set-payload value="this is a test flow" doc:name="Set Payload"/> 
</flow> 
<flow name="MainFlow"> 
    <http:listener config-ref="HTTP_Listener_Configuration" path="/location302" doc:name="HTTP" > 
    </http:listener> 
    <logger message="inside 302" level="INFO" doc:name="Logger"/> 
    <set-property propertyName="http.status" value="#['302']" doc:name="Property"/> 
    <set-property propertyName="location" value="http://localhost:8081/xpath" doc:name="Property"/> 
    <logger message="after property setting #[message]" level="INFO" doc:name="Logger"/> 
</flow> 

로그는 다음과 같습니다 내 코드입니다. 로그뿐만 아니라 네트워크 또는 우체국에서도 302를 캡처 할 수있는 방법이 있는지 알려 주시기 바랍니다.

답변

0

헤더 속성에서 동일한 위치를 설정할 수 없으므로 결국 자체적으로 재귀 호출을하게됩니다. 상태 및 기타 헤더 속성을 설정하려면 아래 코드를 참조하십시오.

<http:request-config name="HTTP_Request_Configuration2" host="localhost" port="8081" doc:name="HTTP Request Configuration"/> 
<flow name="xpathforeachFlow"> 
    <http:listener config-ref="HTTP_Listener_Configuration" path="/xpath" allowedMethods="GET" doc:name="HTTP"> 
     <http:response-builder statusCode="302" reasonPhrase="found" > 
      <http:header headerName="date" value="#[server.dateTime]"/> 
     </http:response-builder> 
    </http:listener> 
    <logger message="inside another flow" level="INFO" doc:name="Logger" /> 
    <set-payload value="this is a test flow" doc:name="Set Payload" /> 
</flow> 
<flow name="MainFlow"> 
    <http:listener config-ref="HTTP_Listener_Configuration" path="/location302" doc:name="HTTP" allowedMethods="GET"/> 
    <logger message="inside 302" level="INFO" doc:name="Logger" /> 
    <set-property propertyName="http.status" value="#['302']" doc:name="Property" /> 
    <set-property propertyName="location" value="http://localhost:8081/xpath" doc:name="Property"/> 
    <logger message="after property setting #[message]" level="INFO" doc:name="Logger" /> 
</flow> 
관련 문제