< prev index next >

jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/AttachmentPartImpl.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 86,95 **** --- 86,96 ---- for (com.sun.xml.internal.org.jvnet.mimepull.Header hd : hdrs) { headers.addHeader(hd.getName(), hd.getValue()); } } + @Override public int getSize() throws SOAPException { if (mimePart != null) { try { return mimePart.read().available(); } catch (IOException e) {
*** 122,140 **** --- 123,143 ---- } return bout.size(); } } + @Override public void clearContent() { if (mimePart != null) { mimePart.close(); mimePart = null; } dataHandler = null; rawContent = null; } + @Override public Object getContent() throws SOAPException { try { if (mimePart != null) { //return an inputstream return mimePart.read();
*** 151,160 **** --- 154,164 ---- log.log(Level.SEVERE, "SAAJ0575.soap.attachment.getcontent.exception", ex); throw new SOAPExceptionImpl(ex.getLocalizedMessage()); } } + @Override public void setContent(Object object, String contentType) throws IllegalArgumentException { if (mimePart != null) { mimePart.close(); mimePart = null;
*** 163,189 **** --- 167,198 ---- setDataHandler(dh); } + @Override public DataHandler getDataHandler() throws SOAPException { if (mimePart != null) { //return an inputstream return new DataHandler(new DataSource() { + @Override public InputStream getInputStream() throws IOException { return mimePart.read(); } + @Override public OutputStream getOutputStream() throws IOException { throw new UnsupportedOperationException("getOutputStream cannot be supported : You have enabled LazyAttachments Option"); } + @Override public String getContentType() { return mimePart.getContentType(); } + @Override public String getName() { return "MIMEPart Wrapper DataSource"; } }); }
*** 195,204 **** --- 204,214 ---- throw new SOAPExceptionImpl("No data handler associated with this attachment"); } return dataHandler; } + @Override public void setDataHandler(DataHandler dataHandler) throws IllegalArgumentException { if (mimePart != null) { mimePart.close(); mimePart = null;
*** 214,252 **** log.log(Level.FINE, "SAAJ0580.soap.set.Content-Type", new String[] { dataHandler.getContentType() }); setMimeHeader("Content-Type", dataHandler.getContentType()); } public void removeAllMimeHeaders() { headers.removeAllHeaders(); } public void removeMimeHeader(String header) { headers.removeHeader(header); } public String[] getMimeHeader(String name) { return headers.getHeader(name); } public void setMimeHeader(String name, String value) { headers.setHeader(name, value); } public void addMimeHeader(String name, String value) { headers.addHeader(name, value); } ! public Iterator getAllMimeHeaders() { return headers.getAllHeaders(); } ! public Iterator getMatchingMimeHeaders(String[] names) { return headers.getMatchingHeaders(names); } ! public Iterator getNonMatchingMimeHeaders(String[] names) { return headers.getNonMatchingHeaders(names); } boolean hasAllHeaders(MimeHeaders hdrs) { if (hdrs != null) { --- 224,270 ---- log.log(Level.FINE, "SAAJ0580.soap.set.Content-Type", new String[] { dataHandler.getContentType() }); setMimeHeader("Content-Type", dataHandler.getContentType()); } + @Override public void removeAllMimeHeaders() { headers.removeAllHeaders(); } + @Override public void removeMimeHeader(String header) { headers.removeHeader(header); } + @Override public String[] getMimeHeader(String name) { return headers.getHeader(name); } + @Override public void setMimeHeader(String name, String value) { headers.setHeader(name, value); } + @Override public void addMimeHeader(String name, String value) { headers.addHeader(name, value); } ! @Override ! public Iterator<MimeHeader> getAllMimeHeaders() { return headers.getAllHeaders(); } ! @Override ! public Iterator<MimeHeader> getMatchingMimeHeaders(String[] names) { return headers.getMatchingHeaders(names); } ! @Override ! public Iterator<MimeHeader> getNonMatchingMimeHeaders(String[] names) { return headers.getNonMatchingHeaders(names); } boolean hasAllHeaders(MimeHeaders hdrs) { if (hdrs != null) {
*** 327,336 **** --- 345,355 ---- "Unable to copy MIME headers into attachment", ex); } } + @Override public void setBase64Content(InputStream content, String contentType) throws SOAPException { if (mimePart != null) { mimePart.close();
*** 363,372 **** --- 382,392 ---- throw new SOAPException(ex); } } } + @Override public InputStream getBase64Content() throws SOAPException { InputStream stream; if (mimePart != null) { stream = mimePart.read(); } else if (rawContent != null) {
*** 423,432 **** --- 443,453 ---- log.log(Level.SEVERE,"SAAJ0572.soap.no.content.for.attachment"); throw new SOAPExceptionImpl("No data handler/content associated with this attachment"); } } + @Override public void setRawContent(InputStream content, String contentType) throws SOAPException { if (mimePart != null) { mimePart.close(); mimePart = null;
*** 473,482 **** --- 494,504 ---- log.log(Level.SEVERE, "SAAJ0576.soap.attachment.setrawcontent.exception", e); throw new SOAPExceptionImpl(e.getLocalizedMessage()); } } */ + @Override public void setRawContentBytes( byte[] content, int off, int len, String contentType) throws SOAPException { if (mimePart != null) { mimePart.close();
*** 496,505 **** --- 518,528 ---- "SAAJ0576.soap.attachment.setrawcontent.exception", e); throw new SOAPExceptionImpl(e.getLocalizedMessage()); } } + @Override public InputStream getRawContent() throws SOAPException { if (mimePart != null) { return mimePart.read(); } if (rawContent != null) {
*** 520,529 **** --- 543,553 ---- log.severe("SAAJ0572.soap.no.content.for.attachment"); throw new SOAPExceptionImpl("No data handler/content associated with this attachment"); } } + @Override public byte[] getRawContentBytes() throws SOAPException { InputStream ret; if (mimePart != null) { try { ret = mimePart.read();
*** 554,569 **** --- 578,595 ---- throw new SOAPExceptionImpl("No data handler/content associated with this attachment"); } } // attachments are equal if they are the same reference + @Override public boolean equals(Object o) { return (this == o); } // In JDK 8 we get a warning if we implement equals() but not hashCode(). // There is no intuitive value for this, the default one in Object is fine. + @Override public int hashCode() { return super.hashCode(); } public MimeHeaders getMimeHeaders() {
< prev index next >