@Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
AbstractFileAttachmentAction abstractFileAttachmentAction = (AbstractFileAttachmentAction) component;
Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
final FileAttachment fileAttachment = (FileAttachment) requestMap.get(FileAttachmentsRenderer.REQ_FILE_ATTACHMENT_KEY);
abstractFileAttachmentAction.setFileAttachment(fileAttachment);
final FileAttachments fileAttachmentsComponent = (FileAttachments) requestMap.get(FileAttachmentsRenderer.REQ_FILE_ATTACHMENTS_COMP_KEY);
abstractFileAttachmentAction.setFileAttachmentsComponent(fileAttachmentsComponent);
encodeComponent(context, abstractFileAttachmentAction);
encodeScriptAndStyles(context, abstractFileAttachmentAction);