Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-2695

Unexpected/invalid sse event when mediaType is defined

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 4.5.6.Final
    • Fix Version/s: 4.5.8.Final
    • Component/s: jaxrs
    • Labels:
      None
    • [QE] How to address?:
      ---
    • [QE] Why QE missed?:
      ---

      Description

      When mediaType is derived from @SseElementType or setting with EventBuilder's mediaType:

       
       

         @GET
         @Path("/bigmsg")
         @Produces(MediaType.SERVER_SENT_EVENTS)
         @SseElementType(MediaType.APPLICATION_JSON)
         public void bigEventMsg(@Context SseEventSink sink)     }

       
       

      eventSink.send(sse.newEventBuilder().mediaType(MediaType.APPLICATION_JSON_TYPE).data(jsonMessage).build());

      This sse message is sending like :
       

      -----------------Invalid ----------------------
      : this is comment
      id: id
      data: {
        "index": "Resteasy_Index_1",
      
        "message": "",    "foo": "bar" } 
      ---------------------------------------------------

      From Server sent events spec]] , the data value of this event will be interpreted as only unexpected value "{" . Others are all treated with other name fields or ignored.The intended json message are completely broken during processing.
       
       

       

       
       

        Attachments

          Activity

            People

            Assignee:
            jim.ma Jim Ma
            Reporter:
            jim.ma Jim Ma
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: