PDF file in slack - java

I'm trying to add file to slack message in my interactive app using List in java
I have PDF file in azure storage and link to the file that look like that https://azure.blob.core.windows.net/path/file.pdf
I also have the file in File object java.io.File;
how can I add it to the list probably using the FileBlock object?
I tried to add to the asBlocks method FileBlock but I couldn't find a way to make it work or give it my URL I get the invalid block error

Related

How to download file from a "Download" folder using postman or API

In my application, after clicking export icon, the report excel has been downloaded/generated in our local download folder in the system. I have tried to validate this action using service side (API)-postman. When I hit the export api (Application specific) , the response has not contain any path/file name that downloaded in the downloads folder. Is there any way that we can hit the downloads folder using api or any java programming way to get the downloaded excel.
I just want to read the excel data and compare with my input data using postman. First priority that I need to do it using api.
Select "Send and download" action in Postman. According to manual here:
If your API endpoint returns an image, Postman will detect and render
it automatically. For binary response types, you should select “Send
and download” which will let you save the response to your hard disk.
You can then view it using the appropriate viewer. This gives you the
flexibility to test audio files, PDFs, zip files, or anything that the
API throws at you.

How should I design my application flow for working with google doc files?

I have an application which is supposed to automatically fill placeholders of one google doc file and clone the result into the user's drive. Once I upload the doc file into developer's drive and when logged-in user requests resolved doc file, the following processes occur:
Gather information related to the user from remote services.
Get google doc file from developer's drive.
Parse placeholder from google doc file and replace them with gathered info.
Save resulting file as json into the database.
Upload resulting file into the user's drive.
As soon as file is uploaded - share link with user. Also give user the ability to download generated file as .docx.
The question is if it's possible to implement all steps using Java Google Docs API? Also I am not sure if the step with downloading file as .docx possible to implement?

How do I UPDATE (not add an additional) attachment in Atlassian Confluence with their Java API?

We have a custom plug-in that allows people to upload documents through the GUI, and add metadata about those documents within our plug-in. Also, another function of the plug-in, is we have an XML file being pushed to us via the Confluence SOAP service. This XML file is being attached to a specific file within the plug-in space, by the SOAP service, once a day.
We have now been charged with turning the process around. We will now make our own SOAP call to get the same XML file and attach it to the same page.
I can successfully attach a new file to the page, but when I try to update (replace) that XML file with a newer version, I end up uploading another file, so I am left with multiple copies of the file with the same name, which is not what we want.
Here is what I have that adds a new attachment, but does not update (replace) the attachment:
page = pageManager.getPage(spaceKey, pageTitle);
attachment = attachmentManager.getAttachment(page, attachmentFilename);
Attachment currentAttachment = null;
currentAttachment = (Attachment) attachment.clone();
attachment = new Attachment();
attachment.setFileName(attachmentFilename);
attachment.setContent(page);
attachment.setFileSize(fileSize);
attachment.setContentType(newAttachmentContentType);
attachment.setCreator(page.getCreator());
attachment.setCreationDate(date);
attachment.setComment(attachmentComment);
attachmentManager.saveAttachment(attachment, currentAttachment, dplAsStream);
Again, what I want is to replace filename.xml with an updated filename.xml, but what I am getting is filename.xml, filename.xml, filename.xml, etc.
As far as I know there is no simple updateAttachment since the file storage follows a version-based approach. Every upload of the same file (by its filename) will be a newer version of the already present file without removing the older one.
To implement your update functionality it might be necessary to do multiple steps:
Check if the file to be uploaded already exists (=update)
Remove a given version or all previous versions using the AttachmentManager
Upload the file
Maybe the CLI implementation gives some more details how they made it because here you can run an update command.

Data source reference is not valid when open downloaded file derectly from IE

I have server. There is feature - downloading excel(XLS) file. I build report with Jasper and send binary data to the responce stream. I set ContentType as "application/vnd.ms-excel;charset=windows-1252", so browser are able to recognise type of the file and offer user to open file directly or save as file to the local disk.
If user open file directly from IE(able to reproduce only in IE) he cannot create pivot table. "Data source reference is not valid" error appears:
I gather log with ProcMon and algorithm of file coping is next:
IE download file to IE temporary storage with name as in HTTP header. For example exportToExclel_2012.xls
IE run Excel process with -Embedding attribute.
Excel opens with exportToExclel_2012.xls title.
Excel copy file to own temporary storage with generated name. For example 30A27D77.xls.
Close IE temporary file(exportToExclel_2012.xls).
Make some file operations with Excel temporary file(seems parsing xls format). And close Excel temporary file 30A27D77.xls.
So it seems exist some reference from 30A27D77.xls file to exportToExclel_2012.xls(cause we exportToExclel_2012.xls title in Excel).
Question: could you please advice me next research steps or give some evidence that server side doesn't affect Pivot Table behavior?

Writing file from PHP page android

In my project a compressed file is displayed on a php in bytes.
I am trying to find a way to read the php page, decompress the file using GZIP, and write it out to the assets folder.
The file that I am reading in has to be placed in the data/data/package/database file.
I have a class that reads a file from the assets folder and places the file into data/data/package/database.
Is it possible to write to the assets folder during runtime? If not is there a better way to do this?
if the PHP script is running on a server, your Android app will need to make an HTTP request to retrieve the content. of course then it has to store it somewhere. the SQLite database is a good option, but you could also store content in files on the SD card.
there are a couple ways to do the HTTP connection part of it, and they're written up on the Android Dev Blog. Myself, I prefer the HttpURLConnection.

Categories