You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "George Gao (JIRA)" <ji...@apache.org> on 2010/03/10 20:15:27 UTC

[jira] Created: (CXF-2704) CXF JAX-RS "Content-Disposition" is lost for second multipart

CXF JAX-RS  "Content-Disposition" is lost for second multipart 
---------------------------------------------------------------

                 Key: CXF-2704
                 URL: https://issues.apache.org/jira/browse/CXF-2704
             Project: CXF
          Issue Type: Bug
          Components: JAX-RS
    Affects Versions: 2.2.6
         Environment: deploy Restful service enhanced based on the sample: "jaxrs basic" in tomcat, 
client: python 2.6 + httplib2
            Reporter: George Gao
            Priority: Critical


I create a RestFul service for dealing with multiparts:

Part 1: application/xml(form data)  Bean in server side
Part2: application/octet-stream   upload file,

But the "Content-disposition" of the part2 is translated into: key="ontent-disposition", so the information about
        Content-disposition can not be retrieve in server side.

      I want to find out the filename in the part2, but exception happen for:



Server side code:
      Attachment att = atts.get(1);
      String filename = att.getContentDisposition().getParameter("filename");

Client side code:
-----------------------------------------------------------------------
import httplib2

http = httplib2.Http()
url='http://ib11b02.lsf.platform.com:9000/webservice/upload'

body = """
--bqJky99mlBWa-ZuqjC53mG6EzbmlxB
Content-Disposition: form-data; name='data'
Content-Type: application/xml; charset=US-ASCII
Content-Transfer-Encoding: 8bit

<?xml version='1.0' encoding='UTF-8' standalone='yes'?> <Customer>  <name>Sharon Gao3</name> </Customer>
--bqJky99mlBWa-ZuqjC53mG6EzbmlxB
Content-Disposition: form-data; name='file1'; filename='genome.jpeg';
Content-Type: application/octet-stream
Content-Transfer-Encoding: UTF-8
Content-ID: <file1>

PGh0bWw+CiAgPGhlYWQ+CiAgPC9oZWFkPgogIDxib2R5PgogICAgPHA+VGhpcyBpcyB0aGUg
Ym9keSBvZiB0aGUgbWVzc2FnZS48L3A+CiAgPC9ib2R5Pgo8L2h0bWw+Cg==

--bqJky99mlBWa-ZuqjC53mG6EzbmlxB--
"""

headers = {'Content-Type': 'multipart/mixed; boundary=bqJky99mlBWa-ZuqjC53mG6EzbmlxB',
            'Content-Length': str(len(body))}
response, content = http.request(url, 'POST', body=body, headers=headers)


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-2704) CXF JAX-RS "Content-Disposition" is lost for second multipart

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

Sergey Beryozkin commented on CXF-2704:
---------------------------------------

Hi, I've had a chance to look into this issue, here is what goes on the wire :

POST /bookstore/books/formbody2 HTTP/1.1
Content-Type: multipart/form-data; type="text/xml"; start="rootPart"; boundary="bqJky99mlBWa-ZuqjC53mG6EzbmlxB"
User-Agent: Jakarta Commons-HttpClient/3.1
Host: localhost:9086
Content-Length: 644


--bqJky99mlBWa-ZuqjC53mG6EzbmlxB
Content-Disposition: form-data; name='data'
Content-Type: application/xml; charset=US-ASCII
Content-Transfer-Encoding: 8bit

<?xml version='1.0' encoding='UTF-8' standalone='yes'?> <Customer> <name>Sharon Gao3</name> </Customer>
--bqJky99mlBWa-ZuqjC53mG6EzbmlxB
Content-Disposition: form-data; name='file1'; filename='genome.jpeg';
Content-Type: application/octet-stream
Content-Transfer-Encoding: UTF-8
Content-ID: <file1>

PGh0bWw+CiAgPGhlYWQ+CiAgPC9oZWFkPgogIDxib2R5PgogICAgPHA+VGhpcyBpcyB0aGUg
Ym9keSBvZiB0aGUgbWVzc2FnZS48L3A+CiAgPC9ib2R5Pgo8L2h0bWw+Cg==
--bqJky99mlBWa-ZuqjC53mG6EzbmlxB--

And I have no problems with displaying the Content-Disposition values from the 2nd part.


Can you please give me a favor and capture what client sends on the wire by using one of the TCP trace utilities and *attach* it to this JIRA ? 
I'm wondering, may be you have some symbol like \n missing between the 2nd boundary and its content (that is you have \r) only ?

thanks, Sergey 

