You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Benson Margulies (Created) (JIRA)" <ji...@apache.org> on 2011/12/20 17:20:30 UTC

[jira] [Created] (CXF-3988) org.apache.cxf.jaxrs.ext.multipart.Attachment object should be mutable

org.apache.cxf.jaxrs.ext.multipart.Attachment object should be mutable
----------------------------------------------------------------------

                 Key: CXF-3988
                 URL: https://issues.apache.org/jira/browse/CXF-3988
             Project: CXF
          Issue Type: Improvement
          Components: JAX-RS
    Affects Versions: 2.5.1
            Reporter: Benson Margulies


As currently coded, the headers in an Attachment are immutable after construction. This prevents a construction like:

    - call a convenient constructor
    - add one more header

Rather than change the contract of getHeaders, I propose to add put/putSingle to the contract of Attachment.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CXF-3988) org.apache.cxf.jaxrs.ext.multipart.Attachment object should be mutable

Posted by "Benson Margulies (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-3988?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13174057#comment-13174057 ] 

Benson Margulies commented on CXF-3988:
---------------------------------------

Sergey,

In general, a forrest of slightly different ctors is harder to use than a fluid builder. So I'll make an attachment builder, and you can tell me what you think of it.

--benson

                
> org.apache.cxf.jaxrs.ext.multipart.Attachment object should be mutable
> ----------------------------------------------------------------------
>
>                 Key: CXF-3988
>                 URL: https://issues.apache.org/jira/browse/CXF-3988
>             Project: CXF
>          Issue Type: Improvement
>          Components: JAX-RS
>    Affects Versions: 2.5.1
>            Reporter: Benson Margulies
>
> As currently coded, the headers in an Attachment are immutable after construction. This prevents a construction like:
>     - call a convenient constructor
>     - add one more header
> Rather than change the contract of getHeaders, I propose to add put/putSingle to the contract of Attachment.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CXF-3988) org.apache.cxf.jaxrs.ext.multipart.Attachment object should be mutable

Posted by "Sergey Beryozkin (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-3988?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13174168#comment-13174168 ] 

Sergey Beryozkin commented on CXF-3988:
---------------------------------------

Very nice, thanks, I merged to 2.4.x as well
                
> org.apache.cxf.jaxrs.ext.multipart.Attachment object should be mutable
> ----------------------------------------------------------------------
>
>                 Key: CXF-3988
>                 URL: https://issues.apache.org/jira/browse/CXF-3988
>             Project: CXF
>          Issue Type: Improvement
>          Components: JAX-RS
>    Affects Versions: 2.5.1
>            Reporter: Benson Margulies
>
> As currently coded, the headers in an Attachment are immutable after construction. This prevents a construction like:
>     - call a convenient constructor
>     - add one more header
> Rather than change the contract of getHeaders, I propose to add put/putSingle to the contract of Attachment.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CXF-3988) org.apache.cxf.jaxrs.ext.multipart.Attachment object should be mutable

Posted by "Sergey Beryozkin (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-3988?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13174072#comment-13174072 ] 

Sergey Beryozkin commented on CXF-3988:
---------------------------------------

Sounds like a good idea indeed;
Something like 
AttachmentBuilder {
   AttachmentBuilder header(String name, Object value);
   // shortcut for header ("Content-Disposition", cd)
   AttachmentBuilder cd(ContentDisposition cd);   
   AttachmentBuilder data(InputStream is);
   // etc
   Attachment build();
} 
guess something like that can be handy, it may take a bit of time to make it complete, but I like the idea 

                
> org.apache.cxf.jaxrs.ext.multipart.Attachment object should be mutable
> ----------------------------------------------------------------------
>
>                 Key: CXF-3988
>                 URL: https://issues.apache.org/jira/browse/CXF-3988
>             Project: CXF
>          Issue Type: Improvement
>          Components: JAX-RS
>    Affects Versions: 2.5.1
>            Reporter: Benson Margulies
>
> As currently coded, the headers in an Attachment are immutable after construction. This prevents a construction like:
>     - call a convenient constructor
>     - add one more header
> Rather than change the contract of getHeaders, I propose to add put/putSingle to the contract of Attachment.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (CXF-3988) org.apache.cxf.jaxrs.ext.multipart.Attachment object should be mutable

Posted by "Sergey Beryozkin (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-3988?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Beryozkin resolved CXF-3988.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.5.2
                   2.4.6

Fixed thanks to Benson
                
> org.apache.cxf.jaxrs.ext.multipart.Attachment object should be mutable
> ----------------------------------------------------------------------
>
>                 Key: CXF-3988
>                 URL: https://issues.apache.org/jira/browse/CXF-3988
>             Project: CXF
>          Issue Type: Improvement
>          Components: JAX-RS
>    Affects Versions: 2.5.1
>            Reporter: Benson Margulies
>             Fix For: 2.4.6, 2.5.2
>
>
> As currently coded, the headers in an Attachment are immutable after construction. This prevents a construction like:
>     - call a convenient constructor
>     - add one more header
> Rather than change the contract of getHeaders, I propose to add put/putSingle to the contract of Attachment.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CXF-3988) org.apache.cxf.jaxrs.ext.multipart.Attachment object should be mutable

