cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-7462) OutboundSseEventImpl could use some minor tweaks
Date Wed, 02 Aug 2017 01:58:03 GMT

    [ https://issues.apache.org/jira/browse/CXF-7462?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16110118#comment-16110118
] 

ASF GitHub Bot commented on CXF-7462:
-------------------------------------

Github user reta commented on a diff in the pull request:

    https://github.com/apache/cxf/pull/301#discussion_r130770551
  
    --- Diff: rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/OutboundSseEventImpl.java ---
    @@ -24,24 +24,24 @@
     import javax.ws.rs.core.MediaType;
     import javax.ws.rs.sse.OutboundSseEvent;
     
    -public class OutboundSseEventImpl implements OutboundSseEvent {
    -    private String id;
    -    private String name;
    -    private String comment;
    -    private long reconnectDelay = -1;
    -    private Class<?> type;
    -    private Type genericType;
    -    private MediaType mediaType;
    -    private Object data;
    +public final class OutboundSseEventImpl implements OutboundSseEvent {
    +    private final String id;
    +    private final String name;
    +    private final String comment;
    +    private final long reconnectDelay;
    +    private final Class<?> type;
    +    private final Type genericType;
    +    private final MediaType mediaType;
    +    private final Object data;
     
         public static class BuilderImpl implements Builder {
             private String id;
             private String name;
             private String comment;
             private long reconnectDelay = -1;
    -        private Class<?> type;
    +        private Class<?> type = String.class;
             private Type genericType;
    -        private MediaType mediaType;
    +        private MediaType mediaType = MediaType.SERVER_SENT_EVENTS_TYPE;
    --- End diff --
    
    The `mediaType` is not `text/event-stream`, this is actually a media type of associated
event payload (`data`) so to which body writer to use.


> OutboundSseEventImpl could use some minor tweaks
> ------------------------------------------------
>
>                 Key: CXF-7462
>                 URL: https://issues.apache.org/jira/browse/CXF-7462
>             Project: CXF
>          Issue Type: Improvement
>          Components: JAX-RS
>    Affects Versions: 3.2.0
>            Reporter: Andy McCright
>            Priority: Minor
>             Fix For: 3.2.0
>
>
> The OutboundSseEventImpl class could use some minor tweaks, including:
> 1) Make the fields final to reflect that the event is immutable.
> 2) Use defaults for the data type (String.class) and media type (SERVER_SENT_EVENT_TYPE).
> 3) Restrict the constructor's visibility.
> I also plan to add some tests for these changes.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message