> CXF JAX-RS  "Content-Disposition" is lost for second multipart 
> ---------------------------------------------------------------
>
>                 Key: CXF-2704
>                 URL: https://issues.apache.org/jira/browse/CXF-2704
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.2.6
>         Environment: deploy Restful service enhanced based on the sample: "jaxrs basic" in tomcat, 
> client: python 2.6 + httplib2
>            Reporter: George Gao
>            Priority: Critical
>
> I create a RestFul service for dealing with multiparts:
> Part 1: application/xml(form data)  Bean in server side
> Part2: application/octet-stream   upload file,
> But the "Content-disposition" of the part2 is translated into: key="ontent-disposition", so the information about
>         Content-disposition can not be retrieve in server side.
>       I want to find out the filename in the part2, but exception happen for:
> Server side code:
>       Attachment att = atts.get(1);
>       String filename = att.getContentDisposition().getParameter("filename");
> Client side code:
> -----------------------------------------------------------------------
> import httplib2
> http = httplib2.Http()
> url='http://ib11b02.lsf.platform.com:9000/webservice/upload'
> body = """
> --bqJky99mlBWa-ZuqjC53mG6EzbmlxB
> Content-Disposition: form-data; name='data'
> Content-Type: application/xml; charset=US-ASCII
> Content-Transfer-Encoding: 8bit
> <?xml version='1.0' encoding='UTF-8' standalone='yes'?> <Customer>  <name>Sharon Gao3</name> </Customer>
> --bqJky99mlBWa-ZuqjC53mG6EzbmlxB
> Content-Disposition: form-data; name='file1'; filename='genome.jpeg';
> Content-Type: application/octet-stream
> Content-Transfer-Encoding: UTF-8
> Content-ID: <file1>
> PGh0bWw+CiAgPGhlYWQ+CiAgPC9oZWFkPgogIDxib2R5PgogICAgPHA+VGhpcyBpcyB0aGUg
> Ym9keSBvZiB0aGUgbWVzc2FnZS48L3A+CiAgPC9ib2R5Pgo8L2h0bWw+Cg==
> --bqJky99mlBWa-ZuqjC53mG6EzbmlxB--
> """
> headers = {'Content-Type': 'multipart/mixed; boundary=bqJky99mlBWa-ZuqjC53mG6EzbmlxB',
>             'Content-Length': str(len(body))}
> response, content = http.request(url, 'POST', body=body, headers=headers)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-2704) CXF JAX-RS "Content-Disposition" is lost for second multipart

Posted by "George Gao (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12846436#action_12846436 ] 

George Gao commented on CXF-2704:
---------------------------------

Sergey,

Thanks for your reply. The issue is in my client side.

I have resolved the issue by adding "\n".  you can close it now,

--George



> CXF JAX-RS  "Content-Disposition" is lost for second multipart 
> ---------------------------------------------------------------
>
>                 Key: CXF-2704
>                 URL: https://issues.apache.org/jira/browse/CXF-2704
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.2.6
>         Environment: deploy Restful service enhanced based on the sample: "jaxrs basic" in tomcat, 
> client: python 2.6 + httplib2
>            Reporter: George Gao
>            Priority: Critical
>
> I create a RestFul service for dealing with multiparts:
> Part 1: application/xml(form data)  Bean in server side
> Part2: application/octet-stream   upload file,
> But the "Content-disposition" of the part2 is translated into: key="ontent-disposition", so the information about
>         Content-disposition can not be retrieve in server side.
>       I want to find out the filename in the part2, but exception happen for:
> Server side code:
>       Attachment att = atts.get(1);
>       String filename = att.getContentDisposition().getParameter("filename");
> Client side code:
> -----------------------------------------------------------------------
> import httplib2
> http = httplib2.Http()
> url='http://ib11b02.lsf.platform.com:9000/webservice/upload'
> body = """
> --bqJky99mlBWa-ZuqjC53mG6EzbmlxB
> Content-Disposition: form-data; name='data'
> Content-Type: application/xml; charset=US-ASCII
> Content-Transfer-Encoding: 8bit
> <?xml version='1.0' encoding='UTF-8' standalone='yes'?> <Customer>  <name>Sharon Gao3</name> </Customer>
> --bqJky99mlBWa-ZuqjC53mG6EzbmlxB
> Content-Disposition: form-data; name='file1'; filename='genome.jpeg';
> Content-Type: application/octet-stream
> Content-Transfer-Encoding: UTF-8
> Content-ID: <file1>
> PGh0bWw+CiAgPGhlYWQ+CiAgPC9oZWFkPgogIDxib2R5PgogICAgPHA+VGhpcyBpcyB0aGUg
> Ym9keSBvZiB0aGUgbWVzc2FnZS48L3A+CiAgPC9ib2R5Pgo8L2h0bWw+Cg==
> --bqJky99mlBWa-ZuqjC53mG6EzbmlxB--
> """
> headers = {'Content-Type': 'multipart/mixed; boundary=bqJky99mlBWa-ZuqjC53mG6EzbmlxB',
>             'Content-Length': str(len(body))}
> response, content = http.request(url, 'POST', body=body, headers=headers)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-2704) CXF JAX-RS "Content-Disposition" is lost for second multipart

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

Sergey Beryozkin commented on CXF-2704:
---------------------------------------

George, can I close this issue ?

