Package org.htmlunit.attachment
Class CollectingAttachmentHandler
- java.lang.Object
-
- org.htmlunit.attachment.CollectingAttachmentHandler
-
- All Implemented Interfaces:
java.io.Serializable,AttachmentHandler
public class CollectingAttachmentHandler extends java.lang.Object implements AttachmentHandler
AnAttachmentHandlerimplementation which creates anAttachmentfor each attached page, collecting all created attachments into a list.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CollectingAttachmentHandler()Creates a new instance.CollectingAttachmentHandler(java.util.List<Attachment> list)Creates a new instance which collects attachments into the specified list.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<Attachment>getCollectedAttachments()Returns the list of attachments collected by this attachment handler.voidhandleAttachment(Page page)Handles the specified attached page.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.htmlunit.attachment.AttachmentHandler
handleAttachment, isAttachment
-
-
-
-
Constructor Detail
-
CollectingAttachmentHandler
public CollectingAttachmentHandler()
Creates a new instance.
-
CollectingAttachmentHandler
public CollectingAttachmentHandler(java.util.List<Attachment> list)
Creates a new instance which collects attachments into the specified list.- Parameters:
list- the list to store attachments in
-
-
Method Detail
-
handleAttachment
public void handleAttachment(Page page)
Handles the specified attached page. This is some kind of information that the page was handled as attachment. This method will only be called ifAttachmentHandler.handleAttachment(WebResponse)has returned false for the response.- Specified by:
handleAttachmentin interfaceAttachmentHandler- Parameters:
page- an attached page, which doesn't get loaded inline
-
getCollectedAttachments
public java.util.List<Attachment> getCollectedAttachments()
Returns the list of attachments collected by this attachment handler. The returned list is modifiable, so that attachments can be removed after being processed.- Returns:
- the list of attachments collected by this attachment handler
-
-