Which two code fragments are valid for adding an attachment in SAAJ? (Choose two

Which two code fragments are valid for adding an attachment in SAAJ? (Choose two.)

Which two code fragments are valid for adding an attachment in SAAJ? (Choose two.)

A.
AttachmentPart attachment =
request.createAttachementPart();
String stringContent = Update total;
attachment.setContent(stringContent,text/plain);
attachment.setContentID(update_total);
request.addAttachmentPart(attachment);

B.
Attachment attachment =
request.createAttachement();
String stringContent = Update total;
attachment.setContent(stringContent,text/plain);
attachment.setContentID(update_total);
request.addAttachment(attachment);

C.
URL url = new URL(http://eshop.com/products/tb.jpg); DataHandler datahandler = new DataHandler(url);
AttachmentPart attachment =
request.createAttachmentPart(dataHandler);
attachment.setContentID (attached_image);
request.addAttachmentPart(attachment);

D.
URL url = new URL(http://eshop.com/products/tb.jpg); DataHandler datahandler = new DataHandler(url);
Attachment attachment =
request.createAttachment(dataHandler);
attachment.setContentID (attached_image);
request.addAttachment(attachment);

E.
Attachment attachment =
request.newAttachement();
String stringContent = Update total;
attachment.setContent(stringContent,text/plain);
attachment.setContentID(update_total);
request.setAttachment(attachment);



Leave a Reply 3

Your email address will not be published. Required fields are marked *


Evgen

Evgen

The question representation is incorrect: quotes are missing.

leo yu

leo yu

A) create attachment content with text type
C) create attachment with bin type via dataHandler

Mohamed Fayek Saber

Mohamed Fayek Saber

A And C Correct ….

http://www.xyzws.com/scdjws/studyguide/saaj_print.html

//Attach an attachment ..
AttachmentPart attachment = message.createAttachmentPart();
String stringContent = “Update address for Sunny Skies “;
attachment.setContent(stringContent, “text/plain”);
attachment.setContentId(“update_address”);
message.addAttachmentPart(attachment);