/** * Gets the MIME content-type of this attachment. */ public String getContentType() { return ap.getContentType(); }
/** * Gets the MIME content-type of this attachment. */ public String getContentType() { return ap.getContentType(); }
public String getContentType() { return saajAttachment.getContentType(); }
@Override public String getContentType() { return saajAttachment.getContentType(); }
/** * Gets the MIME content-type of this attachment. */ public String getContentType() { return ap.getContentType(); }
@Override public String getContentType() { return saajAttachment.getContentType(); }
@Override public String getContentType() { return saajAttachment.getContentType(); }
java.util.Iterator iterator = message.getAttachments(); while (iterator.hasNext()) { AttachmentPart attachment = (AttachmentPart)iterator.next(); String id = attachment.getContentId(); String type = attachment.getContentType(); System.out.print("Attachment " + id + " has content type " + type); if (type.equals("text/plain")) { Object content = attachment.getContent(); System.out.println("Attachment contains:\n" + content); } }
private javax.xml.crypto.Data canonicalize(AttachmentData data,OutputStream outputStream) throws javax.xml.crypto.dsig.TransformException{ try{ AttachmentPart attachment = data.getAttachmentPart(); ByteArrayOutputStream os = new ByteArrayOutputStream(); attachment.getDataHandler().writeTo(os); OutputStream byteStream = null; ByteArrayInputStream byteInputStream = new ByteArrayInputStream(os.toByteArray()); if(outputStream == null){ byteStream = new ByteArrayOutputStream(); }else{ byteStream = outputStream; } Canonicalizer canonicalizer = CanonicalizerFactory.getCanonicalizer(attachment.getContentType()); InputStream is = canonicalizer.canonicalize(byteInputStream,byteStream); if(is!= null) return new OctetStreamData(is); return null; }catch(javax.xml.crypto.dsig.TransformException te){ logger.log(Level.SEVERE,"WSS1318.ac.transform.error",te); throw te; }catch(Exception ex){ logger.log(Level.SEVERE,"WSS1318.ac.transform.error",ex); throw new javax.xml.crypto.dsig.TransformException(ex.getMessage()); } }
Canonicalizer canonicalizer = CanonicalizerFactory.getCanonicalizer(attachment.getContentType()); InputStream is = canonicalizer.canonicalize(byteInputStream,byteStream); if(is != null) return new OctetStreamData(is);
buf.append( "\nContent Id: " + attachment.getContentId() ); buf.append( "\nContent Size: " + attachment.getSize() ); buf.append( "\nContent Type: " + attachment.getContentType() );
if (!SAAJUtil.compareContentTypes(attachment.getContentType(), handler.getContentType())) { ConfigurableDataHandler configuredHandler = new ConfigurableDataHandler(handler.getDataSource()); configuredHandler.setContentType(attachment.getContentType()); handler = configuredHandler;
if (!SAAJUtil.compareContentTypes(attachment.getContentType(), handler.getContentType())) { ConfigurableDataHandler configuredHandler = new ConfigurableDataHandler(handler.getDataSource()); configuredHandler.setContentType(attachment.getContentType()); handler = configuredHandler;
String mimeType = MimeUtils.getBaseMimeType(part.getContentType());
@Test public void imageService() throws Exception { SOAPMessage response = sendMessage(); XMLAssert.assertXMLEqual(RESPONSE, XMLHelper.toString(response.getSOAPPart().getDocumentElement())); Assert.assertTrue(response.getAttachments().hasNext()); AttachmentPart attachment = (AttachmentPart)response.getAttachments().next(); Assert.assertNotNull(attachment); Assert.assertEquals("image/jpeg", attachment.getContentType()); /* this assertion appears to be platform-dependent Assert.assertEquals(16384, attachment.getSize()); */ }
private XMLSignatureInput _resolveCid(Attr uri, String baseUri) throws ResourceResolverException { XMLSignatureInput result = null; String uriNodeValue = uri.getNodeValue(); if (soapMsg == null) throw generateException(uri, baseUri, errors[1]); try { AttachmentPart _part = ((SecurableSoapMessage)soapMsg).getAttachmentPart(uriNodeValue); if (_part == null) { // log throw new ResourceResolverException("empty", uri, baseUri); } Object[] obj = AttachmentSignatureInput._getSignatureInput(_part); result = new AttachmentSignatureInput((byte[])obj[1]); ((AttachmentSignatureInput)result).setMimeHeaders((Vector)obj[0]); ((AttachmentSignatureInput)result).setContentType(_part.getContentType()); } catch (Exception e) { // log throw new ResourceResolverException("empty", e, uri, baseUri); } try { URI uriNew = new URI(new URI(baseUri), uriNodeValue); result.setSourceURI(uriNew.toString()); } catch (URI.MalformedURIException ex) { result.setSourceURI(baseUri); } return result; }
result = new AttachmentSignatureInput((byte[])obj[1]); ((AttachmentSignatureInput)result).setMimeHeaders((Vector)obj[0]); ((AttachmentSignatureInput)result).setContentType(_part.getContentType()); } catch (XWSSecurityException e) { throw new ResourceResolverException("empty", e, uri, baseUri);
edhb.setMimeType(p.getContentType());