> CXF JAX-RS  "Content-Disposition" is lost for second multipart 
> ---------------------------------------------------------------
>
>                 Key: CXF-2704
>                 URL: https://issues.apache.org/jira/browse/CXF-2704
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.2.6
>         Environment: deploy Restful service enhanced based on the sample: "jaxrs basic" in tomcat, 
> client: python 2.6 + httplib2
>            Reporter: George Gao
>            Priority: Critical
>
> I create a RestFul service for dealing with multiparts:
> Part 1: application/xml(form data)  Bean in server side
> Part2: application/octet-stream   upload file,
> But the "Content-disposition" of the part2 is translated into: key="ontent-disposition", so the information about
>         Content-disposition can not be retrieve in server side.
>       I want to find out the filename in the part2, but exception happen for:
> Server side code:
>       Attachment att = atts.get(1);
>       String filename = att.getContentDisposition().getParameter("filename");
> Client side code:
> -----------------------------------------------------------------------
> import httplib2
> http = httplib2.Http()
> url='http://ib11b02.lsf.platform.com:9000/webservice/upload'
> body = """
> --bqJky99mlBWa-ZuqjC53mG6EzbmlxB
> Content-Disposition: form-data; name='data'
> Content-Type: application/xml; charset=US-ASCII
> Content-Transfer-Encoding: 8bit
> <?xml version='1.0' encoding='UTF-8' standalone='yes'?> <Customer>  <name>Sharon Gao3</name> </Customer>
> --bqJky99mlBWa-ZuqjC53mG6EzbmlxB
> Content-Disposition: form-data; name='file1'; filename='genome.jpeg';
> Content-Type: application/octet-stream
> Content-Transfer-Encoding: UTF-8
> Content-ID: <file1>
> PGh0bWw+CiAgPGhlYWQ+CiAgPC9oZWFkPgogIDxib2R5PgogICAgPHA+VGhpcyBpcyB0aGUg
> Ym9keSBvZiB0aGUgbWVzc2FnZS48L3A+CiAgPC9ib2R5Pgo8L2h0bWw+Cg==
> --bqJky99mlBWa-ZuqjC53mG6EzbmlxB--
> """
> headers = {'Content-Type': 'multipart/mixed; boundary=bqJky99mlBWa-ZuqjC53mG6EzbmlxB',
>             'Content-Length': str(len(body))}
> response, content = http.request(url, 'POST', body=body, headers=headers)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CXF-2704) CXF JAX-RS "Content-Disposition" is lost for second multipart

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

Sergey Beryozkin resolved CXF-2704.
-----------------------------------

    Fix Version/s: 2.3
                   2.2.10
       Resolution: Fixed

> CXF JAX-RS  "Content-Disposition" is lost for second multipart 
> ---------------------------------------------------------------
>
>                 Key: CXF-2704
>                 URL: https://issues.apache.org/jira/browse/CXF-2704
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.2.6
>         Environment: deploy Restful service enhanced based on the sample: "jaxrs basic" in tomcat, 
> client: python 2.6 + httplib2
>            Reporter: George Gao
>            Priority: Critical
>             Fix For: 2.3, 2.2.10
>
>
> I create a RestFul service for dealing with multiparts:
> Part 1: application/xml(form data)  Bean in server side
> Part2: application/octet-stream   upload file,
> But the "Content-disposition" of the part2 is translated into: key="ontent-disposition", so the information about
>         Content-disposition can not be retrieve in server side.
>       I want to find out the filename in the part2, but exception happen for:
> Server side code:
>       Attachment att = atts.get(1);
>       String filename = att.getContentDisposition().getParameter("filename");
> Client side code:
> -----------------------------------------------------------------------
> import httplib2
> http = httplib2.Http()
> url='http://ib11b02.lsf.platform.com:9000/webservice/upload'
> body = """
> --bqJky99mlBWa-ZuqjC53mG6EzbmlxB
> Content-Disposition: form-data; name='data'
> Content-Type: application/xml; charset=US-ASCII
> Content-Transfer-Encoding: 8bit
> <?xml version='1.0' encoding='UTF-8' standalone='yes'?> <Customer>  <name>Sharon Gao3</name> </Customer>
> --bqJky99mlBWa-ZuqjC53mG6EzbmlxB
> Content-Disposition: form-data; name='file1'; filename='genome.jpeg';
> Content-Type: application/octet-stream
> Content-Transfer-Encoding: UTF-8
> Content-ID: <file1>
> PGh0bWw+CiAgPGhlYWQ+CiAgPC9oZWFkPgogIDxib2R5PgogICAgPHA+VGhpcyBpcyB0aGUg
> Ym9keSBvZiB0aGUgbWVzc2FnZS48L3A+CiAgPC9ib2R5Pgo8L2h0bWw+Cg==
> --bqJky99mlBWa-ZuqjC53mG6EzbmlxB--
> """
> headers = {'Content-Type': 'multipart/mixed; boundary=bqJky99mlBWa-ZuqjC53mG6EzbmlxB',
>             'Content-Length': str(len(body))}
> response, content = http.request(url, 'POST', body=body, headers=headers)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.