Skip to content
This repository has been archived by the owner on Oct 30, 2019. It is now read-only.

Provide a defined behavior in generating a response generated by multiple writes #28

Closed
elakito opened this issue Mar 6, 2015 · 1 comment

Comments

@elakito
Copy link
Collaborator

elakito commented Mar 6, 2015

This is referred from #18

Currently, when the underlining jaxrs framework invokes multiple writes to the output stream of the response during the generation of the response, it will result in multiple swaggersocket responses. That means, the behavior of swaggersocket depends on whether the underlining framework invokes a single write operation or multiple write operations by default. This arbitrary behavior needs to be changed.

One option would be provide a single response option. That means to buffer the entire data during the multiple writes and to flush the entire data at once so that a single swaggersocket response is generated. For this to work, either the underlining jaxrs framework does the buffering and invokes the write once or the jaxrs framework invokes multiple writes followed by the close operation so that swaggersocket et al can perform the buffering and flushing.

The second option would be to provide the optional last flag in the swaggersocket response so that the client can determine the end of the response reliably. For this to work, the buffering and flushing must be done by the swaggersocket and the jaxrs framework must invoke the close operation at the end of each series of writes.

elakito added a commit that referenced this issue Mar 6, 2015
@elakito
Copy link
Collaborator Author

elakito commented Mar 6, 2015

@jfarcand
i just pushed one commit that provides this solution.

If you run the samples/swaggersocket-cxf-echo's jetty:run (i just remember that i forgot to add the required prop in the nettosphere's config, so only the jetty:run version demonstrates this behavior).

Basically, when this option is enabled, each write is written at its next write or close, so that we can set the last flag when generating the swaggersocket response.

Jersey doesn't satisfy the one of the required condition to work, namely it doesn't invoke the close at the end. So, when using jersey, this option cannot be enabled. In contrast, cxf invokes the close, so we can enable this option when using cxf.

In the cxf-echo sample, you can enter a large string (larger than the default buffer size of 4k), you can see the responses generated by multiple responses.

Your comments would be appreciated.
regards, aki

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant