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

Unexpected/invalid sse event when mediaType is defined

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved (View Workflow)
    • Major
    • Resolution: Done
    • 4.5.6.Final
    • 4.5.8.Final
    • jaxrs
    • None

    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

            rhn-engineering-ema Jim Ma
            rhn-engineering-ema Jim Ma
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: