You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Anton Johansson (JIRA)" <ji...@apache.org> on 2018/01/31 17:15:00 UTC

[jira] [Created] (CXF-7627) CXF, write headers after body

Anton Johansson created CXF-7627:
------------------------------------

             Summary: CXF, write headers after body
                 Key: CXF-7627
                 URL: https://issues.apache.org/jira/browse/CXF-7627
             Project: CXF
          Issue Type: Bug
          Components: JAX-RS
            Reporter: Anton Johansson


I'm not sure if this is considered a bug and if I've specified the correct component in this issue, but I'll give this a try.

I'm working with a couple of API's using CXF, that requires an Authorization header that depends on the data being sent. I have some issues with this, and I've created a GitHub repository to reproduce my problem. You can find it here:

[https://github.com/anton-johansson/cxf-write-headers-after-body]

Basically, I can only write headers after the body when I'm using chunked transport and I haven't reached the second chunk yet.

After messing around with this I completely understand that this is how it works. CXF obviously wants to write data to the output stream as soon as possible, and it makes no sense to write headers after that.

I'm merely looking for suggestions or ideas how I can solve my problem. For now I've simply raised the chunked threshold to get around the issue in production, but I need a better, long-term solution. Is there any way to say to CXF that it should always generate the output data in an earlier phase, so I can always access it before headers are written? This of course removes the possibility for using chunked data, but I feel this is something that should exist in CXF. I would really want to avoid building my requests by hand. :(

 

Also, something that is *very* scary, is that the output that the LoggingFeature gives me says that the header is actually sent, even though it is not sent. This caused some unnecessary discussions with our partners. :D I assume the logging feature simply takes the Header-map, but if it has been modified after the data has been written, this can be very confusing. Is there any way to solve that?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)