2013-10-06 6 views
0

파일이있는 멀티 파트 본문을 다운로드해야하는 나머지 CXF 클라이언트가 있습니다. 나는 다음과 같은 코드가 있습니다 sun.net.www.protocol.http.HttpURLConnection $ HttpInputStream :

WebClient client = WebClient.create(adress); 
client.path(path); 
Response response = client.get(); 
InputStream recivedfile = (InputStream) response.getEntity(); 

Entity 클래스는 사실이다. Whern 나는 inputsteam 형식을 읽었습니다.

--uuid:e7c56944-f1c2-4cae-8460-4161b5100f60 
Content-Type: application/xml 
Content-Transfer-Encoding: binary 
Content-ID: <[email protected]> 
Content-Disposition: attachment; filename="file.xsl"  

<my file> 
--uuid:e7c56944-f1c2-4cae-8460-4161b5100f60-- 

전체 'Content'속성과 UUID 번호가 필요하지 않습니다. 이러한 연결을 건너 뛰고 연결을 읽는 가장 좋은 방법은 무엇입니까?

답변

0

나는 당신이 첨부 파일을 사용하므로 파일 스트림을 반환하는 getHandler 메서드로 첨부 파일을 직접 사용할 수 있음을 알 수 있습니다.

client.type("multipart/mixed").accept("multipart/mixed"); 
List<Attachment> atts = new LinkedList<Attachment>(); 
List<Attachment> atts = client.getCollection(atts, Attachment.class);