I want to create multiple file downloader without Activex on web page.
please answer me how to do.
Try compressing the files into a single zip file and offer to download that file.
Related
I am in an situation where i need to run one command-line tool for file which is uploaded in alfresco repository.The reason behind this is i need to perform OCR on that particular file.
I know i can use transformation which alfresco by default provides.But transformation does not provides conversation between same mimetype and my requirement is like performing OCR on PDF File(which contains images) and again generate PDF File(Which contains extracted data).
My approach is to create a policy, when node is uploaded in alfresco repository.
From that policy I will access the node which is uploaded in alfresco repository using java,Here is the problem ,I dont know under which location of alf_data directory the file is getting uploaded.As i need to get physical location of file.
By the way I am using linux system.
Can any one help on this?
You need to use the ContentService, specifically getReader(NodeRef,QName) then getContent(File) to a temporary file
Your code would then be something like
File tmp = File.createTempFile("for-ocr",".tmp");
ContentReader reader = contentService.getReader(nodeRef, ContentModel.PROP_CONTENT);
reader.getContent(tmp);
// Run the OCR program here
tmp.delete();
i am building a project in which i have to retrieve text content of a file,i read this article https://developers.google.com/appengine/docs/java/gettingstarted/staticfiles .in this article i can store file in the war/ directory and access it.but it is publicly accessible any one can access this file my file contain some sensitive data where to store this file and how to access it?? please guideline!!
You need to designate static file as described here:
https://developers.google.com/appengine/docs/java/config/appconfig#Static_Files_and_Resource_Files
You can definitely store statis files and process them as required in your application. Please keep your files into a folder that is not directly accessible by others.
I suggest the following:
Keep the files inside of /WEB-INF/myfiles or some folder like that inside of the /WEB-INF folder.
Use the File APIs to read the content of the files.
Hope this helps.
I have a swing application that uses many data files, these data files will change time to time. How can I load these data files on client's machine? Is there any way to create a folder like structure and run a batch file or so? Any help is appreciated.
There are several ways to do this:
Assume you want to ship your application with the datafiles, you may embed them as a zip/jar in your application-jar-file.
Extract the embedded zip to a temporary local file and use ZipFileSystemProvider to extract the content to some place on the disc.
Here is an example how to extract some content from zip/jar-file embedded in a .jar-file downloaded by JWS.
Same as 1, but skip the zip stuff and instead provide a list of all the resources you want to extract
One other way is to create the files pragmatically using either java.nio.file (java 7+) or java.io.File
I'm trying to create an app and have the ability to save files to /data/data/(packagename)/files or a directory similar to that. The goal would be to have a pdf or doc handler, as necessary, open the files stored on the internal storage and be viewed by the user. I have the code to get a pdf reader that is installed and display the file but I do not know how to package the files so they are installed in a directory like the one above. Also, if I am able to do this would I use getResources to access the files? How should the file structure look in eclipse to make this happen on install of the APK?
I do prefer to have the files stored internally (they are small) and not on the SD card.
I admit I am new to this and am trying to learn as I go. Thanks for the help!
As I understand your approach you only need to place your files to assets folder of your application and then just copy them to the internal storage. Read more here.
I'm facing a problem that, we have a .zip file that contains some text files. Now I'm using java to access that files. If it is not in the .zip file I can read and print on my console easily using FileInputStream.
But how to read a file from .zip file? I use J2SE only..
You should try a ZipInputStream. The interface is a little obtuse, but you can use getNextEntry() to iterate through the items in the .zip file.
As a side note, the Java class-loader does exactly this to load classes from .jar files without extracting them first.
Everything you need is in ZipFile: https://docs.oracle.com/javase/7/docs/api/java/util/zip/ZipFile.html. Google for examples on the web, and if you have specific problems then come back to SO for help.
(The link will eventually break; when it does simply websearch java zipfile.)