Posted by "Benson Margulies (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-3988?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13174162#comment-13174162 ] 

Benson Margulies commented on CXF-3988:
---------------------------------------

How about what I committed in r1221777 for a start?

                
> org.apache.cxf.jaxrs.ext.multipart.Attachment object should be mutable
> ----------------------------------------------------------------------
>
>                 Key: CXF-3988
>                 URL: https://issues.apache.org/jira/browse/CXF-3988
>             Project: CXF
>          Issue Type: Improvement
>          Components: JAX-RS
>    Affects Versions: 2.5.1
>            Reporter: Benson Margulies
>
> As currently coded, the headers in an Attachment are immutable after construction. This prevents a construction like:
>     - call a convenient constructor
>     - add one more header
> Rather than change the contract of getHeaders, I propose to add put/putSingle to the contract of Attachment.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CXF-3988) org.apache.cxf.jaxrs.ext.multipart.Attachment object should be mutable

Posted by "Sergey Beryozkin (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-3988?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13173591#comment-13173591 ] 

Sergey Beryozkin commented on CXF-3988:
---------------------------------------

I'm sorry but I think it's a non-fix, Attachment is used on the server side too so letting add headers to existing Attachments may not be the right thing to do;
when do you think providing all the headers upfront may be too restrictive ?
                
> org.apache.cxf.jaxrs.ext.multipart.Attachment object should be mutable
> ----------------------------------------------------------------------
>
>                 Key: CXF-3988
>                 URL: https://issues.apache.org/jira/browse/CXF-3988
>             Project: CXF
>          Issue Type: Improvement
>          Components: JAX-RS
>    Affects Versions: 2.5.1
>            Reporter: Benson Margulies
>
> As currently coded, the headers in an Attachment are immutable after construction. This prevents a construction like:
>     - call a convenient constructor
>     - add one more header
> Rather than change the contract of getHeaders, I propose to add put/putSingle to the contract of Attachment.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CXF-3988) org.apache.cxf.jaxrs.ext.multipart.Attachment object should be mutable

Posted by "Benson Margulies (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-3988?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13173774#comment-13173774 ] 

Benson Margulies commented on CXF-3988:
---------------------------------------

When you want to add a content disposition in addition to a content type and an object to map with a provider! Right now, passing in a content disposition forces application/octet-stream. 

I'd be content to add an AttachmentFactory class that obviates the confusing collection of constructors.

                
> org.apache.cxf.jaxrs.ext.multipart.Attachment object should be mutable
> ----------------------------------------------------------------------
>
>                 Key: CXF-3988
>                 URL: https://issues.apache.org/jira/browse/CXF-3988
>             Project: CXF
>          Issue Type: Improvement
>          Components: JAX-RS
>    Affects Versions: 2.5.1
>            Reporter: Benson Margulies
>
> As currently coded, the headers in an Attachment are immutable after construction. This prevents a construction like:
>     - call a convenient constructor
>     - add one more header
> Rather than change the contract of getHeaders, I propose to add put/putSingle to the contract of Attachment.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Issue Comment Edited] (CXF-3988) org.apache.cxf.jaxrs.ext.multipart.Attachment object should be mutable

Posted by "Sergey Beryozkin (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-3988?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13174072#comment-13174072 ] 

Sergey Beryozkin edited comment on CXF-3988 at 12/21/11 1:04 PM:
-----------------------------------------------------------------

Sounds like a good idea indeed;
Something like 
{code:java}
AttachmentBuilder {
   AttachmentBuilder header(String name, Object value);
   // shortcut for header ("Content-Disposition", cd)
   AttachmentBuilder cd(ContentDisposition cd);   
   AttachmentBuilder data(InputStream is);
   // etc
   Attachment build();
} 
{code}
guess something like that can be handy, it may take a bit of time to make it complete, but I like the idea 

                
      was (Author: sergey_beryozkin):
    Sounds like a good idea indeed;
Something like 
AttachmentBuilder {
   AttachmentBuilder header(String name, Object value);
   // shortcut for header ("Content-Disposition", cd)
   AttachmentBuilder cd(ContentDisposition cd);   
   AttachmentBuilder data(InputStream is);
   // etc
   Attachment build();
} 
guess something like that can be handy, it may take a bit of time to make it complete, but I like the idea 

                  
> org.apache.cxf.jaxrs.ext.multipart.Attachment object should be mutable
> ----------------------------------------------------------------------
>
>                 Key: CXF-3988
>                 URL: https://issues.apache.org/jira/browse/CXF-3988
>             Project: CXF
>          Issue Type: Improvement
>          Components: JAX-RS
>    Affects Versions: 2.5.1
>            Reporter: Benson Margulies
>
> As currently coded, the headers in an Attachment are immutable after construction. This prevents a construction like:
>     - call a convenient constructor
>     - add one more header
> Rather than change the contract of getHeaders, I propose to add put/putSingle to the contract of Attachment.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira