cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrei Shakirin <ashaki...@talend.com>
Subject RE: Log empty message (with HTTP status code only)
Date Sat, 02 Jan 2016 13:38:14 GMT
Hi Sergei,

As Sergey Beryozkin have written, in case of oneWay response will be sent already in inbound
chain, exactly in OneWayProcessorInterceptor.
This interceptor gets the back channel Conduit and closes it:
                    message.getExchange().setInMessage(null);
                    //for a one-way, the back channel could be
                    //null if it knows it cannot send anything.
                    conduit.prepare(partial);
                    conduit.close(partial);

In this moment 202 response will be sent back to the client.
The 202 code is set in AbstractHTTPDestination.getReponseCodeFromMessage().

So outbound chain wouldn't built in this case.

The simple option to log the response:
Add your custom interceptor after OneWayProcessorInterceptor (pre-logical) and ServiceInvokerInterceptor
(invoke). In this interceptor check oneWay exchange  message.getExchange().isOneWay() and
log response code from inMessage:
message.getExchange().getInMessage().get("HTTP.RESPONSE") .

Regards,
Andrei.


> -----Original Message-----
> From: Sergey Maslov [mailto:therealmasel@gmail.com]
> Sent: Dienstag, 29. Dezember 2015 19:01
> To: users@cxf.apache.org
> Subject: Re: Log empty message (with HTTP status code only)
> 
> Sergey, thank you.
> But how could I log the fact of 202 response?
> 
> Segery Maslov
> 
> On Tue, Dec 29, 2015 at 11:55 PM, Sergey Beryozkin
> <sberyozkin@gmail.com>
> wrote:
> 
> > I think it might be because 202 is handled by a oneway processor and
> > the outbound chain is not invoked though I might be wrong...
> >
> > Sergey
> > On 29/12/15 11:17, Sergey Maslov wrote:
> >
> >> The issue is reproduced for with 202 - Accepted http status.
> >>
> >> On Tue, Dec 29, 2015 at 1:28 PM, Sergey Maslov
> >> <therealmasel@gmail.com>
> >> wrote:
> >>
> >> Hi!
> >>> I need to log imcoming requests with corresponsing responses.
> >>> According
> >>> I add custom LoggingFeature and implement LogEventSender interface.
> >>> The messages log fine except messages with emtpty body and
> >>> containing http status code only (these are the responses to the
> >>> service).
> >>> According the contract, these messages are needed to be sent.
> >>> How could I log them?
> >>>
> >>> --
> >>> *Sergey Maslov*
> >>>
> >>>
> >>
> >>
> >>
> >
> > --
> > Sergey Beryozkin
> >
> > Talend Community Coders
> > http://coders.talend.com/
> >
> 
> 
> 
> --
> *Sergey Maslov*
Mime
View raw message