Skip to content

GsonHttpMessageConverter cannot be used in an SseEmitter because it closes the response stream [SPR-16529] #21072

Closed

Description

@spring-projects-issues

Dave Syer opened SPR-16529 and commented

GsonHttpMessageConverter cannot be used in an SseEmitter (unlike MappingJackson2HttpMessageConverter) because it closes the output stream after every element, committing the HTTP response and shutting it down in the servlet container. To verify this you only need to build an app with Jackson and an SseEmitter, then switch to Gson and see it break (only the first event is emitted).


Affects: 4.3.14

Issue Links:

Backported to: 4.3.15

Activity

  1. spring-projects-issues commented on Feb 23, 2018

    @spring-projects-issues
    CollaboratorAuthor

    Dave Syer commented

    Changing writer.close() to writer.flush() in writeInternal() works for me.

  2. added
    type: bug
    status: backported
    in: web
    on Jan 11, 2019
  3. added this to the 5.0.5 milestone on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: webstatus: backportedtype: bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions